What is the main difference between a lambda and a Proc in Ruby?
A. Procs can be converted to lambdas, but lambdas cannot be converted to Procs
B. Lambdas are objects of the Proc class, while Procs are not
C. Lambdas enforce strict argument checking, while Procs do not
D. Procs can accept a variable number of arguments, while lambdas cannot
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. None of the above

Join The Discussion