OA. free
Free
Qualcomm Embedded Systems & Hardware Core Computer Science Medium

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

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

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

I) While doing method overloading argument list should be same where as in method overriding argument list should be different

II) A class can have more than one private or final methods of same name but a child class cannot override the private or final methods of their base class

Choose one option.
Show answer & explanation
Answer: B. Only (II)

Statement (I) is FALSE: method overloading requires a DIFFERENT argument list (different types, number, or order of parameters), while method overriding requires the SAME argument list as the parent method. Statement (II) is TRUE: private and final methods cannot be overridden by child classes due to access restrictions (private) or explicit prevention (final), and a class can technically define multiple methods with the same name if they're private or final since they won't conflict with inheritance. Therefore, only statement (II) is correct.

Step-by-step Derivation:
Analysis of each statement:

Statement (I): FALSE

  • Method Overloading: Same method name, DIFFERENT argument list (varies in type, number, or order). Example: func(int), func(int, int), func(String).
  • Method Overriding: Same method name, SAME argument list, SAME return type (covariant), in parent-child classes. The statement reverses these definitions, making it incorrect.

Statement (II): TRUE

  • A class CAN have multiple private methods with the same name because Java allows method overloading within a class.
  • A class CAN have multiple final methods with the same name through overloading.
  • A child class CANNOT override private methods because they are not inherited (access scope prevents it).
  • A child class CANNOT override final methods because the 'final' keyword explicitly forbids overriding.
  • This statement correctly describes both behaviors.

Conclusion: Only statement (II) is true, so the answer is B.