1) What is the primary purpose of file handling in Python? a) To create new files b) To manipulate text data c) To organize folders d) To interact with external files and data 2) What is the purpose of the with statement (context manager) when working with files in Python? a) It defines a new function b) It is used for commenting code c) It ensures that the file is properly closed after use d) It allows you to write to a file 3) Which method is used to read a single line from a text file in Python? a) read() b) readlines() c) readline() d) readline(2) 4) What exception might occur when you attempt to open a file that doesn't exist in Python? a) FileNotFoundError b) ValueError c) PermissionError d) TypeError 5) the file object. What is the default value of reference_point? a) 0 b) 1 c) 2 d) 3 6) Which of the following statement is incorrect in the context of binary files? a) Information is stored in the same format as in memory b) No character translation takes place c) Every line ends with a new line character d) pickle module is used for reading and writing 7) of the following option can be used to read all the remaining lines? a) myfile.read() b) myfile.read(n) c) myfile.readline() d) myfile.readlines() 8) Which of the following character acts as default delimiter in a csv file? a) : b) ; c) , d) - 9) Which of the following functions changes the position of file pointer a) flush() b) tell() c) seek() d) offset() 10) The correct syntax of seek() is: a) file_object.seek(offset [, reference_point]) b) seek(offset [, reference_point]) c) seek(offset, file_object) d) seek.file_object(offset)
0%
File Handling in Python
共享
共享
共享
由
Dilumariya
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
随堂测验
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?