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 代碼
刪除
恢復自動保存:
?