Int z;int x = 5;int y = -10;int a = 4;int b = 2;z = x++ - --y * b /a;What number will z in the sample code above containsA. 5B. 6C. 10D. 11

Showing Answers 1 - 7 of 7 Answers

Vijaya Bhaskar M

  • Jul 24th, 2005

Here the evaluation of expression starts from right side of the statement. so all variables are of type the b/a which is float result, so it will be taken as zero. and finally we will get the answer as 10


  • Mar 26th, 2007

execution starts from right hand side  since * and / has higher priority
1) so b/a(of type int)=2/4=0
2)--y * (b/a)  =0
3)x++ is post incrementer so answer is


  • Sep 21st, 2012

A. 5

  Was this answer useful?  Yes

mahesh sanadya

  • May 26th, 2013


  Was this answer useful?  Yes


  • Oct 18th, 2016

int z,x=5,y=-10,a=4,b=2;
z=(x++ - --y * b/a);(First we solve --y*b as precedence is ) (as --y = -11)
z=(x++ - (-11*b/a);
z=(x++ - (-22/4);
z=(x++ - (-5.2) Truncated So value will be only -5
write clear
z=(x++ -(-5);
x++ means 5 & when two minus are multiplied give result one +, so

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Answer Question

Click here to Login / Register your free account

Send   Reset


Related Answered Questions


Related Open Questions