Bird
0
0

Which method is used in Ruby to wait for a child process to finish after a fork?

easy📝 Conceptual Q2 of 15
Ruby - Concurrent Programming
Which method is used in Ruby to wait for a child process to finish after a fork?
AProcess.sleep
BProcess.exit
CProcess.wait
DProcess.run
Step-by-Step Solution
Solution:
  1. Step 1: Identify method to wait for child process

    Ruby provides Process.wait to pause the parent until a child process ends.
  2. Step 2: Confirm other options are unrelated

    Process.sleep pauses current process, Process.exit terminates, Process.run is invalid.
  3. Final Answer:

    Process.wait -> Option C
  4. Quick Check:

    Wait for child = Process.wait [OK]
Quick Trick: Use Process.wait to pause parent until child ends [OK]
Common Mistakes:
  • Using Process.sleep to wait for child
  • Confusing Process.exit with waiting
  • Assuming Process.run exists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes