Question: Answer the following questions: 1. Keys in a Ruby Hash can be__. A.String type only B. Integer type only C. String and integer type only

Answer the following questions:

1. Keys in a Ruby Hash can be__.

A.String type only
B. Integer type only
C. String and integer type only

D. Any Ruby object type

2.

Given the following hash:

names = Hash["a" => "Marc", "b" => "Cheyenne", "c" => "Alexander", "d" => Mia]

Which one of the following returns "true"?

A. names.has_key?(Mia")
B. names.has_key?(a)
C. names.has_key(Marc)
D.

names.has_key?(a")

3.

Please fill the blanks.

names._____ do |key, _____| puts "#{key} is #{value}" end
A. each; value
B merge; value
C each; =>
D

merge; =>

4. True or False. We can "rocket" a key to more than one value in a hash.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!