aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • C++ Programming
  • What will be the output of the following code? int main{ ...
Multiple choice

What will be the output of the following code? int main{ const int x = 1; x++; }

  1. 2

  2. 1

  3. Compile time error

  4. 0

  5. None of these

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

The const keyword makes the value of the variable constant and we cannot change its value, so it will give compile time error.

Keep practicing — related questions

  • What will be the output of the following program : void main() { int a=1,b=2,c=3; c=(--a, b++)-c; printf("%...
  • What will be the output of the following program : void main() { int val=2; val = - --val- val--- --val; pr...
  • What will be the output of the following program : void main() { int a=1,b=2,c=3,d=4,e; e=(a,a)+(b,c)+(c,d)...
  • What will be the output of the following program : void main() { int a=5,b=6; Printf("%d %d %d",a,b,--a*++b...
  • What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<
  • What will be the output of the following program : void main() { int a=5; int b=6;; int c=a+b; printf("%d",...
  • What will be the output of the following: void main() { char * const ptr="abc"; ptr="xyz"; printf("%s",ptr); }
  • What will be the output of the following program : void main() { int a=5; printf("%d"); }
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Languages and Compilers (2284 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy