Sunday, January 10, 2010

What value will x contain when the sample code below is executed?

int x = 3;
if( x == 2 );
x = 0;
if( x == 3 )
x++;
else x += 2;

a) 1
b) 2
c) 3
d) 4
e) 5

No comments: