Bird
0
0

Which of the following is the correct syntax to call the parent method with no arguments using super?

easy📝 Syntax Q12 of 15
Ruby - Inheritance
Which of the following is the correct syntax to call the parent method with no arguments using super?
Asuper()
Bsuper[]
Csuper
Dsuper{}
Step-by-Step Solution
Solution:
  1. Step 1: Understand super with parentheses

    Using super() calls the parent method explicitly with no arguments, ignoring any current method arguments. Only super() uses parentheses correctly to pass no arguments; other forms are invalid syntax.
  2. Final Answer:

    super() -> Option A
  3. Quick Check:

    super() means no arguments [OK]
Quick Trick: Use parentheses to call parent with no args: super() [OK]
Common Mistakes:
  • Using super without parentheses to mean no arguments
  • Using brackets or braces instead of parentheses
  • Confusing super() with super without parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes