Complete the code to create a string object in Ruby.
greeting = [1]In Ruby, strings are objects created by enclosing text in quotes.
Complete the code to check the class of an object in Ruby.
number = 10 puts number.[1]
type which is not a Ruby method.kind or object_type which do not exist.The class method returns the class of an object in Ruby.
Fix the error in the code to call a method on an integer object.
num = 5 puts num.[1]
Integers do not have a length, upcase, or split method. to_s converts the integer to a string.
Fill both blanks to create a hash with symbol keys and access a value.
person = { [1]: "Alice", [2]: 30 }
age = person[:age]
puts ageSymbols like :name and :age are used as keys in Ruby hashes. Accessing with person[:age] returns 30.
Fill all three blanks to create an array, add an element, and print its length.
fruits = [1] fruits.[2]("banana") puts fruits.[3]
append which is not a Ruby array method.An empty array is []. Use push to add an element. length returns the number of elements.
