Practice Quiz: Python Subprocesses

6. What type of object does a run function return?

  • returncode
  • capture_output
  • stdout
  • CompletedProcess

7. How can you change the current working directory where a command will be executed?

  • Use the capture_output parameter.
  • Use the cwd parameter.
  • Use the shell parameter.
  • Use the env parameter.

8. When a child process is run using the subprocess module, which of the following are true? (check all that apply)

  • The child process is run in a secondary environment.
  • The parent process is blocked while the child process finishes.
  • The parent process and child process both run simultaneously.
  • Control is returned to the parent process when the child process ends.

9. When using the run command of the subprocess module, what parameter, when set to True, allows us to store the output of a system command?

  • cwd
  • capture_output
  • timeout
  • shell

10. What does the copy method of os.environ do?

  • Creates a new dictionary of environment variables
  • Runs a second instance of an environment
  • Joins two strings
  • Removes a file from a directory

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply