QUESTION 60 Which of the statement given in options is false?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
QUESTION 60
Which of the statement given in options is false?
Show answer & explanation
Static variables are automatically initialized to default values (0 for primitives, null for objects) by the compiler if not explicitly initialized, so initialization at declaration is not mandatory. In contrast, final variables must be explicitly initialized either at declaration or in the constructor, and once initialized, cannot be reinitialized—making options B and D true and option A true (static variables can be reassigned/reinitialized multiple times).
Step-by-step Derivation:
Evaluate each statement:
A) True — Static variables CAN be reinitialized. Once declared, a static variable can be reassigned to new values multiple times during program execution.
B) True — Final variables CANNOT be reinitialized. The final keyword prevents reassignment after initial initialization.
C) FALSE — Static variables are NOT mandatory to be initialized at declaration. The JVM/compiler automatically initializes static primitives to 0 and static object references to null if no explicit initializer is provided.
D) True — Final variables MUST be initialized either at declaration or in a constructor. The compiler enforces this rule.
Therefore, option C is the false statement.