File Handling Quiz-9

Share with others

Welcome to your File Handling Quiz-9

Name
Email
School Name
Q81. Ravi opened the file "myfile.txt" by using the following syntax. His friend told him few advantages of the given syntax. Help him to identify the correct advantage.

with open ("myfile.txt", "a") as file_object:

Q82. Ravi wants to open the file to add some more content in the already existing file. Suggest him the suitable mode to open the file.

Q83. Ravi jotted down few features of the "write mode". Help him to identify the valid features.

Q84. Ravi jotted down few features of the "append mode". Help him to identify the valid features.

Q85. Which of the following methods can be used to write data in the file?

Q86. Write the output of the following:

>>> f = open("test.txt","w")
>>> f.write("File\n#Handling")

Q87. Which of the following error is returned by the given code:

>>> f = open("test.txt","w")
>>> f.write(345)

Q88. Which of the following method is used to clear the buffer?

Q89. Which of the following method does not return the number of characters written in the file.

Q90. Fill in the blank in the given code:

>>> fo = open("myfile.txt",'w')
>>> lines = ["Hello \n", "Writing strings\n", "third line"]
>>> fo._____________(lines)
>>>myobject.close()


Share with others

Leave a Reply