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

Quiz Instructions

Select an option to see the correct answer instantly.

1. How can you read only part of a file?
2. What does the exists() method check for a Path object?
3. In binary file data is used in
4. What will be the output of the following code?f=open('abc.txt', 'w')print(f.close)
5. What is the purpose of the first argument in the 'fopen()' function?
6. Which Python module is used to interact with the operating system for file operations?
7. Name the two function used to read and write in binary files
8. What is the purpose of the 'close' operation in file handling?
9. Which of the following is NOT a valid method of handling file operations?
10. Which function is used to pickle data to a binary file?
11. Files can be opened in multiple modes at the same time
12. I want an array that stores 10 values, which of the following is correct?
13. What is the use of "w" in file handling?
14. Which keyword is used to use(add) a module in Python Programming?
15. What is the return type of fopen()?
16. Which function serializes objects to binary file?
17. Which of the following statements are true regarding the opening modes of a file?
18. Which statement is used to change the file position to an offset value from the start?
19. Which command properly closes a file in Python?
20. Which class is used to read the contents of a text file in Java?
21. What is the best way to read the first line of a file?
22. The correct syntax of with statement is .....
23. The tab separated value file extension are .....
24. What does ferror() check for?
25. What should you do after finishing reading from a file?
26. This file does not have EOL character to mark the end of line
27. In file handling, what does this term means"r, a" ?
28. What is the purpose of the mkdir() method?
29. What is the home directory?
30. How do you pass a default argument to a function?
31. Which constant is used to position the next I/O operation relative to the current position in fseek() function?
32. What is the extension of a text file?
33. Which mode is used to open a file for both reading and writing, creating the file if it doesn't exist, and truncating the file if it exists in Python?
34. Which file mode will allow reading and writing without truncating existing data?
35. What is the output of the following code?file = open('data.txt', 'r')print(file.read())file.close()
36. Which of the following is not a mode for opening files?
37. What is the purpose of the 'open' function in file handling?
38. How can you write to a file in Python?
39. What is the correct way to ensure a file is closed after operations are completed?
40. When a number is divided by 0, ..... is raised
41. Which module in Python is used for reading and writing binary files by converting Python objects into a byte stream and vice versa?
42. What is the expected output of the function add ..... two when called with parameters 2 and 1?
43. What is the difference between positional and keyword arguments?
44. When we open file in writing mode what will happen?
45. ..... keyword is used to insert a module
46. How can you handle exceptions when opening a file in Python?
47. Mode argument is mandatory.
48. What will be the output-f=open('abc.txt', 'a')text="xyz"f.write(text)f.close()
49. What will be the output-f=open('abc.txt', 'w')print(f.name)
50. We need not to close the file if we are opening file with 'with open( ..... ) as ..... block
51. How do you create a cookie in PHP?
52. Which of the following class is used to read characters from a file?
53. When would you use the Load function in Python?
54. Both "w" mode and "a" mode can be used to edit a file.
55. What does the OPENFILE command do in file handling?
56. If I want to add to the end of a text file, I should:
57. Jika kita ingin menghapus isi lama saat membuka file, kita memakai apa?
58. Which method is used to delete a file in Java?
59. The PHP ..... function is used to open a file.
60. What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8) #include union utemp { int a; double b; char c; }u; int main() { u.c = 'A'; u.a = 1; printf("%zu", sizeof(u)); }