Bird
0
0

Which of these exception classes is NOT a subclass of StandardError in Ruby?

easy📝 Conceptual Q2 of 15
Ruby - Error Handling
Which of these exception classes is NOT a subclass of StandardError in Ruby?
ASyntaxError
BArgumentError
CNoMethodError
DZeroDivisionError
Step-by-Step Solution
Solution:
  1. Step 1: Recall subclasses of StandardError

    Common runtime errors like NoMethodError, ArgumentError, and ZeroDivisionError inherit from StandardError.
  2. Step 2: Identify exceptions outside StandardError

    SyntaxError inherits directly from Exception, not StandardError.
  3. Final Answer:

    SyntaxError -> Option A
  4. Quick Check:

    SyntaxError not under StandardError [OK]
Quick Trick: SyntaxError inherits directly from Exception, not StandardError [OK]
Common Mistakes:
  • Assuming all errors are under StandardError
  • Confusing SyntaxError with runtime errors
  • Not checking inheritance tree

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes