Ruby - Basics and RuntimeWhich of the following is true about numbers in Ruby?ANumbers are primitive types, not objectsBNumbers are stored as strings internallyCNumbers cannot have methods called on themDNumbers are objects and have methodsCheck Answer
Step-by-Step SolutionSolution:Step 1: Recall Ruby's treatment of numbersIn Ruby, numbers like integers and floats are objects, so they have methods you can call on them.Step 2: Evaluate the optionsNumbers are objects and have methods correctly states that numbers are objects and have methods, which is true in Ruby.Final Answer:Numbers are objects and have methods -> Option DQuick Check:Numbers in Ruby = Objects with methods [OK]Quick Trick: Numbers in Ruby behave like objects with methods [OK]Common Mistakes:Assuming numbers are primitive and lack methodsThinking numbers are stored as stringsBelieving numbers cannot respond to methods
Master "Basics and Runtime" in Ruby9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Ruby Quizzes Arrays - Array creation methods - Quiz 7medium Control Flow - Case/when statement - Quiz 8hard Loops and Iteration - Break, next, and redo behavior - Quiz 6medium Methods - Why methods always return a value in Ruby - Quiz 13medium Methods - Implicit return (last expression) - Quiz 12easy Operators and Expressions - Truthy and falsy values (only nil and false are falsy) - Quiz 13medium Ruby Basics and Runtime - Why Ruby emphasizes developer happiness - Quiz 13medium Ruby Basics and Runtime - Running scripts with ruby command - Quiz 8hard String Operations - Split and join methods - Quiz 14medium String Operations - Heredoc syntax for multiline strings - Quiz 7medium