Quiz on Blocks

Take a quiz on block concepts.

1

What’s the output of the following code?

p [5, 3, 4, 2, 1].detect { |number| number.even? } 
A)

4

B)

2

C)

[4, 2]

D)

nil

Question 1 of 40 attempted