Explanation: The first method returns the first element of an array.
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
Explanation: The first method returns the first element of an array.
Explanation: The raise keyword is used to throw an exception.
Explanation: The break keyword terminates a loop.
Explanation: The upcase method converts a string to uppercase.
Explanation: Constants begin with an uppercase letter in Ruby.
Explanation: Calling nil? on nil returns true.
Explanation: The include? method returns true if the element exists in the array.
Explanation: The each method iterates over each element in a collection.
Explanation: Ruby supports both new and old syntax for symbol keys.
Explanation: Integer division truncates decimal part in Ruby.