aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming Language Quiz 2
  • What is the output of the following piece of code? int x ...
Multiple choice c

What is the output of the following piece of code?

int x = 3, y = 5, z ;
z = x++ + ++y;

printf(“%d”,z);

  1. 8

  2. 9

  3. 10

  4. 11

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The expression x++ + ++y is evaluated. x++ uses the value of x (3) then increments it to 4. ++y increments y to 6 then uses 6. The sum is 3 + 6 = 9.

Keep practicing — related questions

  • What would be the output of the following? void main() { int z,x=5,y=-10,a=4,b=2; z=x++ - --y *b/a; printf(...
  • What would be the output of the following? main() { int y,x=5; y=++x - ++x; printf("%d%d",x,y); }
  • What is the output of the given code? int main() { int x = 24; int y = 42; int z = 37; int a = 22; printf(%...
  • The output of the following code snippet is ___________ ( ) main( ) { int x=3,y,z; y=x=10; z=x<10; printf(n...
  • What is the output of the following piece of code: int x = 7; if ( x = 3 ) printf( “%d“ , x);
  • int a=10,b; b=a++ + ++a; printf(%d,%d,%d,%d,b,a++,a,++a); What will be the output when following code is ex...
  • What is the output of the following code? #include void main() { int a=0,b=0; a = (b = 75) + 9; printf("\n%...
  • What would be the output of the following? void main() { int a=10,b; b=a++ + ++a; printf("%d %d %d %d",b,a+...
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy