Vidyalelo
Python · all questions

Files Handling in Python
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

80

Questions

2/4

Page

Pick an option on a question to see the right answer and solution.

Correct syntax of file.writelines() is?

Select an option to see the answer and solution.

Which is/are the basic I/O connections in file?

Select an option to see the answer and solution.

What is the use of "a" in file handling?

Select an option to see the answer and solution.

Which are the two built-in functions to read a line of text from standard input, which by default comes from the keyboard?

Select an option to see the answer and solution.

How can you check the current position in a file in Python?

Select an option to see the answer and solution.

How can you check if a file exists in Python before opening it?

Select an option to see the answer and solution.

Which function is used to read single line from file?

Select an option to see the answer and solution.

Which of the following are the modes of both writing and reading in binary format in file?

Select an option to see the answer and solution.

To read the entire remaining contents of the file as a string from a file object infile, we use . . . . . . . .

Select an option to see the answer and solution.

Which function is used to read all the characters?

Select an option to see the answer and solution.

What is the current syntax of remove() a file?

Select an option to see the answer and solution.

Which function is used to write all the characters?

Select an option to see the answer and solution.

What will be the output of the following Python code? (If entered name is examveda)
import sys
print 'Enter your name: ',
name = ''
while True:
   c = sys.stdin.read(1)
   if c == '\n':
      break
   name = name + c
 
print 'Your name is:', name

Select an option to see the answer and solution.

What happens if no arguments are passed to the seek function?

Select an option to see the answer and solution.

Correct syntax of file.readlines() is?

Select an option to see the answer and solution.

Which of the following mode will refer to binary data?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

In file handling, what does this terms means "r, a"?

Select an option to see the answer and solution.

What is the use of tell() method in python?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.