Bird
0
0

Why does Ruby allow calling super without parentheses to forward arguments automatically to the parent method?

hard📝 Conceptual Q10 of 15
Ruby - Inheritance
Why does Ruby allow calling super without parentheses to forward arguments automatically to the parent method?
ABecause parentheses are optional in all method calls in Ruby
BTo simplify code by forwarding all current method arguments implicitly
CTo force the parent method to receive no arguments
DTo call a block instead of a method
Step-by-Step Solution
Solution:
  1. Step 1: Understand Ruby's super behavior

    When super is called without parentheses, Ruby forwards all arguments received by the current method to the parent method automatically.
  2. Step 2: Reason why this is useful

    This feature simplifies code by avoiding the need to manually pass arguments when forwarding calls.
  3. Final Answer:

    To simplify code by forwarding all current method arguments implicitly -> Option B
  4. Quick Check:

    super without () forwards arguments automatically [OK]
Quick Trick: super without () forwards all current method arguments [OK]
Common Mistakes:
  • Thinking parentheses are always optional
  • Believing super without () sends no arguments
  • Confusing super with block calls

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes