OA. free
Free
Qualcomm Embedded Systems & Hardware Embedded Systems & Hardware Medium

QUESTION 49 Which of the given below statement(s) is/are false?

Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.

QUESTION 49

Which of the given below statement(s) is/are false?

I) A method declared final can be overridden.

II) A method declared static cannot be overridden but can be re-declared.

III) If a method cannot be inherited, then it cannot be overridden.

IV) A subclass within the same package as the instance's superclass can override any superclass method that is not declared private or final.

V) A subclass in a different package can only override the non-final methods declared public or protected.

Choose one option.
Show answer & explanation
Answer: C. Only (I), (II) and (III)

Statements I, II, and III are false. Statement I is false because final methods cannot be overridden by design. Statement II is false because static methods cannot be overridden at all (they are hidden/re-declared in subclasses, but this is not overriding). Statement III is false because if a method cannot be inherited due to access modifiers, it logically cannot be overridden either. Statements IV and V are true: same-package subclasses can override non-private/non-final methods, and different-package subclasses can only override public/protected non-final methods.

Step-by-step Derivation:
Evaluate each statement:

Statement I: FALSE – A final method cannot be overridden. The 'final' keyword explicitly prevents method overriding.

Statement II: FALSE – A static method cannot be overridden; it can only be hidden/re-declared. Overriding applies to instance methods, not static methods. Static method shadowing is not the same as overriding.

Statement III: FALSE – This is a logical contradiction. If a method cannot be inherited (e.g., because it's private), it cannot be overridden. Overriding requires inheritance first. The statement claims this would be impossible, but it's actually always true.

Statement IV: TRUE – Within the same package, a subclass can override any superclass method that is not private or final. Package-private (default), protected, and public methods are accessible and overridable.

Statement V: TRUE – In a different package, a subclass can only access and override public or protected methods (not package-private). Final keyword also prevents overriding.

False statements: I, II, III → Answer is C.