Bird
0
0

You typed this in IRB:

medium📝 Debug Q14 of 15
Ruby - Basics and Runtime
You typed this in IRB:
puts 'Hello

What is the error and how do you fix it?
ASyntaxError due to missing closing quote; add a closing '
BNameError because 'Hello' is undefined; define it first
CNo error; it prints Hello
DRuntimeError because puts is not allowed in IRB
Step-by-Step Solution
Solution:
  1. Step 1: Identify the syntax problem

    The string started with a single quote but has no closing quote, causing a SyntaxError.
  2. Step 2: Fix the error by adding the missing quote

    Adding the closing single quote after Hello fixes the syntax and allows the code to run.
  3. Final Answer:

    SyntaxError due to missing closing quote; add a closing ' -> Option A
  4. Quick Check:

    Strings need matching quotes [OK]
Quick Trick: Check for matching quotes in strings [OK]
Common Mistakes:
  • Ignoring missing quote errors
  • Thinking puts can't be used in IRB
  • Confusing SyntaxError with NameError

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes