🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: C Data Types and Operators: all 10 questions

Quiz: C Data Types and Operators · Question 9 of 10

What happens with const int MAX = 10; followed later by MAX = 20;?

What happens with const int MAX = 10; followed later by MAX = 20;?

  1. A.MAX becomes 20
  2. B.MAX stays 10 silently
  3. C.Compile error: a const variable cannot be assigned
  4. D.The program crashes at run time
Answer & explanation

Correct answer: Compile error: a const variable cannot be assigned

const makes the compiler reject any attempt to change the value.

Can you get the rest right without peeking?

Take the timed Quiz: C Data Types and Operators quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →