21. In Ruby, what is a closure? A. A function that accepts another function as an argument B. A function that returns another function C. A function that captures the state of its surrounding scope D. A function that is defined within another function 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
22. What is the purpose of the call method in Ruby procs and lambdas? A. To return the value of the proc or lambda B. To execute the code contained within the proc or lambda C. None of the above D. To return the value of the proc or lambda 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
23. What does the lambda keyword return in Ruby? A. A Block object B. A Method object C. A Proc object D. A Lambda 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
24. Which of the following is true about the stability of variables within a block in Ruby? A. Variables defined outside the block can be modified within the block B. Variables defined inside the block can be modified outside the block C. Variables defined within the block cannot be modified inside the block D. Variables defined within the block cannot be modified outside the block 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
25. What is the purpose of using the next keyword within a block in Ruby? A. To skip the rest of the block and move to the next iteration B. To exit the block and return to the caller C. To execute the block with different parameters D. None of the above 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
26. In Ruby, what is the purpose of the -> (stabby lambda) syntax? A. To define a proc B. To define a method C. To define a block of code D. To define a lambda function 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
27. What does the arity method return for a proc or lambda in Ruby? A. The number of optional arguments for the proc or lambda B. The total number of arguments for the proc or lambda C. The number of required arguments for the proc or lambda D. None of the above 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