aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming
  • Give the output of the following program: main( ) { int a...
Multiple choice

Give the output of the following program: main( ) { int a=30,b=40,x; x=((a!=10) && (b=50)) printf(“x=%d”,x)' }

  1. x = 1

  2. x = 0

  3. no output

  4. none of these

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

The expression (a!=10) evaluates to 1 (true). Because of short-circuit evaluation in the AND operator, (b=50) is evaluated, which returns 50 (true). The result of 1 && 1 is 1.

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...
  • 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? main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf(“%d \t %dn”,x,y); }
  • The output of the following program will be main() { int a = 1, b=2, c=3; printf(“%d”, a+=(a+=3,5,a)); }
  • What will be the output of the following program : void main() { printf("%d",!(100==100)+1); }
  • What is the output of the given program? int main() { int x = 24; int y = 42; int z = 37; int a = 22; print...
  • What would be the output of the following? main() { int y,x=5; y=++x - ++x; printf("%d%d",x,y); }
  • Output? main() { int x=20,y=35; x=y++ + x++; y= ++y + ++x; printf(“%d%dn”,x,y); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy