Classical

C Programming MCQ - I/O Operations

46:   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 :

Click on Discuss to view users comments.

Write your comments here:



47:   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 :

Click on Discuss to view users comments.

Write your comments here:



48:  

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.

Click on Discuss to view users comments.

jagadeesh said: (9:27pm on Tuesday 30th May 2017)
here the statement is false when 0 and true in remaining all cases the logic in the question can be rewritten as 10?(0?5:1):12 here 10 is true so 0?5:1 is executed and 0 is false so 1 is returned

Write your comments here:



49:   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 :

Click on Discuss to view users comments.

Write your comments here:



50:   Find the output of the following : for (i=1,j=10;i
A. 1 1 0 2 9 3 8 4 7 5 6
B. 1 2 3 4 5 1 0 9 8 7 6
C. 1 1 1 1 1 9 9 9 9 9
D. Infinite Loop
 
 

Option: A

Explanation :

Click on Discuss to view users comments.

Write your comments here:






*********
X