Ruby on Rails MCQ Questions and Answers Quiz

11. What is the output of the following? "I am learning ruby language".length

  1. 27
  2. 23
  3. 26
  4. 18

12. What will be the output of the following? "Ruby".reverse.upcase

  1. RUBY
  2. ybuR
  3. YBUR
  4. YBUr

13. What is the use of .capitalize method?

  1. It capitalizes the entire string
  2. It capitalize on the first letter of the string
  3. It capitalize the strings which are in small case
  4. none of the mentioned

14. What does %{Learn ruby language} represents?

  1. "Learn Ruby language"
  2. "%{Learn Ruby language}"
  3. " Learn Ruby language "
  4. none of these

15. What does %Q{ Learn ruby language } represents?

  1. " Learn Ruby language "
  2. "%{ Learn Ruby language }"
  3. " Learn Ruby language "
  4. none of the mentioned

16. How to comment a single line in Ruby on Rails?

  1. Using #
  2. Using begin and end
  3. Using //
  4. none of the mentioned

17. What is the output of the given code? "Ruby".length #to find the length of given string

  1. 4 to find the length of given string
  2. 4
  3. To find the length of given string
  4. Ruby

18. Which of the following is a valid conditional statement in Ruby?

  1. else
  2. els
  3. if else
  4. none of the mentioned

19. Which of the following is a valid conditional statement in Ruby?

  1. elseif
  2. elsif
  3. else if
  4. elseiff
Tags

MCQ Multiple Choice Questions and Answers on Ruby on Rails

Ruby on Rails Question and Answer