GIAC Python Coder (GPYC) — Question 22
If the variable `example` contains a handle to a subprocess object, which of the following would show all of the possible results of running the subprocess?
Answer options
- A. example.stdout.read()
- B. example.recv(*)
- C. example.read()
- D. example.stdout.read()+example.stderr.read()
Correct answer: C
Explanation
The correct answer is C, as the method example.read() will capture all output from the subprocess. Option A only retrieves standard output, while option B is not applicable for this context, and option D would only concatenate outputs from stdout and stderr, potentially missing some outputs.