Classical

C Programming MCQ - I/O Operations

46:   In a 'C' program, constant is defined
A. Before main
B. After main
C. Anywhere, but starting on a new line
D. Any where in the program
 
 

Option: C

Explanation :


47:   Printf("%d"printf("tim"));
A. Result in a syntax error
B. Outputs tim3
C. Outputs garbage
D. Prints tim and terminate abruptly
 
 

Option: B

Explanation :


48:   If abc is the input, then folloiwng program fragment
char x,y,z;
printf("%d",scanf("%c%c%c",&x,&y,&z));
results in
A. A syntax error
B. Garbage Values
C. Segmentation violation
D. Printing of 3
 
 

Option: D

Explanation :


49:  

What does the statement,
printf("%d",10?0?5:1:12);
prints :

A.

10

B.

5

C.

12

D.

1

 
 

Option: D

Explanation :

It will print '1' as  : operator states that either  first or second condition true.


50:   Result of the execution of the following "C" program fragment is
int i= 107,x =5;
printf((x>7)?"%d";"%c";i))
A. An execution error
B. A syntax error
C. Printing of k
D. Garbage Value
 
 

Option: C

Explanation :




Suggest an improvement