aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C Programming Language Quiz 2
  • what is the output of the following programmain(){ int x;...
Multiple choice c

what is the output of the following program

main(){
 int x;
 printf(“%d”,x);
}

  1. Unknown (random value)

  2. Zero

  3. 3000

  4. 4000

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

The variable x is declared but not initialized. In C, local non-static variables hold indeterminate (garbage) values until set. Accessing it results in undefined behavior, often printing a random value.

Keep practicing — related questions

  • What is the output of the following 'C' program? main() { printf(“ %x”,-1 >>4); }
  • what is the output of the following program int change( int x ) { x = 7; } main(){ int x = 5; change(x); pr...
  • What is the output of the following program ? main() { int a=10; { int a=100; { int a=1000; printf("%d", a)...
  • What will be the output of the following set of codes after execution? void main() { printf(“%d %d %d ”,56,...
  • What is the output of the given program? int main() { int x = 24; int y = 42; printf("%d",(~x) | (~y) ); }
  • Output???? #include int main() { int i=43; printf("%d\n",printf("%d",printf("%d",i))); return 0;}
  • What will be the output of the following program : void main() { printf("%d",!(100==100)+1); }
  • 3.What is the output?main() { int x=5; printf(“%d,%d,%dn”,x,x< <2,x>>2); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy