1. Which of the following are valid floating point literal?
2. What is the role of ! at the end of the capitalize method?
3. What will be the output of the given code?
"I'am learning Ruby Language".length.reverse.upcase
"I'am learning Ruby Language".length.reverse.upcase
4. What is the range of octal notation (\nnn)?
5. Which of the following type of comments are valid in ruby?
6. Why do we use =begin and =end?
7. What is the output of the given code?
x, y, z = 12, 36, 72
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 }."
x, y, z = 12, 36, 72
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 }."
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}"
print "What's your first name?"
first_name=gets.chomp
a=first_name.capitalize
a=a.reverse
puts"My name is #{a}"
9. What is the output of the given code?
Ans=Ruby
puts "#[Ans] is an oop language"
Ans=Ruby
puts "#[Ans] is an oop language"
10. Objects of which class does the integer from the range -2^30 to 2^(30-1) belong to?
Read More Section(Basic Syntax in Ruby)
Each Section contains maximum 100 MCQs question on Basic Syntax in Ruby. To get more questions visit other sections.