Vidyalelo
Ruby Programming · Q31

Advanced Topics in Ruby

Programming · Ruby Programming · question 31

Q31

What is the main difference between instance_eval and class_eval in Ruby?

A.
instance_eval evaluates code within the context of a method, while class_eval evaluates code within the context of a block
B.
instance_eval evaluates code within the context of a block, while class_eval evaluates code within the context of a method
C.
instance_eval evaluates code within the context of an object, while class_eval evaluates code within the context of a class
Answer
D.
instance_eval evaluates code within the context of a class, while class_eval evaluates code within the context of an object

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board