Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to run a Ruby script named 'hello.rb' from the command line.
Ruby
ruby [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a filename with the wrong extension like '.py' or '.js'.
Forgetting to include the script filename after 'ruby'.
✗ Incorrect
To run a Ruby script, use the 'ruby' command followed by the script filename, like 'ruby hello.rb'.
2fill in blank
mediumComplete the command to run a Ruby script called 'calculator.rb' located in the current directory.
Ruby
ruby [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to run a non-Ruby file.
Typing the wrong filename.
✗ Incorrect
You run the Ruby script by typing 'ruby' followed by the script's filename, here 'calculator.rb'.
3fill in blank
hardFix the error in the command to run 'test_script.rb' by completing the missing part.
Ruby
ruby [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a filename with a wrong extension.
Typing a filename that does not exist.
✗ Incorrect
The Ruby interpreter requires the script filename with the '.rb' extension to run it correctly.
4fill in blank
hardFill both blanks to run a Ruby script named 'server.rb' located in a folder called 'app'.
Ruby
ruby [1]/[2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping folder and filename positions.
Using the wrong folder or filename.
✗ Incorrect
To run a script in a folder, use 'ruby foldername/filename.rb', here 'ruby app/server.rb'.
5fill in blank
hardFill both blanks to run a Ruby script named 'app.rb' inside the 'src' folder with verbose mode enabled.
Ruby
ruby [1] [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the script path before the flag.
Using incorrect flags like '-v' or '-h'.
✗ Incorrect
To run a script with verbose mode, use 'ruby --verbose src/app.rb'.