Loading practice questions
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
Explanation:
"a".reverse reverses the string literal 'a', not the variable. a holds capitalized value but first_name is unchanged. Prompt is printed.