Multiple choice technology programming languages

my_array = ["alpha", "beta", "gamma"] puts my_array.collect do |word| word.capitalize End==> output? alpha beta gamma

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The code uses collect (also known as map) with do...end block syntax, which has lower precedence than method calls. This means puts my_array.collect do...end is parsed as puts(my_array.collect) do...end, which just outputs the original array without applying the transformation. The output alpha beta gamma is correct because the capitalize operation never executes.