aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Servlets, JSP and C Programming Quiz
  • Find the output of this program. main() { int a[10]; prin...
Multiple choice technology programming languages

Find the output of this program. main() { int a[10]; printf("%d",*a+1-*a+3) ; }

  1. Compiler error

  2. 3

  3. -2

  4. 4

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

In the expression *a + 1 - *a + 3, the pointer dereference *a cancels out with -*a, leaving 1 + 3, which evaluates to 4.

Keep practicing — related questions

  • Find the output of this program. main() { int i=5; printf(“%d”,i=++i ==6); }
  • Find the output of this program. main() { int i=5; printf(“%d”,i=++i ==6); }
  • Find the output of this program. main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
  • Find the output of this program. main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }
  • Find the output of the following C program: main(){printf(%c, abcdefgh[4]);}
  • Find the output of the following C program: main(){int i=2;printf(%d %d,++i,++i);}
  • Find the output of the following C program: Main(){int i;For(i=1;i <=10;i ++){Printf(%d ”,i);i=i+1;}}
  • Find the output of the following C program: main(){int i=0;while(++i<=10) printf(%d, 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