aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • What will be the value of y in the following program frag...
Multiple choice

What will be the value of y in the following program fragment? int y = 10; If(y++ >9 && y++! = 10 && y++>10)

  1. 10

  2. 11

  3. 12

  4. 13

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

y starts at 10. (y++ > 9) is true (10 > 9), y becomes 11. (y++ != 10) is true (11 != 10), y becomes 12. (y++ > 10) is true (12 > 10), y becomes 13. All conditions true, y ends at 13.

Keep practicing — related questions

  • What is the value of 'number' after the following code fragment execution? int number = 0; int number2 = 12...
  • given x = y--; What will be true after execution?
  • What is the value of k after the following code fragment? int k = 0; int n = 12 while (k < n) { k = k + 1; }
  • Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what ...
  • Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what ...
  • Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what ...
  • int x = 3; if( x == 2 ) x = 0; if( x == 3 ) x++; else x += 2; What value will x contain when the above samp...
  • What is the value of variable z when the following program segment ends? int z; for(z=0; z<50; z++) {}
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Output Evaluation (1721 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy