aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • The following program fragment prints int a= 5 , b=2; pri...
Multiple choice

The following program fragment prints int a= 5 , b=2; printf(“%d” , a+++++b);

  1. 7

  2. 8

  3. 9

  4. none of above

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

The expression a+++++b is parsed as (a++) + (++b). a is 5, b is 2. (5++) + (++2) = 5 + 3 = 8. Since 8 is not an option, the answer is none of the above.

Keep practicing — related questions

  • The following program prints main() { int i = 5; i = (++i) / (i ++); printf(“%d”,i); }
  • What is the output of the following code fragment? int i = 10; if(i = printf(“%d”, i)) { printf(“%d ”, i); }
  • The output of the following program will be main() { int a = 1, b=2, c=3; printf(“%d”, a+=(a+=3,5,a)); }
  • Consider the following program segment: main() { int a=2; printf (“a= %d”,a); modify(a); printf (“a= %d”,a)...
  • 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 is the output of the following C program? main() { int a=10; int b; b=a++ + 20; printf("a=%d b=%d",a,b...
  • What gets printed? int i = 3; if (!i) i++; i++; if (i==3) i+=2; i+=2; printf("%d\n", i);
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy