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

Quiz Instructions

Select an option to see the correct answer instantly.

1. Which mode is correct for writing binary file?
2. Which mode is used to open a binary file for writing?
3. Fread() reads contents of file
4. How do you read a file line by line in Python?
5. How do you handle exceptions while working with Fileinputstream and Fileoutputstream in Java?
6. Describe how to serialize an object in Python.
7. Ali opens a file with mode "r" . He tries to write new data into it, but an error occurs. Why?
8. Dalam C++, fungsi mana yang digunakan untuk membuka file?
9. Using append overwrites all data in a text file
10. Which function is used to read a single line from a file
11. What is the code to open a file named as new ..... file in write mode and truncate it if it already exists?
12. What are the different modes of opening a file in C++?
13. What does the tell() function return in Python file handling?
14. In Python, which function do you use to open a file?
15. What is the purpose of closing a file after it is no longer being used?
16. Which exception is thrown when divide by zero occurs?
17. How do you close a file after performing file operations in C++?
18. What will be the output of the following code snippet?f = Nonefor i in range (5):with open("myfile.txt", "w") as f:if i > 2:breakprint (f.closed)
19. What is the result of trying to access an index that is out of range in a list?
20. Vi stands for
21. Which of the following class is used for input and output operation when working with characters?
22. How is Java serialization achieved?
23. What is the purpose of the 'close' method in file handling?
24. Which is/are the basic I/O (input-output) stream(s) in file?
25. Why is Binary File Handling important in Python programming?