Bird
0
0

What does the Ruby method Dir.pwd return?

easy📝 Conceptual Q2 of 15
Ruby - File IO
What does the Ruby method Dir.pwd return?
AThe current working directory path
BThe parent directory path
CThe root directory path
DThe home directory path
Step-by-Step Solution
Solution:
  1. Step 1: Understand Dir.pwd purpose

    Dir.pwd returns the path of the current working directory where the Ruby script runs. It does not return parent, root, or home directory paths.
  2. Final Answer:

    The current working directory path -> Option A
  3. Quick Check:

    Dir.pwd = current directory path [OK]
Quick Trick: Dir.pwd always shows where your script runs [OK]
Common Mistakes:
  • Confusing with Dir.home
  • Assuming it returns root directory
  • Thinking it returns parent directory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes