Bird
0
0

What happens if you run ruby without any filename in the terminal?

easy📝 Conceptual Q2 of 15
Ruby - Basics and Runtime
What happens if you run ruby without any filename in the terminal?
AIt runs the last executed script
BIt opens an interactive Ruby shell (IRB)
CIt shows an error about missing file
DIt lists all Ruby scripts in the folder
Step-by-Step Solution
Solution:
  1. Step 1: Check behavior of 'ruby' command without arguments

    Running ruby alone without a filename opens the interactive Ruby shell (IRB).
  2. Step 2: Identify the behavior

    Ruby starts an interactive session where you can type Ruby code directly.
  3. Final Answer:

    It opens an interactive Ruby shell (IRB) -> Option B
  4. Quick Check:

    ruby without file opens IRB [OK]
Quick Trick: Running 'ruby' alone opens IRB (interactive shell) [OK]
Common Mistakes:
MISTAKES
  • Assuming it shows an error
  • Assuming it runs last script
  • Assuming it lists files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes