File Handling
Ques1) Write a statement in python to perform the following question
a) To open a text file “BOOK.TXT” in read mode
b) To open a text file “BOOK.TXT” in write mode
Ques 2) Differentiate between file modes r+ & w+ in python
Ques 3) Differentiate between file mode r+ & rb+ in python
Ques 4) Write a statement in python to open a text file STORY.txt so that new content can be
added at the end of the file
Ques 5) Write a statement in python to open a text file CONTENT.txt so that content can be
writtern in to it
Ques 6) Write a python statement to open a text file REMARKS.txt such that content can be read
from it
Ques 7) Nancy intends to position the file pointer to the beginning of a text file. Write a python
statement for the same assuming F is the file object
Ques 8)
Ques 9)
Ques 10)
Ques 11)
Ques 12)
Ques 13)
Ques 14)
Ques 15)
Ques 16)
Ques 17)
Ques 18)
Ques 19)
Ques 20)
Ques 21)
Ques 22)
Ques 23)
Ques 24)
Ques 25)
Ques 26)
Ques 27)
Ques 28)
Ques 29)
Ques 30)
Ques 31)
Ques 32)
Ques 33)
Ques 34)
Ques 35)
Ques 36)
Ques 37)
Ques 38)
Ques 39)
Ques 40)
Ques 41)
Ques 42)
Ques 43)
Ques 44)
Ques 45)
Ques 46) Which of the following mode in file opening statement results or generates an error if
the file does not exist?
(a) a+ (b) r+ (c) w+ (d) None of the above
Ques 47) 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)
Ques 48)
Ques 49)
Ques 50)
Ques 51)
Ques 52)
Ques 53)
Ques 54)
Ques 55)
Ques 56)
Ques 57)
Ques 58)