C Programming MCQ

1:

The following program fragment
int k = -7;
printf(“%d", 0 < lk);

A.

prints 0

B.

prints a non-zero value

C.

is illegal

D.

prints an unpredictable value

 

Answer : A

Explanation :

k = -7. So, if 'k' is used as a Boolean variable, it will be treated as a true condition. So. ! k will be false i.e., 0. So, 0 < ? !k is actually 0 < 0. which is false. So. 0 will be printed.

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.