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

Quiz Instructions

Select an option to see the correct answer instantly.

1. How do you handle a ValueError when converting input to an integer?
2. Which mode do you use to open a file for reading in Python?
3. What is the purpose of the 'open()' function in programming?
4. Readlines() method return?
5. Which of the following functions is used to write data in the binary file?
6. Which mode in fopen() allows both reading and writing to a file without truncating it?
7. What does the readlines() method return when reading a text file?
8. Abhishek and Taran are working on a project that requires them to save data in a CSV file. They need to write a header row to the CSV file in Python without using DictWriter. How can they achieve this?
9. Which header file is required for using file handling functions in C?
10. What is the purpose of the Writer function in CSV file handling?
11. What will happen if you try to open a file that does not exist in the read mode ("r") in Python?
12. Jika kita ingin menambahkan data ke file tanpa menghapus isi yang ada, kita menggunakan mode apa?
13. What is the extension of a binary file usually used in Python?
14. Difference between r+ and w+
15. Which mode in Python is used to open a file for creating (and return an error if the file exists)?
16. Write the output of the following:f=open("test.txt", "w+") f.write("File-Handling") a=f.read(5) print(a)
17. Read() function keep the file pointer at .....
18. What is the function of 'os.makedirs()'?
19. Which of the following commands canbe used to read "n" number of characters from a file using the file object ?
20. What does the relpath() function return?
21. What does the last byte of a file contain?
22. What is the purpose of error handling in file operations?
23. What is a file in the context of programming?
24. In ..... storage value of variable is not lost even though the computer is not supplied electricity
25. What will be the output of the following code?import java.io.*; class demoFile \{ public static void main(String args[]) \{File f = new File("C:/java/xyz"); System.out.print(f.getName()); \} \}