Bird
0
0

Why does Ruby allow methods to end with ? and ! suffixes instead of using separate keywords?

hard📝 Conceptual Q10 of 15
Ruby - Methods
Why does Ruby allow methods to end with ? and ! suffixes instead of using separate keywords?
ATo make methods private by default
BTo enforce strict type checking at runtime
CTo provide clear, concise naming that indicates method behavior
DTo prevent methods from being overridden
Step-by-Step Solution
Solution:
  1. Step 1: Understand Ruby's design philosophy

    Ruby emphasizes readable and expressive code, so suffixes help communicate method intent clearly.
  2. Step 2: Check other options

    Suffixes do not enforce type checking, prevent overriding, or affect method visibility.
  3. Final Answer:

    To provide clear, concise naming that indicates method behavior -> Option C
  4. Quick Check:

    Suffixes improve code clarity and intent [OK]
Quick Trick: Suffixes clarify method purpose without extra keywords [OK]
Common Mistakes:
MISTAKES
  • Thinking suffixes enforce types
  • Assuming suffixes affect visibility
  • Believing suffixes prevent overrides

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes