Commerce

Basic Syntax In Ruby MCQs

Practice Basic Syntax In Ruby MCQs for competitive exams.

Basic Syntax In Ruby MCQs

Practice questions from this topic.

What will be the output of the following? "Eric".irreverse

  1. A. Eric
  2. B. cirE
  3. C. undefined method
  4. D. None of the mentioned
Report Error

For getting an input from the user which method is used?

  1. A. get
  2. B. gets.chomp
  3. C. get-s
  4. D. chomp
Report Error

Why can not we use quotation marks (' or ") with boolean?

  1. A. It indicates that we are talking about a string
  2. B. It indicates that we are assining a value
  3. C. It indicates that that we are replacing boolean data type with string data type
  4. D. None of the mentioned
Report Error

Why is gets not preferred instead of gets.chomp?

  1. A. Gets add an extra new line while chomp removes it
  2. B. Gets remove an extra new line
  3. C. Chomp erases the value stored in the variable
  4. D. All of the mentioned
Report Error

What does the .upcase method do?

  1. A. Convert the string to uppercase
  2. B. Convert only lowercase string to uppercase and vice-versa
  3. C. Convert the string to lowercase
  4. D. None o the mentioned
Report Error

Which of the following languages syntax matches with the Ruby's syntax?

  1. A. Perl
  2. B. PHP
  3. C. Java
  4. D. Jquery
Report Error

What is the sequence of ruby strings?

  1. A. 16-bit bytes
  2. B. 8-bit bytes
  3. C. 10-bit bytes
  4. D. None of the mentioned
Report Error

What is the extension used for saving the ruby file?

  1. A. .ruby extension
  2. B. .rb extension
  3. C. .rrb extension
  4. D. None of the mentioned
Report Error

The following is the correct way to use multiline comment. = begin # comment = end

  1. A. True
  2. B. False
Report Error

What does the notataion b stands for?

  1. A. Escape
  2. B. Space
  3. C. Backspace
  4. D. Newline
Report Error

What will any variable evaluate to if it is of Boolean data type?

  1. A. True
  2. B. Nil
  3. C. False
  4. D. Either True or False
Report Error

What does %{Learn ruby language} represents?

  1. A. "Learn Ruby language"
  2. B. "%{Learn Ruby language}"
  3. C. " Learn Ruby language "
  4. D. None of the mentioned
Report Error