题目
题目

Fal25_CS003C_74229 Ch. 7 Pre-Quiz (Remotely Proctored)

单项选择题

What happens when the following code segment executes if test.txt does not exist? infile = open("test.txt", "r")

选项
A.All attempts to read from the file return random values
B.The program raises an exception
C.All attempts to read from the file return an empty string
D.The file test.txt is created as a new empty file
查看解析

查看解析

标准答案
Please login to view
思路分析
Consider what happens when Python tries to open a file in read mode ("r") and the file does not exist. Option 1: 'All attempts to read from the file return random values.' This is inaccurate because there is no file to read from, and Pyt......Login to view full explanation

登录即可查看完整答案

我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!