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}"
amil jones
What’s your first name amil
My name is amil
My name is limA
Browse topic-based Ruby practice sets.
96 practice sets · Page 1 of 5
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}"
amil jones
What’s your first name amil
My name is amil
My name is limA
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}"
amil jones
My name is limA
My name is amil
What’s your first name amil
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}"
None of the mentioned
Amil Jones
What’s your first name amil
My name is Amil jones
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}"
My name is Amil Jones
None of the mentioned
What’s your first name amil
Amil Jones
What is the output of the given code
a=["hey", "ruby", "language"]
b=[puts b[puts a[2]
3 ruby
2
None of the mentioned
Error
What is the output of the given code
a=["hey", "ruby", "language"]
b=["hey", "language", "ruby"]
if a==b
print "Equal"
else
print "Not equal"
end
Error
None of the mentioned
Equal
Not equal
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 }."
Syntax error
None of the mentioned
The value of x is 12.
12,48,40
What is the output of the given code
a=["hey", "ruby", "language"]
b=["hey", "ruby", "language"]
if a==b
print "Equal"
else
print "Not equal"
end
Equal
Not equal
Error
None of the mentioned
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}"
My name is Amil
My name is lima
amil jones
What’s your first name amil
What is the output of the given code
a=[1,2,3,4,b=[1,2,3,4,if a==b
print "Equal"
else
print "Not equal"
end
Error
Not equal
Equal
None of the mentioned
What is the output of the given code
a=[1,2,3,4,b=[1,2,4,6,if a[3]==b[ print "Equal"
end
4
None of the mentioned
Error
Equal
What is the output of the given code
string_array = ["a","e","i","o","u"]
boolean_array = ["True","False"]
puts string_array[puts boolean_array[1]
[“a”,”e”,”i”,”o”,”u”].
Error
o
None of the mentioned
What is the output of the given code
string_array = ["a","e","i","o","u"]
boolean_array = ["True","False"]
puts string_array[puts boolean_array[0]]
[“a”,”e”,”i”,”o”,”u”].
None of the mentioned
Error
o
What is the output of the given code
string_array = ["a","e","i","o","u"]
print string_array[3]
o
Error
None of the mentioned
[“a”,”e”,”i”,”o”,”u”].
What is the output of the given code
string_array = ["a","e","i","o","u"]
print string_array
Error
Vowels
[“a”,”e”,”i”,”o”,”u”].
None of the mentioned
While loop checks the condition and the loop keeps on running till the condition is true, it stops when the condition becomes false.
True
False
Methods should not be written inside double quotes.
True
False
The downcase method changes the whole string to smallcase letters.
True
False
What does the .upcase method do?
Convert the string to uppercase
Convert only lowercase string to uppercase and vice-versa
Convert the string to lowercase
None o the mentioned
The .length method is used to check number of characters.
True
False