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

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy