Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer
Q. To read the remaining lines of the file from a file object infile, we use
a. infile.read(2)
b. infile.read()
c. infile.readline()
d. infile.readlines()
Q. Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?
a. raw_input & input
b. input & scan
c. scan & scanner
d. scanner
Q. What is the use of tell() method in python?
a. tells you the current position within the file
b. tells you the end position within the file
c. tells you the file is opened or not
d. none of the mentioned
Q. What is the current syntax of rename() a file?
a. rename(current_file_name, new_file_name)
b. rename(new_file_name, current_file_name,)
c. rename(()(current_file_name, new_file_name))
d. none of the mentioned
Q. What is the current syntax of remove() a file?
a. remove(file_name)
b. remove(new_file_name, current_file_name,)
c. remove(() , file_name))
d. none of the mentioned
Q. What is the use of seek() method in files?
a. sets the file’s current position at the offset
b. sets the file’s previous position at the offset
c. sets the file’s current position within the file
d. none of the mentioned
Q. What is the use of truncate() method in file?
a. truncates the file size
b. deletes the content of the file
c. deletes the file size
d. none of the mentioned
Q. Which is/are the basic I/O connections in file?
a. standard input
b. standard output
c. standard errors
d. all of the mentioned
Q. What is the pickling?
a. it is used for object serialization
b. it is used for object deserialization
c. none of the mentioned
d. all of the mentioned
Q. What is unpickling?
a. it is used for object serialization
b. it is used for object deserialization
c. none of the mentioned
d. all of the mentioned
Q. What is the correct syntax of open() function?
a. file = open(file_name [, access_mode][, buffering])
b. file object = open(file_name [, access_mode][, buffering])
c. file object = open(file_name)
d. none of the mentioned