Top 1000+ Solved Problem Solving and Python Programming MCQ Questions Answer

From 601 to 615 of 820

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()

  • d. infile.readlines()

Q. print(f.closed)

a. true

b. false

c. none

d. error

  • a. true

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

  • a. raw_input & input

Q. Which one of the following is not attributes of file?

a. closed

b. softspace

c. rename

d. mode

  • c. rename

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

  • a. tells you the current position within the file

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

  • a. rename(current_file_name, new_file_name)

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

  • a. remove(file_name)

Q. fo.close()

a. compilation error

b. syntax error

c. displays output

d. none of the mentioned

  • c. displays output

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

  • a. sets the file’s current position at the offset

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

  • a. truncates the file size

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

  • 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

  • a. it is used for object serialization

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

  • b. it is used for object deserialization

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

  • b. file object = open(file_name [, access_mode][, buffering])
Subscribe Now

Get All Updates & News