Home / Programming Questions / Ruby MCQs / Page 136

Ruby MCQs with answers Page - 136

Dear candidates you will find MCQ questions of Ruby here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

Q. What is memoization in Ruby?

(A) Evaluating code at runtime based on user input
(B) Creating anonymous functions that can be called later
(C) Dynamically defining methods based on certain conditions
(D) Caching the return value of a method for future invocations

Q. What is the purpose of the instance_eval method in Ruby?

(A) Evaluating a block of code within the context of the current instance
(B) Dynamically defining methods on a specific instance
(C) Evaluating a block of code within the context of a specific object
(D) Accessing the instance variables of a class from within a class method

Q. What does the term "monkey patching" refer to in Ruby?

(A) Assigning custom methods to specific objects
(B) Modifying or extending existing classes or modules at runtime
(C) Overriding built-in methods with custom implementations
(D) Assigning custom methods to specific objects

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.