aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming - 2
  • The output of the following program will be main() { int ...
Multiple choice

The output of the following program will be main() { int a = 1, b=2, c=3; printf(“%d”, a+=(a+=3,5,a)); }

  1. 8

  2. 12

  3. 9

  4. 6

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

The expression a += (a += 3, 5, a) uses the comma operator. First, a becomes 4 (1+3). Then the expression evaluates to 4. Finally, a += 4 results in a being 8.

Keep practicing — related questions

  • 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...
  • The following program prints main() { int i = 5; i = (++i) / (i ++); printf(“%d”,i); }
  • What would be the output of the following? void main() { int a=10,b; b=a++ + ++a; printf("%d %d %d %d",b,a+...
  • What will be the output of the following program : void main() { printf("%d",!(100==100)+1); }
  • What is the output of the following code? #include void main() { int a=0,b=0; a = (b = 75) + 9; printf("\n%...
  • int main() { int a=500,b=100,c=30,d=40,e=19; a+=b-=c*=d/=e%=5; printf("%d %d %d %d %d",a,b,c,d,e); }
  • 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...
  • 1)main() { int i = 5; printf(“%d %d %d %d %d”,i++,i--,++i,--i,i); }
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