Multiple choice technology programming languages

Which of the following are correct ruby array declaration. Select all that apply.

  1. a = [0, 0, 0, 0, 0]

  2. days = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]

  3. clues = Array.new clues << 'vitamins' clues << 'minerals' clues << 'chocolates'

  4. name = %w(Harry monty michale)

Reveal answer Fill a bubble to check yourself
A,B,C,D Correct answer
Explanation

All four options show valid Ruby array syntax. Option A shows a numeric array literal. Option B shows a string array literal. Option C demonstrates Array.new followed by the << operator. Option D uses %w() for word array syntax. All are correct Ruby declarations.