1) Which method is used to read file line by line a) read() b) readlines() c) readline() d) line() 2) Select the correct method to write a list of lines to a file a) write(list) b) writelines(list) c) writelist(list) 3) Select all true statements when a file is opened using the with statement a) The with statement simplifies exception handling b) The file is automatically closed after leaving the block, and all the resources that are tied up with the file are released. c) File reading and writing are faster using the with statement. 4) Select the correct mode to open a file for appending as well as reading a) a+ b) ar c) rw d) ar+ 5) Select the correct output of the following code :fp.seek(5, 1) a) Move file pointer five characters ahead from the current position. b) Move file pointer five characters ahead from the beginning of a file. c) Move file pointer five characters behind from the current position. d) Move file pointer five characters behind ahead from the end of a file.

Papan mata

Gaya visual

Pilihan

Tukar templat

Pulihkan autosimpan: ?