Home / Programming Questions / Ruby MCQs / Page 8

Ruby MCQs with answers Page - 8

Dear candidates you will find MCQ questions of Ruby here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question

Q. What will be the output of the given code?

Code:
boolean_var = !(100 / 10 === 10)
puts boolean_var
(A) TRUE
(B) FALSE
(C) Type Error
(D) Syntax Error

Q. What will be the output of the given code?

Code:
boolean_var = !true || (true || 36 != 6**2)
puts boolean_var
(A) TRUE
(B) FALSE
(C) Error
(D) None of the above

Q. What will the following expression evaluate to?

Code:
true || false
(A) TRUE
(B) FALSE
(C) Syntax Error
(D) None of the above

Q. What will the following expression evaluate to?

Code:
!true && !false
(A) TRUE
(B) FALSE
(C) Syntax Error
(D) None of the above

Q. Which of the following is not a type of loop in ruby?

(A) For Loop
(B) Foreach Loop
(C) Until Loop
(D) While Loop

Q. What is true about Until loop?

(A) Executes code while conditional is true
(B) In until loop increment is not required
(C) Executes code while conditional is false
(D) None of the above

Q. What is true about while loop?

(A) Executes code while conditional is true
(B) In while loop increment is not required
(C) Executes code while conditional is false
(D) None of the above

Q. What is the use of break statement?

(A) Terminates the most External loop.
(B) Terminates all loop.
(C) Terminates the program.
(D) Terminates the most internal loop.

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.