What does the term "duck typing" refer to in Ruby?
A. The process of explicitly casting objects to a specific type
B. Assigning types to variables based on their values
C. The practice of allowing objects of different types to respond to the same method call
D. Determining an object's type based on its methods
Answer: Option C
What is metaprogramming in Ruby?
A. Writing code that modifies its own structure
B. Writing code that writes code
C. Writing code that generates other code
D. Writing code that optimizes performance
Which Ruby module provides reflection capabilities for classes, modules, and objects?
A. Kernel
B. MetaModule
C. ObjectSpace
D. Reflection
What is the purpose of the method_missing method in Ruby?
A. Intercepting method calls before they are executed
B. Defining custom method behaviors based on method names
C. Handling undefined method calls
D. Providing default implementations for missing methods
What is a singleton class in Ruby?
A. A class that can have only one method
B. A class that is used to define methods for a single object
C. A class that can have only one subclass
D. A class that can have only one method
Join The Discussion