C Programming MCQ

1:

If y is of integer type then the expression
 3 * ( y - 8 ) / 9 and  ( y - 8 )/ 9 * 3

A.

must yield the same value

B.

must yield different values 

C.

may or may not yield the same value

D.

none of these

 

Answer : C

Explanation :

If y = 11, the expression 3 * (y - 8) / 9 becomes 3 * 3 / 9. which evaluates to 1. But the expression ( y - 8 )/ 9 * 3 becomes 3 / 9 * 3. which evaluates to 0 (since 3 / 9 is 0)

prakash said: (4:38pm on Tuesday 30th April 2013)
=[3*(y-8)] / 9=[3*(11-8)] / 9=[3*(3)] / 9=9 / 9/=12ed=[(y-8)/9] * 3=[(11-8)/9] * 3=[(3)/9] * 3=[1/3] * 3=1thus,both r samemeans ans. is A

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.