WorksheetsFile Handling in Python Quiz
Total questions: 10
Worksheet time: 5mins
What is the need for data files in Python?
To store data in RAM
To permanently store data for future use
To erase data when the program is over
To handle small amount of data
Which type of file stores data in binary format?
JSON file
CSV file
Text file
Binary file
What is the file extension for CSV files?
.data
.txt
.csv
.bin
Which method is used to open a file in Python?
append()
write()
read()
open()
What is the default mode when opening a file in Python?
Binary
Append
Write
Read
Which method is used to write a sequence of strings to a file in Python?
readlines()
read()
writelines()
write()
What is the method used to read a specific number of bytes from a file in Python?
read(n)
readlines()
readline()
readall()
What is the standard input stream in Python?
stdout
input()
stdin
stderr
How can standard output be redirected to a file in Python?
Reassigning sys.stdout
sys.stdout.writelines()
print('data', file=fileobject)
sys.stdout.write()
What is the method used to reassign the standard input stream in Python?
sys.stdin.write()
Reassigning sys.stdin
input()
sys.stdin.readline()
