Q.1.
The .upcase and .capitalize method are used for capitalizing the whole string.
Q.2.
What is the use of .capitalize method?
Q.3.
What is the role of ! at the end of the capitalize method?
Q.4.
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}"
Q.5.
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}"
Q.6.
What is the output of the given code? print "what's your first name?" first_name=gets.chomp a=first_name.capitalize "first_name.capitalize!".reverse puts"My name is #{first_name}"
Q.7.
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}"
Q.8.
What is the output of the given code? print "What's your first name?" first_name=gets.chomp a=first_name.capitalize a=a.reverse puts"My name is #{a}"
Q.9.
What do we mean by expression substitution?
Q.10.
What is the output of the given code? x, y, z = puts "The value of x is #{ x }." puts "The sum of x and y is #{ x + y }." puts "The average was #{ (x + y + z)/3 }."
Q.11.
What does %{Learn ruby language} represents?
Q.12.
What does %Q{ Learn ruby language } represents?
Q.13.
What does %x!ls! represents?