Ruby - InheritanceIn Ruby, what does the expression ChildClass < ParentClass check?AIf ChildClass and ParentClass are the same classBIf ChildClass is an instance of ParentClassCIf ChildClass is a subclass of ParentClassDIf ParentClass is a subclass of ChildClassCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the < operator for classesIn Ruby, the < operator between classes checks inheritance, specifically if the left class is a subclass of the right class.Step 2: Apply to ChildClass < ParentClassThis expression returns true if ChildClass inherits from ParentClass, meaning ChildClass is a subclass.Final Answer:If ChildClass is a subclass of ParentClass -> Option CQuick Check:Subclass check = true if inheritance [OK]Quick Trick: Remember: < means 'is subclass of' in Ruby classes [OK]Common Mistakes:Confusing subclass check with instance checkThinking < checks equality of classesReversing the order of classes in the expression
Master "Inheritance" in Ruby9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Ruby Quizzes Blocks, Procs, and Lambdas - Why blocks are fundamental to Ruby - Quiz 3easy Class Methods and Variables - Why class-level behavior matters - Quiz 6medium Classes and Objects - Class declaration syntax - Quiz 13medium Classes and Objects - Why everything is an object in Ruby - Quiz 4medium Enumerable and Collection Processing - Map/collect for transformation - Quiz 6medium Enumerable and Collection Processing - Why Enumerable is Ruby's most powerful module - Quiz 14medium Error Handling - Begin/rescue/end blocks - Quiz 3easy Error Handling - Ensure for cleanup - Quiz 10hard Inheritance - Is_a? and kind_of? for type checking - Quiz 9hard Modules and Mixins - Prepend for method chain insertion - Quiz 9hard