QuizzesProcess Creation: fork, exec, wait — Concept Check
intermediate
operating-systems

Process Creation: fork, exec, wait — Concept Check

Questions on Process Creation: fork, exec, wait. Unix process creation uses fork() to duplicate the parent, exec() to replace the process image with a new program, and wait() for the parent to collect the child's exit status.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Process Creation: fork, exec, wait — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A developer notices that after executing a command in the shell, the command runs but the shell does not return to the prompt. What is likely happening?

    • AThe shell has become a zombie process.
    • BThe command is running in the background.
    • CThe shell is waiting for the child process to exit.
    • DThe shell has replaced itself with the command.
  2. 2.A Java application uses ProcessBuilder to run a script. The script completes, but the Java application hangs. What might be the cause?

    • AThe script is running in an infinite loop.
    • BThe Java application did not call waitFor().
    • CThe Java application replaced itself with the script.
    • DThe script created a zombie process.
  3. 3.A system administrator finds many zombie processes on a server. What is a likely cause?

    • AParent processes are not calling wait().
    • BThe system has run out of PIDs.
    • CChild processes are not terminating.
    • DProcesses are being orphaned.
  4. 4.In a Unix system, a process becomes an orphan. What happens next?

    • AThe system automatically reassigns a new parent.
    • BThe orphan process is terminated immediately.
    • CThe orphan process becomes a zombie.
    • Dinit adopts the orphan process.
  5. 5.A child process created by fork() calls exec(). What remains unchanged after exec()?

    • AThe process ID (PID) of the child process.
    • BThe environment variables of the child process.
    • CThe code and data of the child process.
    • DThe file descriptors of the child process.
  6. 6.A developer claims that using exec() in a child process will change its PID. What is the correct understanding?

    • Aexec() does not change the PID of the process.
    • Bexec() terminates the parent process.
    • Cexec() creates a new process with a new PID.
    • Dexec() changes the PID of the process.
  7. 7.What is the role of wait() in process management?

    • ATo immediately terminate a child process.
    • BTo block the parent until the child exits and collect its exit status.
    • CTo replace the calling process's code with a new program.
    • DTo create a new process with a unique PID.