Bird
0
0

What does the Ruby method upcase do to a string?

easy📝 Conceptual Q11 of 15
Ruby - String Operations
What does the Ruby method upcase do to a string?
AConverts all letters in the string to lowercase
BConverts all letters in the string to uppercase
CRemoves spaces from the start and end of the string
DReverses the string
Step-by-Step Solution
Solution:
  1. Step 1: Understand the method name

    The method upcase suggests making letters uppercase.
  2. Step 2: Recall the method effect on strings

    upcase changes all letters to uppercase, not lowercase or trimming spaces.
  3. Final Answer:

    Converts all letters in the string to uppercase -> Option B
  4. Quick Check:

    upcase = uppercase letters [OK]
Quick Trick: Remember: upcase = uppercase letters [OK]
Common Mistakes:
  • Confusing upcase with downcase
  • Thinking upcase removes spaces
  • Assuming upcase reverses the string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes