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

From 616 to 630 of 820

Q. fo.close()

a. compilation error

b. runtime error

c. no output

d. flushes the file when closing them

  • d. flushes the file when closing them

Q. Correct syntax of file.writelines() is?

a. file.writelines(sequence)

b. fileobject.writelines()

c. fileobject.writelines(sequence)

d. none of the mentioned

  • c. fileobject.writelines(sequence)

Q. Correct syntax of file.readlines() is?

a. fileobject.readlines( sizehint );

b. fileobject.readlines();

c. fileobject.readlines(sequence)

d. none of the mentioned

  • a. fileobject.readlines( sizehint );

Q. In file handling, what does this terms means “r, a”?

a. read, append

b. append, read

c. write, append

d. none of the mentioned

  • a. read, append

Q. What is the use of “w” in file handling?

a. read

b. write

c. append

d. none of the mentioned

  • b. write

Q. What is the use of “a” in file handling?

a. read

b. write

c. append

d. none of the mentioned

  • c. append

Q. Which function is used to read all the characters?

a. read()

b. readcharacters()

c. readall()

d. readchar()

  • a. read()

Q. Which function is used to read single line from file?

a. readline()

b. readlines()

c. readstatement()

d. readfullline()

  • b. readlines()

Q. Which function is used to write all the characters?

a. write()

b. writecharacters()

c. writeall()

d. writechar()

  • a. write()

Q. Which function is used to write a list of string in a file?

a. writeline()

b. writelines()

c. writestatement()

d. writefullline()

  • a. writeline()

Q. Is it possible to create a text file in python?

a. yes

b. no

c. machine dependent

d. all of the mentioned

  • a. yes

Q. What is the difference between r+ and w+ modes?

a. no difference

b. in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+

c. in w+ the pointer is initially placed at the beginning of the file and the pointer is at the end for r+

d. depends on the operating system

  • b. in r+ the pointer is initially placed at the beginning of the file and the pointer is at the end for w+

Q. How do you get the name of a file from a file object (fp)?

a. fp.name

b. fp.file(name)

c. self.    name    (fp)

d. fp.    name    ()

  • a. fp.name
Subscribe Now

Get All Updates & News