Explanation: Hashes in Ruby are created using curly braces with key-value pairs.
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: Hashes in Ruby are created using curly braces with key-value pairs.
Explanation: 'times' iterates from 0 up to one less than the number.
Explanation: The 'to_i' method converts a string to an integer in Ruby.
Explanation: The '+' operator concatenates strings in Ruby.
Explanation: Ruby uses 'if condition then ... else ... end' syntax.
Explanation: Symbols start with a colon ':' in Ruby.
Explanation: 'attr_accessor' creates both getter and setter methods for instance variables.
Explanation: Ruby uses 'begin ... rescue ... end' for exception handling.
Explanation: 'self' refers to the current object instance.
Explanation: 'push' method adds an element to the end of an array.