Class 11 Computer Science Chapter 6 File Handling Quiz 38 (25 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. Which mode in Python is used to open a file for append?
2. How can you read data from a binary file?
3. What method is used to read the entire content of a file in Python?
4. N= int(input("Please enter an integer: "))if n < 0:raise Exception (" Only Positive Numbers are Allowed ") print ("Great, you successfully entered an integer!")what is the output if the given input is-12
5. ..... is used to read and write data to a file on disk.
6. What will be the output of print(5/0)?
7. What are the two built-in functions to read a line of text from standard input, which is by default the keyboard?
8. You need to be on "r" mode in order to read from a file.
9. This method replaces a string with another string.
10. Which of the following function is used to open the file in python file handling?
11. What is the difference between a module and a package in Python?
12. What does the function add ..... two(a, b) do?
13. Assertion:Exception handling handles all types of errors and exceptions.Reasoning:Exception handling is responsible for handling anomalous situations during the execution of a program.
14. How do you open a file in Python?
15. Which mode is used to open binary file in write read mode
16. What is the main advantage of using binary files over text files?
17. What parameter is used to append to a file in Python?
18. What is the purpose of the program described in the video?
19. ..... to read the remaining lines of the file from a file object infi we use .....
20. The sys.stdout is always opened in ..... mode.
21. An ..... allows multiple items to be stored under one variable name, this reduces the need for multiples variables.
22. What is the output of the divmod(15, 4) function in Python?
23. Which of the following is nor a proper file access mode?
24. What type of loop is ideal for processing a file when the number of lines is unknown?
25. Which of the following is not an exception handling keyword in Python?