11. What is the output of given code?
puts "what is your first name?"
name=gets.chomp
puts "what is your surname?"
surname=gets.chomp
puts "what is your first name?"
name=gets.chomp
puts "what is your surname?"
surname=gets.chomp12. We use semicolon or parentheses after every print or puts statement.
13. What will we the output of the given code?
"I'am Learning RUBY Language".downcase
"I'am Learning RUBY Language".downcase14. What is the output of the given code?
"Ruby Language".length
=begin
calculate length
=end
"Ruby Language".length
=begin
calculate length
=end15. The .upcase and .capitalize method are used for capitalizing the whole string.
16. The downcase method changes the whole string to smallcase letters.
17. Which sequence can be used to substitute the value of any ruby expression in a string?
18. What does %x!ls! represents?
19. Which of the following datatypes are valid in Ruby?
20. Methods should not be written inside double quotes.
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.
