Ruby Operator MCQ

11. Which operator is used to find exponent in ruby?

A. *
B. **
C. ^
D. %

View Answer


12. equal? Operator is used for?

A. Used to test equality within a when clause of a case statement.
B. if the receiver and argument have both the same type and equal values.
C. if the receiver and argument have the same object id.
D. All of the above

View Answer


13. Guess the operator : If Condition is true ? Then value X : Otherwise value Y?

A. Range Operators
B. Ternary Operator
C. Parallel Operator
D. Arithmetic operator

View Answer


14. Which operator is used to check variable and method are defined or not?

A. define
B. define?
C. defined?
D. defined

View Answer


15. Among the following which operator has lowest Precedence?

A. .
B. ^
C. ...
D. >>

View Answer


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

num=4<<2
puts num

A. 4
B. 8
C. 16
D. 32

View Answer


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

num=(10<11)||(11===11)? (11===11.0): 0
puts num

A. TRUE
B. FALSE
C. 1
D. 0

View Answer


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

boolean_var = false || -20 > -18
puts boolean_var

A. TRUE
B. FALSE
C. Type Error
D. Syntax Error

View Answer


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

boolean_var = !true || (true || 36 != 6**2)
puts boolean_var

A. TRUE
B. FALSE
C. Error
D. None of the above

View Answer


20. What will the following expression evaluate to?

!true && !false

A. TRUE
B. FALSE
C. Syntax Error
D. None of the above

View Answer





Discussion


* You must be logged in to add comment.