41. What does the term "memoization" refer to in Ruby? A. Converting a method into a lambda function B. Dynamically defining methods based on certain conditions C. Caching the return value of a method for future invocations D. Evaluating a block of code within the context of a specific object Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
42. What is the purpose of the Enumerator class in Ruby? A. It provides a way to enumerate over the elements of an array B. It allows you to create custom iterators for any enumerable object C. It allows you to define custom iteration behavior for any enumerable object D. It provides a way to enumerate over the elements of an array Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
43. What does the term "immutability" refer to in Ruby? A. The inability of an object to be modified after it is created B. The ability of an object to be modified after it is created C. The ability of an object to be destroyed after it is created D. The inability of an object to be destroyed after it is created Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
44. What is the purpose of the String#<< method in Ruby? A. It inserts a substring into another string B. It converts a string into lowercase C. It converts a string into uppercase D. It appends a string to the end of another string Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
45. What does the "bang" (!) operator do when appended to a method name in Ruby? A. It indicates that the method returns a new object instead of modifying the receiver B. It raises an exception if the method fails C. It indicates that the method mutates the receiver object D. It performs a bitwise operation on the receiver object Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
46. What is the purpose of the catch and throw keywords in Ruby? A. They are used for error handling in asynchronous code B. They provide a way to break out of nested loops or blocks C. They are used to define custom error messages D. They are used for error handling in asynchronous code Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
47. Which method in Ruby is used to convert an object to a JSON string? A. serialize B. from_json C. to_json D. parse_json Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
48. What is a "predicate method" in Ruby? A. A method that returns the result of a comparison between two objects B. A method that takes a block as an argument C. A method that raises an exception when called with invalid arguments D. A method that returns a boolean value indicating a condition Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
49. In Ruby, what is the purpose of the __send__ method? A. It allows you to dynamically invoke a method on an object B. It sends a message to the system kernel to perform a low-level operation C. It sends a message to the Ruby interpreter to execute a piece of code D. It evaluates a string as Ruby code within the current context Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
50. What does the autoload method in Ruby do? A. It loads a file asynchronously to improve performance B. It reloads a file every time it is accessed C. It loads all files in a directory when the program starts D. It automatically loads a specified file when a constant is accessed for the first time Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board