aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • What is the final value of digit? main() { int digit; for...
Multiple choice

What is the final value of digit? main() { int digit; for(digit = 0 ; digit <=9; ++digit) printf(“%d ”,digit); digit = 2*digit; --digit; }

  1. 19

  2. -1

  3. 17

  4. 16

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

The loop runs for digit 0 to 9. After the loop finishes, the variable digit is 10. Then digit = 2 * 10 = 20, and finally --digit results in 19.

Keep practicing — related questions

  • What will be the value of i? int i = 1; i = i +2*i ++; printf(“%d”,i);
  • Guess the Output? void main() { int i=5; i+=i*=i-=i/i; printf("%dn",i); }
  • What will be the output of the following: void main() { int i; for(i=1;i<=4;i++) { printf("%d",i); continue...
  • What would be the output of the following? main() { int val1=1234; int val2=01234; printf(%d %d,val1,val2); }
  • Determine output: void main(){ int x,y; x = 5; y = ++x * ++x; printf("Value of x = %d and Value of y = %d\n...
  • int x = 0; for ( ; ; ) { if (x++ == 4) break; continue; } printf(x=%dn, x); What will be printed when the s...
  • What will be the output of the following program : void main() { printf("%d",!(100==100)+1); }
  • What is the output ? main() { int i=8; printf("%d%d%d%d", i, i++, ++i, i); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy