Bird
0
0

Which of the following is the correct way to run a Ruby script named hello.rb from the terminal?

easy📝 Syntax Q12 of 15
Ruby - Basics and Runtime
Which of the following is the correct way to run a Ruby script named hello.rb from the terminal?
Arun hello.rb
Bstart ruby hello.rb
Cexecute hello.rb
Druby hello.rb
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct command syntax

    The correct syntax to run a Ruby script is ruby filename.rb.
  2. Step 2: Check each option

    Only ruby hello.rb matches the correct syntax.
  3. Final Answer:

    ruby hello.rb -> Option D
  4. Quick Check:

    Use ruby + filename.rb to run scripts [OK]
Quick Trick: Use 'ruby filename.rb' to run scripts in terminal [OK]
Common Mistakes:
  • Using 'run' or 'execute' commands which don't exist
  • Adding extra words like 'start' before ruby
  • Forgetting to include the .rb extension

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes