Class 12 Computer Science File Handling in Python MCQs Set 7


By Anjeev Kr Singh – Computer Science Educator
Published on : December 20, 2021 | Updated on : December 20, 2021

Python File Handling



File Handling in Python MCQ’s Set – 7

Multiple Choice Questions


121. The full name of a file or a directory is also called ________.

a) folder name

b) path

c) pathname

d) None of these

Answer : c) pathname

122. The _____ are from the topmost level of the directory structure.

a) absolute paths

b) relative paths

c) absolute and relative paths

d) None of these

Answer : a) absolute path

123. The _____ are relative to current working directory.

a) absolute paths

b) relative paths

c) absolute and relative paths

d) None of these

Answer : b) relative path

124. The ______ is use to represent the current working directory.

a) single dot (.)

b) double dot (..)

c) Both (a) and (b)

d) None of these

Answer : a) single dot (.)

125. The ______ is use to represent the current working directory.

a) single dot (.)

b) double dot (..)

c) Both (a) and (b)

d) None of these

Answer : b) double dot (..)

Directions (Question Number 126 and 127) : Answer the following question on the basis of given figure. Note: Tom is in c:\

126. Write single line statement to open the “one.txt” file in read mode using absolute path.

a) f = open(“one.txt”, “r”)

b) f = open(“c:\\tom\\data\one.txt, “r”)

c) f = open(“..\\data\one.txt, “r”)

d) None of these

Answer : c) f = open(“c:\\tom\\data\one.txt, “r”)

127. Write single line statement to open the “one.txt” file in read mode using relative path.

a) f = open(“one.txt”, “r”)

b) f = open(“c:\\tom\\data\one.txt, “r”)

c) f = open(“..\\data\one.txt, “r”)

d) None of these

Answer : a) f = open(“one.txt, “r”)

128. Which module is required in Python, to perform read and write operation with Binary file?

a) random

b) pickle

c) binary

d) None of these

Answer : b) pickle

129. Identify the valid statement to import the pickle module.

a) import pickles;

b) from import pickle

c) import pickle

d) None of these

Answer : c) import pickle

130. What is Pickling?

a) converting tuples to byte stream

b) converting list to byte stream

c) converting dictionary to byte stream

d) All of these

Answer : d) All of these

131. What is Serialisation?

a) converting tuples to byte stream

b) converting list to byte stream

c) converting dictionary to byte stream

d) All of these

Answer : d) All of these

132. Serialisation is also known as _______.

a) Pickling

b) Unpickling

c) Byte Stream

d) All of these

Answer : a) Pickling

133. What is Unserialization / unpickling?

a) byte stream converting to tuples

b) converting byte stream to python object

c) converting byte stream to dictionary

d) All of these

Answer : d) All of these

134. Which method of pickle module is use to write an object on to a binary file?

a) write( )

b) load( )

c) dump( )

d) None of these

Answer : c) dump()

135. Which method of pickle module is use to read from a binary file?

a) write( )

b) load( )

c) dump( )

d) None of these

Answer : b) load()

136. Identify which one is the valid syntax of dump() method?

a) dump(python_object, file_handle)

b) dump(file_handle, python_object)

c) pickle.dump(file_handle, python_object)

d) pickle.dump(python_object, file_handle)

Answer : d) pickle.dump(python_object, file_handle)

137. Identify which one is the valid syntax of load() method?

a) python_object = load(file_handle)

b) python_variable_object = pickle.load(file_handle)

c) variable = pickle.load(file_handle, python_object)

d) None of these

Answer : b) python_variable_object = pickle.load(file_handle)

138. Which one is the not a valid file mode for binary file?

a) r

b) rb

c) wb

d) ab

Answer : a) r

139. Which one is the not a valid file mode for binary file?

a) rb+

b) wb+

c) w+

d) ab+

Answer : c) w+

140. Which one is the not a valid file mode for binary file?

a) r+b

b) a+

c) w+b

d) a+b

Answer : b) a+


More MCQ’s are on the way, Refresh your page…

Python File Handling (MCQ’s)


Python Revision Tour – Multiple Choice Questions (MCQ’s)


Python Functions – Working with Functions (MCQ’s)


Thanks for visiting. Online Classes are available.

About the Author

Anjeev Kr Singh

Anjeev Kr Singh

Computer Science Educator, Author, and HOD. Guiding CBSE students in CS, IP, IT, WA & AI via mycstutorial.in. Creator of Question Bank for Class 10 & 12 students.

You cannot copy content of this page

Scroll to Top