Important MCQ

const int MAX = 10; MAX = 20; results in

Q.const int MAX = 10; MAX = 20; results in

A) a warning only
B) MAX becomes 30
C) a compile error
D) MAX becomes 20
Correct Answer:
Option C
Detailed Explanation:
C) a compile error is correct. A constant has a fixed value. const variables must be initialized when declared and cannot be reassigned; #define is a preprocessor directive and has no trailing semicolon.