Which of the below given statement(s) is/are false?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which of the below given statement(s) is/are false?
I) In Has-A relationship an object of one class is created as data member in another class the relationship between these two classes is Has-A.
II) We can inherit the final method but cannot override the final method inside the child class.
III) A class with static modifier cannot be inherited.
Show answer & explanation
Statement I is TRUE: Has-A relationship (composition/aggregation) correctly describes when one class contains an object of another class as a data member. Statement II is TRUE: final methods can be inherited but cannot be overridden—this is the correct behavior of the final keyword. Statement III is FALSE: In Java, only inner classes can have the static modifier; a top-level class cannot be declared static, and static inner classes can still be inherited (subclassed) by other classes. Therefore, only statement III is false.
Step-by-step Derivation:
Evaluate each statement:
Statement I (TRUE): Has-A relationship defines composition/aggregation where one class contains an instance of another class as a data member. Example: class Car { Engine engine; } — Car HAS-A Engine.
Statement II (TRUE): The final keyword on a method means:
- It CAN be inherited (child class sees it and can call it via super or directly)
- It CANNOT be overridden (child class cannot redefine the method)
This is the intended design pattern.
Statement III (FALSE): In Java:
- Top-level classes CANNOT be declared static (syntax error)
- Inner classes CAN be static (static nested classes)
- Static nested classes CAN be inherited by other classes
The statement conflates 'having static modifier' with 'cannot be inherited,' which is incorrect.
Answer: Only statement III is false → Option B