File Handling in Python Class 12 MCQ

Teachers and Examiners (CBSESkillEduction) collaborated to create the File Handling in Python Class 12 MCQ. All the important Information are taken from the NCERT Textbook Computer Science (083) class 12.

File Handling in Python Class 12 MCQ

1. A text file stores information is __________ characters.
a. ASCII
b. Unicode
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

2. In text files, each line of text is terminated, with a special character known as ___________.
a. EOL 
b. EOF
c. EEF
d. All of the above

Show Answer ⟶
a. EOL

3. Which one of the following is correct for carriage-return and newline combination.
a. \r\n 
b. /r/n
c. \r/n
d. /r\n

Show Answer ⟶
a. \r\n

4. A _________ file is just a file that contains information in the same format in which the information is held in memory.
a. Text file
b. Binary file 
c. Word file
d. None of the above

Show Answer ⟶
b. Binary file

File Handling in Python Class 12 MCQ

5. _________file format are faster and easier for a prgram to read and write than other file format.
a. Text file
b. Binary file 
c. Doc file
d. None of the above

Show Answer ⟶
b. Binary file

6. The command for opening a file in Python file handling is ____________.
a. open() 
b. update()
c. both a) and b)
d. None of the above

Show Answer ⟶
a. open()

7. The command for closing a file in Python file handling is ____________.
a. close() 
b. closing()
c. object()
d. None of the above

Show Answer ⟶
a. close()

8. _________ text file mode is used to read data from file.
a. ‘r’
b. ‘rb’
c. ‘r+’
d. None of the above

Show Answer ⟶
a. ‘r’

9. _________ text file mode is used to apped data in the file using file handling.
a. ‘w’
b. ‘ab’
c. ‘a’ 
d. None of the above

Show Answer ⟶
c. ‘a’

File Handling in Python Class 12 MCQ

10. _________ binary file mode is used to append data in the file using file handling.
a. ‘ab’ 
b. ‘w’
c. ‘a’
d. None of the above

Show Answer ⟶
a. ‘ab’

11. Which of the following option is correct for ‘a+’ text file mode.
a. File is create if does not exit
b. If file exist, file’s existing data is retained; new data is appended
c. Both reading and writing operation can take palce.
d. All of the above 

Show Answer ⟶
d. All of the above

12. ___________ function is used to read the data from the file.
a. read()
b. readline()
c. readlines()
d. All of the above 

Show Answer ⟶
d. All of the above

13. Which function is used to write data onto a file.
a. write()
b. writelines()
c. Both a) and b) 
d. None of the above

Show Answer ⟶
c. Both a) and b)

14. Python holds everything to write in the file in buffer. if you want to force python to write the contents of buffer onto storage, you can use ________ function.
a. flush() 
b. push()
c. clear()
d. None of the above

Show Answer ⟶
a. flush()

File Handling in Python Class 12 MCQ

15. Which function is used to remove whitespace after reading a file in file handling.
a. write()
b. read()
c. strip() 
d. None of the above

Show Answer ⟶
c. strip()

16. _________ removes the given character from trailing end or from the right end.
a. strip()
b. rstrip() 
c. lstrip()
d. None of the above

Show Answer ⟶
b. rstrip()

17. A text file can be opened in ________ file modes.
a. ‘r’ and ‘w’
b. ‘a’ and ‘r+’
c. ‘w+’ and ‘a+’
d. All of the above 

Show Answer ⟶
d. All of the above

18. A binary file can be opend in ________ file mode.
a. ‘rb’ and ‘wb’
b. ‘ab’ and ‘r+b’
c. (‘rb+’), ‘w+b'(wb+’), ‘a+b'(‘ab+’)
d. All of the above 

Show Answer ⟶
d. All of the above

19. ________ are the standard streams in file handling.
a. stdin (standard input)
b. stdout (standard output)
c. stderr (standard error)
d. All of the above 

Show Answer ⟶
d. All of the above

File Handling in Python Class 12 MCQ

20. The input and output devices are implemented as file, also called __________.
a. Standard streams 
b. Standard Binary
c. Standar Text
d. None of the above

Show Answer ⟶
a. Standard streams

21. In python directory denonted as a dot(.) while its parent directory is denoted with ________.
a. Three dots(…)
b. Two dots(..) 
c. Both a) and b)
d. None of the above

Show Answer ⟶
b. Two dots(..)

Computer Science Class 12 Notes

  1. Python Revision tour – 1 Class 12 Notes
  2. Python Revision tour – 2 Class 12 Notes Notes
  3. Working with Functions Class 12 Notes
  4. Using Python Libraries Class 12 Notes
  5. File Handling Class 12 Notes
  6. Recursion Class 12 Notes
  7. Idea of Algorithmic Efficiency Class 12 Notes
  8. Data Visualization using Pyplot Class 12 Notes
  9. Data Structure Class 12 Notes
  10. Computer Network Class 12 Notes
  11. More on MySQL Class 12 Notes

MCQ for Class 12 Computer Science Python

  1. Python Revision tour – 1 Class 12 MCQs
  2. Python Revision tour – 2 Class 12 MCQs
  3. Working with Functions Class 12 MCQs
  4. Using Python Libraries Class 12 MCQs
  5. File Handling Class 12 MCQs
  6. Recursion Class 12 MCQs
  7. Data Visualization using Pyplot Class 12 MCQs
  8. Data Structure Class 12 MCQs
  9. Computer Network Class 12 MCQs
  10. More on MySQL Class 12 MCQs

Computer Science Class 12 Questions and Answers

  1. Python Revision tour – 1 Class 12 Questions and Answers
  2. Working with Functions Class 12 Questions and Answers
  3. Using Python Libraries Class 12 Questions and Answers
  4. File Handling Class 12 Questions and Answers
  5. Recursion Class 12 Questions and Answers
  6. Idea of Algorithmic Efficiency Class 12 Questions and Answers
  7. Data Structure Class 12 Questions and Answers
  8. More on MySQL Class 12 Questions and Answers
  9. Computer Network Class 12 Questions and Answers
  10. More on MySQL Class 12 Questions and Answers 
error: Content is protected !!