Basic C Programming MCQ
Basic C Programming MCQ
41. The program fragment
int i = 263;
purchar (i);
- prints 263
- prints the ASCII equivalent of 263
- rings the bell
- prints garbage
42. Which of the following comments regarding the reading of a string, using scanf (with %s option) and gets, is true ?
- Both can be used interchangeably
- scanf is delimited by end of line, while gets is not.
- scanf is delimited by blank space, while gets is not.
- none of the above
46. The following program fragment
unsigned i = 1;
int j = -4;
printf("%u", i + j );
prints
- garbage
- -3
- aninteger that changes from machine to machine
- none of the above
47. If the following program fragment (assume negative numbers are stored in 2's complement form)
unsigned i = 1;
int j = -4 ;
printf "%u", i + j) ;
prints x, then printf ("%d", 8*sizeof (int));
Outputs an integer that is same as (log in the answer are to the base two)
- an unpredictable value
- 8 * log (x+3)
- log (x+3)
- none of the above
48. The following statements
for (i = 3; i < 15; i += 3)
{printf ("%d", i);
++i;
will result in the printing of
- 3 6 9 12
- 3 6 9 12 15
- 3 7 11
- 3 7 11 15
49. If a = 9, b = 5 and c = 3, then the expression (a - a/b * b%c) > a%b%c evaluates to
- true
- false
- invaid
- 0
50. In a for loop, if the condition is missing, then
- it is assumed to be present and taken to be false
- it is assumed to be present and taken to be true
- It results a syntax error
- execution will be terminated abruptly