πŸ“Š Ruby
Q. How do you create a hash (dictionary) in Ruby?
  • (A) { key1: 'value1', key2: 'value2' }
  • (B) [ key1 => 'value1', key2 => 'value2' ]
  • (C) ( key1: 'value1', key2: 'value2' )
  • (D) < key1: 'value1', key2: 'value2' >
πŸ’¬ Discuss
βœ… Correct Answer: (A) { key1: 'value1', key2: 'value2' }

Explanation: Hashes in Ruby are created using curly braces with key-value pairs.

Explanation by: Rati Dubey
Hashes in Ruby are created using curly braces with key-value pairs.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
47
Total Visits
πŸ“½οΈ
8 mo ago
Published
πŸŽ–οΈ
Rati Dubey
Publisher
πŸ“ˆ
91%
Success Rate