Class 12 Computer Science File Handling in Python MCQs Set 2

Python File Handling



File Handling in Python MCQ’s Set – 2

Multiple Choice Questions


21. Which of the following is a valid example of CSV file content?

a) Best Website for Computer Science Term 1 Examination is mycstutorial.in.

b) Best → Website → for → Computer → Science → Term 1 → Examination → is → mycstutorial.in.

c) Best, Website, for, Computer, Science, Term 1, Examination, is, mycstutorial.in.

d) All of these

Answer : c) Best, Website, for, Computer, Science, Term 1, Examination, is, mycstutorial.in.

22. Which of the following is not a valid text file.

a) .ini files

b) .rtf files

c) .docx files

d) None of these

Answer : c) .docx files

23. A _________ files stored the information in the form of a stream (sequence) of bytes.

a) text files

b) binary files

c) Both (a) and (b)

d) None of these

Answer : b) binary files

24. _________ files are human readable.

a) text files

b) binary files

c) Both (a) and (b)

d) None of these

Answer : a) text files

25. _________ files are not human redable.

a) text files

b) binary files

c) Both (a) and (b)

d) None of these

Answer : b) binary files

26. A _________ files contain information in the same format in which the information held in computer memory.

a) text files

b) binary files

c) Both (a) and (b)

d) None of these

Answer : b) binary files

27. Tanmay is trying to open the binary file using a text editor will shows ________ value.

a) readable

b) garbage

c) proper

d) None of these

Answer : b) garbage

28. In _________ file, there is no delimiter in a line i.e. EOL.

a) text files

b) binary files

c) Both (a) and (b)

d) None of these

Answer : b) binary files

29. Identify the correct statement :-

I) Text File stores the information in human readable while binary does not.

II) In Text File internal translation occur while in binary file no translation occur.

III) Text file is faster than binary file.

a) I, II and III are true.

b) I & II are true only.

c) II and III are true only.

d) I and III are true only.

Answer : b) I & II are true only.

30. Files are mainly access for ____________.

a) read data

b) write data

c) Both (a) and (b)

d) None of these

Answer : c) Both (a) and (b)

31. Operations on files includes – .

a) Creating and Opening a File

b) Reading from file and Writing into a file

c) Deleting and Traversing from a file

d) All of these

Answer : d) All of these

32. Which module of Python contains different functions for handling files?

a) io

b) in_out

c) files

d) None of these

Answer : a) io

33. In Python, Which function is use to open the file?

a) open_file()

b) file_open()

c) open( )

d) None of these

Answer : c) open

34. Which of the following is a valid method to use the open() function?

a) fileobject = open(“filename”)

b) fileobject = open(“filename”, “filemode”)

c) Both (a) and (b)

d) None of these

Answer : c) Both (a) and (b)

35. What is the default mode i.e. file mode in open() function?

a) read

b) write

c) append

d) None of these

Answer : a) read

36. Write a valid command to open a file named -“student.txt” in read mode?

a) fileObject = open()

b) fileobject = open.open(“student.txt”)

c) fileobject = open(“student.txt”, “r”) OR fileobject = open(“student.txt”)

d) None of these

Answer : c) fileobject = open(“student.txt”, “r”)

OR

fileobject = open(“student.txt”)

37. A File object is also known as _________.

a) Controller

b) File Handle

c) File Cursor

d) None of these

Answer : b) File Handle

38. Amit has written this statement : fileobject = open(“amit.txt”, “r”). What happen if the file “amit.txt” is not exists in the current folder.

a) Python will create a new file named “amit.txt”

b) Raise an error : FileNotFoundError

c) Does nothing

d) None of these

Answer : b) Raise an eror : FileNotFoundError

39. fileobject = open(“mycstutorial.txt”) .

In the given statement, what is the use of fileobject?

a) fileobject is a variable, helps to perform read and write operation with file.

b) fileobject is a variable only.

c) It stores the name of the file.

d) None of these

Answer : a) fileobject is a variable, helps to perform read and write operation with file.

40. The ___________ establishes a link between the program and the data file stored in the permanent storage.

a) filemode

b) filename

c) fileobject

d) None of these

Answer : c) fileobject


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)


You cannot copy content of this page

Scroll to Top