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

Find the output of the following C program:

main(){int a[5]={2,3};printf(%d%d%d,a[2],a[3],a[4]);}

  1. Garbage value

  2. 2 3 3

  3. 3 2 2

  4. 0 0 0

  5. None of these

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

a[5] = {2, 3, 0, 0, 0}; so the value of a[2] = 0, a[3] = 0 and a[4] = 0.

Keep practicing — related questions

  • What would be the output of the following program? main() { int a[5] = {2,3};; printf("\n%d %d %d", a[2],a[...
  • What will be the output of the following function? main() { int a[10]; printf(%d,*a+1-*a+3); }
  • What is the output ?main(){ int a[5]={1,2,3,4,5}; a[7] = 23; printf("%d", a[7]);}
  • void main() { int a[2][3]={{1,2,3},{4,5,6}}; printf("%d\n",++**(a+1)); }
  • Find the output of the following C program: main(){extern int a;printf(%d, a);}int a =20;
  • Print the output of this program main() { int k = 5; if (++k < 5 && k++/5 || ++k <= 8); printf("%d\n", k); }
  • Find the output of the following C program: main(){printf(%c, abcdefgh[4]);}
  • Find the output of this program. main() { int a[10]; printf("%d",*a+1-*a+3) ; }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy