Basic C Programming MCQ
Basic C Programming MCQ
11. Consider the statement
putchar (getchar {});
putchar (getchar {});
if
a
b
is the input, the output will be
- an error message
- this can't be the input
- ab
- a b
12. Let a, b be two positive integers. Which of the following options correctly relates / and % ?
- b = (a/b) *b + a%b
- a = (a/b) *b + a%b
- b = (a%b) *b +a/b
- a = (a%b) *b a/b
15. Which of the following are true regardless of the implementation ?
- sizeof (int) is not less than sizeof (long)
- sizeof (short) equals sizeof (int)
- sizeof (int) equals sizeof (unsigned)
- sizeof (double) is not less than sizeof (float)
16. Coercion
- takes place across an assignment operator
- takes place if an operator has operands of different data types.
- means casting
- none of the above
17. Choose the correct statements
- Casting refers to implicity type conversion
- Casting refers to implicity type conversion
- Casting refers to explicit type conversion
- Coercion refers to explicit type conversion
18. Consider the following program fragment
char c = 'a';
while (c++ <= 'z')
putchar (xxx)
If the required output is abcdefghijklmnopqrstuvwxyz, then xxx should be
- c
- c++
- c-1
- -c
19. Which of the following comments are true?
- C provides no input-output feature
- C provides no file access features.
- C borrowed most of its ideas from BCPL
- C provides no features to manipulate composite objects
20. If y is of integer type then the expression
3 * (y - 8) / 9 and ( y - 8) / 9 * 3
- must yield the same value
- must yield different values
- may or may not yield the same value
- none of the above