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

Quiz Instructions

Select an option to see the correct answer instantly.

1. What does the function fopen() do?
2. ..... Open the file for reading and writing. For existing file, data is truncated and over-written.
3. What is the significance of the Reader function in CSV file handling?
4. How can you create a new directory using pathlib?
5. What is the first step in handling a file in Python?
6. Which of these class is not related to input and output stream in terms of functioning?
7. The other names of pickling and unpickling is?
8. Formal and actual parameters are matched up by
9. What method would you use to close a file in Python?
10. What is the default mode in which a file is opened using 'ifstream'?
11. Pickle. dump() takes two arguments namely ..... and .....
12. Which is the correct statement for binary file reading?
13. Most commonly used delimiter in a CSV file is
14. Which of the following is a valid way to append data to a file?
15. If we want to do the same thing regardless of the error type that occurs in the try block, which should we use?
16. Which of the following commands can be used to read the remaining lines in a file using the file object ?
17. Which function will remove a file from the directory?
18. What does the 'readline()' function do?
19. What is the purpose of rename()?
20. What is the purpose of the 'with' statement in file handling?
21. What happens if you try to read from a file that has been opened in write mode?
22. What will be the output of the following statement in python? (fh is a file handle) fh.seek(-30, 2) Options:-It will place the file pointer:-
23. Which function writes a character to a file?
24. What mode would you use to write to a file, overwriting its contents?
25. Appending to a file means adding extra data into the file.
26. Which step creates a connection between a file and a program?
27. Explain the process of reading from a file in Python.
28. What is the output of following program#include int main(){ extern int i; printf("%d ", i); { int i = 10; printf("%d ", i); } return 0; }
29. Which of the following needs to be used to provide access to the file throughout a program?
30. ..... method writes all given rows to the csv file.
31. Full form of CSV.
32. Simple programs can't make use of text files to store data for access again
33. The default file mode is ..... mode:
34. Which statement is TRUE about file reading in Python?
35. What is the purpose of the 'with' statement when handling files?
36. What keyword in Python is used to load other Python source code files into your current code page?
37. The data files are the files that stored ..... to specific application for later use.
38. File data.txt contains "Hello" .f=open("data.txt", "w")f.write("World")f.close()What will be the content of file?
39. What will the following code do?with open('test.txt', 'w') as file:file.write("Hello World")
40. How do you create a Fileoutputstream object in Java?
41. Fseek(fp, 0, SEEK ..... SET) moves pointer to:
42. Which Tkinter widget is used for drawing shapes and graphics?
43. Which is used for writing data to a file in file handling?
44. The ..... block holds the code to be run (Run the code) checked for any error, if exists
45. What does two periods (dot-dot) mean in a path?
46. What is the purpose of the 'a' mode when opening a file in Python?
47. To open a file poem.txt for reading, the correct syntax is .....
48. What does opening a file in mode 'a' mean?with open("test.txt ", 'a') as f:
49. Public class X { public static void main(String [] args) { try { badMethod(); System.out.print("A"); } catch (Exception ex) { System.out.print("B"); } finally { System.out.print("C"); } System.out.print("D"); } public static void badMethod() { throw new Error(); /* Line 22 */ } }
50. Files are having ..... nature.
51. What method would you use to read all lines from a file into a list?
52. What is the primary function of a file handler in computer programming?
53. What is the result of trying to read a file that does not exist?
54. What method is used to write multiple rows to a CSV file at once?
55. What does the 'with' statement do when handling files?
56. A=m.read(3)Here the above code read(3) will point which pointer position ..... if the file content is ..... 12, welcome-1jio
57. What does file.write("Hello") do?
58. How do you open a file for writing in Python?
59. Which of the following file-modes does retains file data and append new data.
60. To write dictionaries, tuples and any other python objects in binary file ..... function is used