ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
What is the output of the code
print "What's your first name?"
first_name=gets.chomp
a=first_name.capitalize
first_name.capitalize!
print "What's your last name?"
last_name=gets.chomp
b=last_name.capitalize
last_name.capitalize
puts "My name is #{first_name} #{last_name}"
Correct Answer: C — What’s your first name amil
puts a[2] outputs 'language' and returns nil. b[nil] returns nil. puts nil outputs a blank line. The index used is nil so output is '2' (index of 'language' is 2).