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 is the output of the given code? "Ruby Language".length = begin calculate length = end

  1. A. 13
  2. B. 12
  3. C. Error
  4. D. None of the mentioned
Report Error

Ruby can be used for developing internet and intranet applications.

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

first_name,Last_name=gets.chomp,gets.chomp is the correct way to get the input from the user.

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

Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.

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

Which of the following is supported by Ruby?

  1. A. Multiple Programming Paradigms
  2. B. Dynamic Type System
  3. C. Automatic Memory Management
  4. D. All of the Mentioned
Report Error

This the right way to comment a single line. “Ruby”.length # I’m a single line comment!

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

What is the output of the given code? Ans=Ruby puts "#{Ans} is an oop language" puts "It is very efficient langauge" puts "#{expr} is used on rails platform"

  1. A. Error, no output
  2. B. Ruby is an oop language It is very efficient langauge undefined local variable
  3. C. Ruby is an oop language It is very efficient langauge #{expr} is used on rails platform
  4. D. None of the mentioned
Report Error

What is the size of an integer data type in ruby?

  1. A. -2 30 to 2 30
  2. B. -2 30 to 2 (30-1)
  3. C. -2 29 to 2 30
  4. D. -2 60 to 2 61
Report Error

The .length method is used to check number of characters.

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

Which of the following is the valid string method?

  1. A. The .length method
  2. B. The .upcase method
  3. C. The .downcase method
  4. D. The .irreverse method
Report Error

Which of the following features does the 2.0 version of ruby supports?

  1. A. Method keyword arguments
  2. B. New literals
  3. C. Security fixes
  4. D. All of the mentioned
Report Error

The following syntax is used for multiline comment. =begin iam in a multi line comment =end

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