Home / Programming Questions / Ruby MCQs / Page 7

Ruby MCQs with answers Page - 7

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

V

Vinay Kumar • 8.45K Points
Tutor III

Q. Among the following which operator has highest Precedence?

(A) ::
(B) .
(C) []
(D) **

V

Vinay Kumar • 8.45K Points
Tutor III

Q. Among the following which operator has lowest Precedence?

(A) .
(B) ...
(C) >>
(D) ^

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
boolean_var = 15 < 16 && 15 < 15
puts boolean_var
(A) TRUE
(B) FALSE
(C) Type Error
(D) Syntax Error

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
num=4<<2
puts num
(A) 4
(B) 8
(C) 16
(D) 32

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
num=4>>2
puts num
(A) -2
(B) 0
(C) 2
(D) 1

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
num=(10<11)||(11===11)? (11===11.0): 0
puts num
(A) TRUE
(B) FALSE
(C) 1
(D) 0

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
boolean_var = 3**2 != 2**3 || true
puts boolean_var
(A) TRUE
(B) FALSE
(C) 1
(D) 0

V

Vinay Kumar • 8.45K Points
Tutor III

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

Code:
boolean_var = false || -20 > -18
puts boolean_var
(A) TRUE
(B) FALSE
(C) Type Error
(D) Syntax Error

Login

Forgot username? click here

Forgot password? Click here

Don't have account? Register here.