Data File Handling (MCQ TEST)
Data File Handling (MCQ TEST)
Data File Handling (MCQ TEST)
File handling
Data handling
Process handling
None
2.Which of the following file formats are allowed to store data through python
programming ?
Video files
Audio files
Text Files
Binary Files
3. To open a file in python language ................. function is used .
Begin()
Create()
Open()
File()
open
MyFile.txt
F
F=open()
5. To open a file Myfile.txt ,which is stored at d:\Myfolder, for WRITING , we
can use
F=open("d:\Myfolder\Myfile.txt","w")
F=open(file="d:\Myfolder\Myfile.txt","w")
F=open("d:\\Myfolder\Myfile.txt","w")
F=open("d:\\Myfolder\\Myfile.txt","w")
F=open(r"d:\Myfolder\Myfile.txt","w")
6. To open a file Myfile.txt ,which is stored at d:\Myfolder, for READING, we
can use
F=open("d:\Myfolder\Myfile.txt","r")
F=open("d:\\Myfolder\\Myfile.txt")
F=open("d:\\Myfolder\Myfile.txt","r")
F=open("d:\\Myfolder\\Myfile.txt","r")
F=open(r"d:\Myfolder\Myfile.txt","r")
7. To read all contents from file object FILE at once we may use
FILE.read(*)
FILE.readlines()
FILE.read()
FILE.readline()
8. To read 20 characters from file object FILE at once we may use
FILE.read(20)
FILE.readlines(20)
FILE.read(char=20)
FILE.readline(char=20)
9. readlines() will return ...................
list of characters
list of strings
list of lines
list of tuples
10. read() will return ...................
list
string
tuple
dictionary
append
append,read
read , append
error
12. Which of the following file mode will refer to the BINARY mode?
binary
b
bin
w
13. Which of the following file mode will refer to the writing and reading both
BINARY file?
wb
wb+
w+
w
14. Which of the following file mode is not a valid file mode?
rw
ab
w+
r+
ra
15. Which of the following function is used to write LIST OF STRINGS in a file?
write()
writeline()
writelines()
write(all)
16. Which of the following function is used to write GROUP OF CHARACTERS
in a file?
write()
writeChars()
writelines()
write(all)
17. If we do not specify file mode while opening a file, the file will open in
.............mode
read
write
append
will give an error
18. If we want to add more contents in an existing file, file must be opened
in............mode
binary
append
write
it is not possible
19. What is to be added as mode to open file in text mode?
text
t
t+
nothing to specify , by default it will open in text mode
NOTE:
1. Read the questions carefully.
2. Solve the questions in note book and send the scan copy in our group.