Ruby Basic MCQ
11. On which platform ruby runs on ?
A. Windows
B. Mac OS
C. Unix
D. All of the above
View Answer
Ans : D
Explanation: Ruby runs on a variety of platforms, such as Windows, Mac OS, and the various versions of UNIX.
12. Ruby was written in?
A. C
B. C++
C. Java
D. Objective C
View Answer
Ans : A
Explanation: Ruby was written in C language.
13. Which will be output for the followinf code?
puts "Hello, Ruby!";
A. Hello, Ruby
B. Hello Ruby!
C. Hello, Ruby!
D. Hello Ruby
View Answer
Ans : C
Explanation: This will produce the following result : Hello, Ruby!
14. Which of the following is not a Reserved Words in Ruby?
A. begin
B. ensure
C. retry
D. pass
View Answer
Ans : D
Explanation: pass is not a Reserved Words in Ruby.
15. Which statement is used to declares code to be called before the program is run?
A. Start
B. Begin
C. Here
D. End
View Answer
Ans : B
Explanation: Begin is used to declares code to be called before the program is run.
16. Block comment conceals several lines from the interpreter with?
A. =begin and =end
B. =start and =end
C. =here and =end
D. =begin and =ending
View Answer
Ans : A
Explanation: This block comment conceals several lines from the interpreter with =begin/=end.
17. Which of the following is a Reserved Words in Ruby?
A. do
B. or
C. in
D. All of the above
View Answer
Ans : D
Explanation: All of the above is a Reserved Words in Ruby.
18. Which of the following features does the 2.0 version of ruby supports?
A. New literals
B. Security fixes
C. Method keyword arguments
D. All of the above
View Answer
Ans : D
Explanation: Ruby2.0 has several new added features and it is much stable than its older versions.
19. What is the extension used for saving the ruby file?
A. .rb extension
B. .ruby extension
C. .rrb extension
D. .rbb extension
View Answer
Ans : A
Explanation: Ruby files must be saved with the extension .rb.
20. Ruby 2.7.1 version release date?
A. 31-03-2019
B. 31-01-2020
C. 31-03-2020
D. 31-04-2019
View Answer
Ans : C
Explanation: Ruby 2.7.1 version release date 31-03-2020.
Discussion