1.

Considering the following C++ statements. Fill up the blanks 1. If p = 5 and q = 3 then q%p is .............. 2. If E1 is true and E2 is False then E1 && E2 will be .............3. If k = 8, ++k < = 8 will be ..........4. If x = 2 then (10* ++x) % 7 will be .......5. If t = 8 and m = (n=3,t-n), the value of m will be ......6. If i = 12 the value i after execution of the expression i+ = i- - +- -i will be ........

Answer»

1. 3 

2. False 

3. False(++k makes k = 9. So 9<=8 is false) 

4. 2(++x becomes 3 ,so 10 * 3 = 30%7 = 2) 

5. 5( here m = (n = 3,8-3) = (n = 3,5), so m = 5, The maximum value will take) 

6. Here i = 12

i + = i- – + – -i 

here post decrement has more priority than pre decrement. So “i- -” will be evaluated first. Here first uses the value then change so it uses the value 12 and i becomes 11 

i + = 12 + – -i 

now i = 11. 

Here the value of i will be changed and used so “i- -” becomes 10 

i + = 12 + 10 = 22 

So, i = 22 +10 

i = 32 

So the result is 32.



Discussion

No Comment Found

Related InterviewSolutions