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
Q.2. In Python, by default this EOL character is the
1)(/eol)
2)(/n)
3)(el)
4)(/p)
Show Answer
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
Q.4.Is there a delimiter for binary files.
1) Yes
2) No
Show Answer
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
Q.6. for opening of the file. Which command is used.
1)read()
2)write()
3)open()
4)append()
Show Answer
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
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
Q.9. Which is of this is binary file mode?
1)’r’
2)’rb’
3)’w’
4)’a’
Show Answer
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
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
Q. f = open(“data.txt”)
Q.12.Identify name of file.
a.F
b.Open()
c.data.txt
d.Home
Show Answer
Q.13.Identify name of function.
a.File object
b.Open()
c.data.txt
d.Home
Show Answer
Q.14.What if ‘f’ in above code?
a.File object
b.Open()
c.data.txt
d.Home
Show Answer
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
Q.16.Reads some bytes from the file and returns it as a string.
a. read()
b.readline()
c.readpara()
d.readlines()
Show Answer
Q.17. Reads a line at a time.
a. read()
b.readline()
c.readpara()
d.readlines()
Show Answer
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
Q.19. Write a string in file.
a. write()
b. writeline()
c. writelines()
d. writepara()
Show Answer
Q,20. Writes a list in a file.
a. write()
b. writeline()
c. writelines()
d. writepara()
Show Answer
Q.21.The output and input devices are implemented as files.
a.upstream
b.Downstream
c.Standard stream
D.Non-Standard stream
Show Answer
Q.22. There are three standard streams: stdin(standard input), stdout(standard output) and stderr(standard error).
a.True
b.False
Show Answer
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
Thank you for attempting File Handling in Python MCQ for CBSE Class 12 !!!
File Handling in Python Class 12 Solutions – CS Study
Very helpful nice mcqs I recommend everyone to learn mcqs from this site
Thanks for your valuable comment. We at csstudy.in gives the best material crafted by the best experienced Teachers. Again, Thanks a lot.
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()”
Thanks for your observation. The MCQ has been corrected.
yes.
but it is very easy to answer by students.
not difficult but its moderate to answer.
need some output questions for better practice apart from that questions are cool and interesting
Thank you (:
the answer of que 10 ‘a+’ is wrong. the correct ans is ‘a’
a+ is the correct answer