File Handling in Python MCQ for Class 12 CBSE

File Handling in Python MCQ for CBSE Class 12 Computer Science students. Important Objective Questions from NCERT and Sumita Arora Python Book for examination point of view.

Q.1. A text file stores information in ASCII or Unicode characters as per
1) the compiler
2) the interpreter
3) As per programming platform
4) computer monitor

Show Answer
3) As per programming platform

Q.2. In Python, by default this EOL character is the
1)(/eol)
2)(/n)
3)(el)
4)(/p)

Show Answer
2)(/n)

Q.3.In which format Binary file contains information
1) Zebra way
2) Quick response code
3) same format in which the data is held in memory.
4) ASCII Format

Show Answer
3) same format in which the data is held in memory.

Q.4.Is there a delimiter for binary files.
1) Yes
2) No

Show Answer
2) No

Q.5.What is easier for a program to read and write.
1) Binary file
2) Text file
3) Doc file
4) Excel file

Show Answer
1) Binary file

Q.6. for opening of the file. Which command is used.
1)read()
2)write()
3)open()
4)append()

Show Answer
3)open()

Q.7.What does this code myfile=open(“taxes.txt”).
1) opens the taxes.txt in default read mode.
2) opens the taxes.txt in default write mode.
3) opens the taxes.txt in default append mode.
4) opens the taxes.txt in default read and write mode.

Show Answer
1) opens the taxes.txt in default read mode.

Q.8. What are file object.
File object are used to read and write data to a file on disk.
1)True
2)False

Show Answer
1)True

Q.9. Which is of this is binary file mode?
1)’r’
2)’rb’
3)’w’
4)’a’

Show Answer
2)’rb

Q.10.Which of the following file-modes does retains file data and append new data.
1)’a+’
2)’a’
3)’w+’
4)’r+’

Show Answer
1)’a+’

Q.11.File is created if does not exist. If the file exists, file is truncated( past data is lost). Both reading and writing operation can take place. What is the text file mode?
1)’r’
2)’w’
3)’w+’
4)’a+’

Show Answer
3)’w+’

Q. f = open(“data.txt”)

Q.12.Identify name of file.
a.F
b.Open()
c.data.txt
d.Home

Show Answer
c.data.txt

Q.13.Identify name of function.
a.File object
b.Open()
c.data.txt
d.Home

Show Answer
Open ()

Q.14.What if ‘f’ in above code?
a.File object
b.Open()
c.data.txt
d.Home

Show Answer
a. File object

Q.15.The above statement will __________ file in ________ mode.
a.File object,write
b.Open,Read
c.data.txt,append
d.Home,append plus

Show Answer
b.Open,Read

Q.16.Reads some bytes from the file and returns it as a string.
a. read()
b.readline()
c.readpara()
d.readlines()

Show Answer
a. read()

Q.17. Reads a line at a time.
a. read()
b.readline()
c.readpara()
d.readlines()

Show Answer
b.readline()

Q.18. Reads all the lines from the file and returns in the form of list.
a. read()
b.readline()
c.readpara()
d.readlines()

Show Answer
d.readlines()

Q.19. Write a string in file.
a. write()
b. writeline()
c. writelines()
d. writepara()

Show Answer
a. write()

Q,20. Writes a list in a file.
a. write()
b. writeline()
c. writelines()
d. writepara()

Show Answer
c. writelines()

Q.21.The output and input devices are implemented as files.
a.upstream
b.Downstream
c.Standard stream
D.Non-Standard stream

Show Answer
c.Standard stream

Q.22. There are three standard streams: stdin(standard input), stdout(standard output) and stderr(standard error).
a.True
b.False

Show Answer
a.True

Q.23.The relative paths are relative to current working directory denoted as a dot(.) while its parent directory is denoted with __________.
a.dot(.)
b.two dots(..)
c.duck(‘)
d.Double duck(”)

Show Answer
b.two dots(..)

Thank you for attempting File Handling in Python MCQ for CBSE Class 12 !!!

File Handling in Python Class 12 Solutions – CS Study

8 thoughts on “File Handling in Python MCQ for Class 12 CBSE”

    1. Thanks for your valuable comment. We at csstudy.in gives the best material crafted by the best experienced Teachers. Again, Thanks a lot.

      1. Hey… the questions were amazing but I think one of the answer’s wrong. Question 19)Write a string in a file. The answer it shows is “d.readlines()”. But the answer should be “a.write()”

Leave a Comment

Your email address will not be published. Required fields are marked *