Hash Quiz


animals = {
  "first" => "kangaroo",
  "second" => "koala",
  "third" => "pterodactyl",
  0 => "a number, not an animal"
}

Consider the above hash, animals. Invoking animals[0] returns what?

kangaroo koala pterodactyl a number, not an animal nil

Consider the above hash, animals. Invoking animals[-1] returns what?

kangaroo koala pterodactyl a number, not an animal nil

Invoking the #values method on a hash returns what type of object?

Hash Array String Integer
animals = {
  first: "kangaroo",
  second: "koala",
  third: "pterodactyl"
}

Consider the above hash, animals. Invoking animals["first"] returns what?

kangaroo koala pterodactyl nil
hash = {one: :two}
hash[:two] = :three
hash[:one] = :four

puts hash[:one] # ????
puts hash[:two] # ????

Consider the above hash. What is hash[:one] ?

:one :two :three :four

Consider the above hash. What is hash[:two] ?

:one :two :three :four

results matching ""

    No results matching ""