Certified Associate in Python Programming (PCAP-31-03) — Question 23

Which of the following statements are true? (Choose two.)

Answer options

Correct answer: A, C

Explanation

Option A is correct because if the open() function cannot successfully open a file, it will raise an exception indicating the failure. Option C is also correct as open() typically requires a second argument for the mode in which the file is opened. Options B and D are incorrect; B is misleading as the correct names are stdin, stdout, and stderr, and D is not precise since open() returns a file object, not an object representing a physical file.