C Programming MCQ

1:

The following program fragment

int a = 4, b = 6;
printf ("%d", a = b) ;

A.

outputs an error message

B.

prints 0

C.

prints 1

D.

6

 

Answer : D

Explanation :

Here in this program, the output will be '6' .

The program assigns b's value to a. So, a becomes 6. While, the "%d" will display value of the second variable in the printf statement which is "b=6"

suman sharma said: (4:23pm on Wednesday 18th September 2013)
output of this program is=6;because we assign the value of b to a, we have b=6 then automatically value a=6;

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.