Certified Associate in Python Programming (PCAP) — Question 4
Python's built in function named open () tries to open a file and returns:
Answer options
- A. an integer value identifying an opened file
- B. an error code (0 means success)
- C. a stream object
- D. always None
Correct answer: C
Explanation
The correct answer is C because the open() function returns a stream object that allows for reading or writing to the file. Options A and B are incorrect as open() does not return an identifier or an error code, and option D is wrong because the function does not return None when successful.