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

Quiz Instructions

Select an option to see the correct answer instantly.

1. How can you read a CSV file using Python's built-in libraries?
2. What will file.read(4) do?
3. Function to read the entire file
4. To read the entire contents of the file as a string from a file object fobj, the command should be:
5. What will happen when you run this code:with open('data.txt', 'r') as file:print(file.read())?
6. Which of these class contains the methods print() & println()?
7. What is missing from this code?file = open ( "test1 ..... ", "w" )
8. If break statement is inside a nested loop, break will terminate the innermost loop.
9. Class Main \{ public static void main(String args[]) \{ try \{ throw 10; \} catch(int e) \{ System.out.println("Got the Exception '' + e); \} \}\}
10. Assume that the customer file references a file object, and the file was opened using the 'w' mode specifier. How would you write the string 'Mary Smith' to the file?
11. Every file maintains a ..... which tells the current position in the file.
12. Which mode should be used with pickle.load()?
13. What does the "t" in the mode "rt" stand for when opening a file in Python?
14. What is the purpose of a pointer FILE* in C?
15. To create the reader object, the correct syntax is ..... [Assume that the salesdet.csv file is opened in reading mode in the file handle fh.
16. What does the pathlib module do?
17. What are file extensions?
18. What does the 'seekg' function do in file handling?
19. What is the function of the mode ' w+'?
20. Which mode in Python is used to open a file for writing?
21. Expand BOF
22. CSV module allows writing multiple records in a CSV file using
23. Which statement correctly opens a file for exclusive creation?
24. Given a text file opened as file ..... in, which of the following will print the entire file?
25. When you open a file for reading and if the file does not exist what occurs?