๐Ÿงช Ruby on Rails MCQ Quiz Hub

Ruby MCQ Questions

Choose a topic to test your knowledge and improve your Ruby on Rails skills

Ruby is ?





โœ… Correct Answer: 2

Ruby is designed by?





โœ… Correct Answer: 1

Ruby was created in?





โœ… Correct Answer: 2

Which of the following statement is not a feature of ruby?





โœ… Correct Answer: 4

When Whitespace characters such as spaces and tabs can not ignored in Ruby code?





โœ… Correct Answer: 1

Reserved word can not be used as?





โœ… Correct Answer: 3

Which character is used to give comment in ruby?





โœ… Correct Answer: 3

Global variables in ruby begin with?





โœ… Correct Answer: 3

Default value of global variable is?





โœ… Correct Answer: 2

Local variables in ruby begin with?





โœ… Correct Answer: 2

Which of the following Ruby Pseudo-Variables is used for The receiver object of the current method?





โœ… Correct Answer: 1

Which of the following Ruby Pseudo Variables is used to return current line number in the source file?





โœ… Correct Answer: 3

Which notation is used for Octal notation?





โœ… Correct Answer: 4

Which of the following datatypes are valid in Ruby?





โœ… Correct Answer: 4

What is the sequence of ruby strings?





โœ… Correct Answer: 2

single-quoted strings don`t allow ?





โœ… Correct Answer: 4

Objects of which class does the integer from the range -2^60 to 2^(60-1) belong to?





โœ… Correct Answer: 2

Instance variables in ruby begin with?





โœ… Correct Answer: 1

Class variables in ruby begin with?





โœ… Correct Answer: 3

Default value of class variables is?





โœ… Correct Answer: 4

Constants in ruby begin with ?





โœ… Correct Answer: 4

Which of the following Ruby Pseudo Variables is used to return the name of the current source file?





โœ… Correct Answer: 1

Why notation is used in Ruby?





โœ… Correct Answer: 3

Why can not we use quotation marks ("or") with boolean?





โœ… Correct Answer: 1

What is the output of the given code? my_string=Ruby puts(my_string)





โœ… Correct Answer: 3

Which type of number(0b1011 ) is ?





โœ… Correct Answer: 3

Which of the following is not type of operator in ruby?





โœ… Correct Answer: 3

eql? Operator is used for?





โœ… Correct Answer: 2

Which of the following is not a type of Bitwise Operators?





โœ… Correct Answer: 4

In range operator ... is used for ?





โœ… Correct Answer: 2

Among the following which operator has highest Precedence?





โœ… Correct Answer: 1

What will be the output of the given code? boolean_var = 15 < 16 && 15 < 15 puts boolean_var





โœ… Correct Answer: 2

What will be the output of the given code? num=4>>2 puts num





โœ… Correct Answer: 4

What will be the output of the given code? boolean_var = 3**2 != 2**3 || true puts boolean_var





โœ… Correct Answer: 1

What will be the output of the given code? boolean_var = !(100 / 10 === 10) puts boolean_var





โœ… Correct Answer: 2

What will the following expression evaluate to? true || false





โœ… Correct Answer: 1

Which operator is used to find exponent in ruby?





โœ… Correct Answer: 2

equal? Operator is used for?





โœ… Correct Answer: 3

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





โœ… Correct Answer: 2

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





โœ… Correct Answer: 3

Among the following which operator has lowest Precedence?





โœ… Correct Answer: 3

What will be the output of the given code? num=4<<2 puts num





โœ… Correct Answer: 3

What will be the output of the given code? num=(10<11)||(11===11)? (11===11.0): 0 puts num





โœ… Correct Answer: 2

What will be the output of the given code? boolean_var = false || -20 > -18 puts boolean_var





โœ… Correct Answer: 2

What will be the output of the given code? boolean_var = !true || (true || 36 != 6**2) puts boolean_var





โœ… Correct Answer: 1

What will the following expression evaluate to? !true && !false





โœ… Correct Answer: 2

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





โœ… Correct Answer: 2

What is true about while loop?





โœ… Correct Answer: 1

Which statement is used to Jumps to the next iteration of the most internal loop?





โœ… Correct Answer: 2

Which statement is used to restarts the invocation of the iterator call?





โœ… Correct Answer: 4

What does end represent?





โœ… Correct Answer: 1

What will be the output of the given code? for num in 1...5 puts num end





โœ… Correct Answer: 1

What will be the output of the given code? for num in 1...4 puts num*num end





โœ… Correct Answer: 2

What will be the output of the given code? for i in 1..5 && j in 5..10 puts i+j end





โœ… Correct Answer: 2

What will be the output of the given code? counter = true while counter !=false puts counter end





โœ… Correct Answer: 4

What will be the output of the given code? a=1 b=1 while a&&b puts a+b end





โœ… Correct Answer: 3

What is true about Until loop?





โœ… Correct Answer: 3

What is the use of break statement?





โœ… Correct Answer: 4

Which statement is used to Restarts this iteration of the most internal loop, without checking loop condition?





โœ… Correct Answer: 3

What does the 1..5 indicate?





โœ… Correct Answer: 3

Which of the following is Exit Controlled loop?





โœ… Correct Answer: 1

What will be the output of the given code? for i in 1...3 for j in 1..3 puts j end end





โœ… Correct Answer: 3

What will be the output of the given code? i=1 for i in 6..10 puts i**2 end





โœ… Correct Answer: 4

What will be the output of the given code? counter = 1 while counter < 5 puts counter counter = counter + 1 end





โœ… Correct Answer: 1

What will be the output of the given code? while a&&b puts a end





โœ… Correct Answer: 4

What will be the output of the given code? i = 4 while i > 0 do print i i -= 1 end





โœ… Correct Answer: 3