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

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

Answer options

Correct answer: C, D

Explanation

The correct answer is C and D because the second argument in the open() function is indeed optional, allowing for default behavior if not specified. Additionally, instd, outstd, and errstd are predefined streams in Python that facilitate standard input, output, and error handling, respectively. Options A and B are incorrect as they misrepresent the behavior of open() in Python; it does not return None on failure but raises an IOError, and it does not return an int but rather a file object.