Bird
0
0

What will be the output of this IRB command?

medium📝 Predict Output Q4 of 15
Ruby - Basics and Runtime
What will be the output of this IRB command?
"hello".upcase
AHELLO
B"hello"
C"HELLO"
Derror
Step-by-Step Solution
Solution:
  1. Step 1: Understand the upcase method on a string

    The upcase method converts all letters in the string to uppercase.
  2. Step 2: Apply upcase to "hello"

    "hello".upcase returns "HELLO" as a string with uppercase letters.
  3. Final Answer:

    "HELLO" -> Option C
  4. Quick Check:

    "hello".upcase = "HELLO" [OK]
Quick Trick: upcase makes all letters uppercase in a string [OK]
Common Mistakes:
MISTAKES
  • Expecting output without quotes
  • Thinking upcase changes original string
  • Assuming it returns an error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes