CommerceBasic 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
- A. 13
- B. 12
- C. Error
- D. None of the mentioned
Correct Answer: C
Ruby can be used for developing internet and intranet applications.
- A. True
- B. False
Correct Answer: A
first_name,Last_name=gets.chomp,gets.chomp is the correct way to get the input from the user.
- A. True
- B. False
Correct Answer: A
Space between 2+5 or 2 + 5 is valid but =begin and = begin is not valid.
- A. True
- B. False
Correct Answer: A
Which of the following is supported by Ruby?
- A. Multiple Programming Paradigms
- B. Dynamic Type System
- C. Automatic Memory Management
- D. All of the Mentioned
Correct Answer: D
This the right way to comment a single line. “Ruby”.length # I’m a single line comment!
- A. True
- B. False
Correct Answer: A
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"
- A. Error, no output
- B. Ruby is an oop language It is very efficient langauge undefined local variable
- C. Ruby is an oop language It is very efficient langauge #{expr} is used on rails platform
- D. None of the mentioned
Correct Answer: B
What is the size of an integer data type in ruby?
- A. -2 30 to 2 30
- B. -2 30 to 2 (30-1)
- C. -2 29 to 2 30
- D. -2 60 to 2 61
Correct Answer: B
The .length method is used to check number of characters.
- A. True
- B. False
Correct Answer: B
Which of the following is the valid string method?
- A. The .length method
- B. The .upcase method
- C. The .downcase method
- D. The .irreverse method
Correct Answer: D
Which of the following features does the 2.0 version of ruby supports?
- A. Method keyword arguments
- B. New literals
- C. Security fixes
- D. All of the mentioned
Correct Answer: D
The following syntax is used for multiline comment. =begin iam in a multi line comment =end
- A. True
- B. False
Correct Answer: A