ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
What is the output of the given code
print "what's your first name?"
first_name=gets.chomp
a=first_name.capitalize
"a".reverse
puts"My name is #{a}"
Correct Answer: D — What’s your first name amil
"a".reverse reverses the string literal 'a', not the variable. a holds capitalized value but first_name is unchanged. Prompt is printed.