Home / Programming MCQs / Ruby MCQs / Question
V
Q. What will be the output of the given code?
counter = true while counter !=false puts counter end
Counter value is true in all cases hence true will be printed infinite times.
You must be Logged in to update hint/solution
What is the syntax for defining a method in Ruby?
What is the purpose of the attr_accessor method in Ruby classes?
Which tool is commonly used for code formatting in Ruby projects?
What is the purpose of the attr_reader method in Ruby classes?
Which keyword is used to define a class in Ruby?
What is true about while loop?
What does the \b anchor represent in a regular expression in Ruby?
What does the term "duck typing" refer to in Ruby?
What is the purpose of the splat operator (*) in Ruby method definitions?
Discusssion
Login to discuss.