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

Quiz Instructions

Select an option to see the correct answer instantly.

1. What exception is raised when trying to open a file in write mode that already exists?
2. If you open a file in 'append' mode, what can you do?
3. Apa yang terjadi jika file yang dibuka dengan mode "w" sudah ada?
4. Which mode is used to open an existing file for both reading and writing?
5. Function readline() and readlines() are both the same functions. Is the statement True or False
6. During a class project, Shaurya needs to write a single row of data to a CSV file using the csv.writer method. Which method should he use?
7. Which of the following statements correctly explain the function of seek() method?
8. How many number of text file are available in Python .....
9. What does the "w" mode do when opening a file?
10. What is the correct way to close a file in C++?
11. What is the purpose of the 'pprint.pformat()' function?
12. What is the purpose of saving data before closing a program?
13. Which of the following is an example of a recursive function?
14. Which method is used to read the entire contents of a file as a string in Python?
15. 3 Which module is used to work with binary files?
16. How do you write data to a CSV file in Python?
17. How can you open a text file in read mode in Python?
18. To count the number of words in a text file, the best approach is:
19. Afif uses fopen("log.txt", "w") to open a file and writes a log message. What will happen if log.txt already has old data inside?
20. What is the output of the program that writes to a file?
21. Which of the following function returns a list datatype
22. Which mode should you use to open a file for writing in text mode, creating it if it doesn't exist?
23. If you open a file in 'r' mode and it does not exist, what happens?
24. Mode apa yang digunakan untuk menulis ke file baru dalam fopen?
25. How can you create a new file if it does not exist when opening it?