This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 24 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 24 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the significance of file closing in C++? A) It increases the file size. B) It allows for further writing to the file. C) It has no significance. D) It releases the resources associated with the file, ensures that all the data is written to the file, and prevents any further writing to the file. Show Answer Correct Answer: D) It releases the resources associated with the file, ensures that all the data is written to the file, and prevents any further writing to the file. 2. ..... file is efficient and best way to store information. A) Text file. B) Binary file. C) CSV file. D) Both (a) and (b). Show Answer Correct Answer: B) Binary file. 3. How can you open a file in read and write mode simultaneously in Python? A) Open('file.txt', 'a+'). B) Open('file.txt', 'r+'). C) Open('file.txt', 'rw'). D) Open('file.txt', 'w+'). Show Answer Correct Answer: B) Open('file.txt', 'r+'). 4. In a binary file 'a+' mode is equal to ..... A) Read and write. B) Append only. C) Read only. D) Write only. Show Answer Correct Answer: A) Read and write. 5. What is the purpose of the .strip() method in Python file handling? A) To split the string into multiple parts. B) To remove spaces at the beginning and end of a string. C) To convert the string to uppercase. D) To find a substring within the string. Show Answer Correct Answer: B) To remove spaces at the beginning and end of a string. 6. Appending data to a file places it at the start of the file. A) False. B) True. C) All the above. D) None of the above. Show Answer Correct Answer: A) False. 7. Which function is equivalent to getchar() but requires a file pointer as an argument? A) Getc(). B) Fwrite(). C) Putc(). D) Fread(). Show Answer Correct Answer: A) Getc(). 8. Fread() returns: A) Number of bytes read. B) Number of items read. C) Characters count. D) Only 1 or 0. Show Answer Correct Answer: B) Number of items read. 9. A file is opened in "r+" mode. Which is TRUE? A) Can read but not write. B) Can write but not read. C) Can read and write both. D) Only creates a new file. Show Answer Correct Answer: C) Can read and write both. 10. Which function is used to change the file position in Python? A) Seek(). B) Write(). C) Read(). D) Close(). Show Answer Correct Answer: A) Seek(). 11. What does the 'R' parameter signify when opening a file in Python? A) Append mode. B) Execute mode. C) Write mode. D) Read-only mode. Show Answer Correct Answer: D) Read-only mode. 12. These files are organized by time. A) Serial Files. B) PDF File. C) PNG File. D) None of the above. Show Answer Correct Answer: A) Serial Files. 13. How many types of files are there? A) One. B) Two. C) Three. D) Four. Show Answer Correct Answer: B) Two. 14. To read the next line of the file from a file object fobj, we use: A) Fobj.read(2). B) Fobj.read(). C) Fobj.readline(). D) Fobj.readlines(). Show Answer Correct Answer: C) Fobj.readline(). 15. In f=open( "data.txt" , "r" ), r refers to ..... A) File handle. B) File object. C) File Mode. D) Buffer. Show Answer Correct Answer: C) File Mode. 16. The ..... character is used to separate the values in CSV files. A) . B) ,. C) :. D) $\rightarrow$. Show Answer Correct Answer: B) ,. 17. Which class is used for output file stream operations in C++? A) FileStream. B) Ofstream. C) Fstream. D) Ifstream. Show Answer Correct Answer: B) Ofstream. 18. What does the "w" mode do when opening a file in Python? A) Writes to a file, error if the file does not exist. B) Writes to a file, creates the file if it does not exist. C) Writes to a file, reads from the file first. D) Writes to a file, appends to the file if it exists. Show Answer Correct Answer: B) Writes to a file, creates the file if it does not exist. 19. Which Tkinter widget is used to create a graphical slider for selecting a value? A) Sliders. B) Buttons. C) Label. D) Dialogs. Show Answer Correct Answer: A) Sliders. 20. What does the 'readline()' function do when reading a file in Python? A) It reads the entire file at once. B) It reads the next character in the file. C) It reads the current line from the file and then moves the cursor to the next line. D) It reads the next line from the file. Show Answer Correct Answer: C) It reads the current line from the file and then moves the cursor to the next line. 21. What is the result of using 'a' mode when opening a file? A) It reads the file. B) It creates a new file only. C) It appends to the end of the file. D) It overwrites the file. Show Answer Correct Answer: C) It appends to the end of the file. 22. Which of the following mode will refer to binary data? A) R. B) W. C) +. D) B. Show Answer Correct Answer: D) B. 23. How do you handle errors when working with files in Python? A) Ignore errors and continue execution. B) Use try-except blocks to catch file-related errors such as FileNotFoundError, PermissionError, or IOError in Python. C) Manually modify the Python source code to fix errors. D) Use if-else statements to handle file-related errors. Show Answer Correct Answer: B) Use try-except blocks to catch file-related errors such as FileNotFoundError, PermissionError, or IOError in Python. 24. What is the purpose of the 'write' function in Python file handling? A) To read data from a file. B) To delete a file. C) To write data to a file. D) To close a file. Show Answer Correct Answer: C) To write data to a file. 25. Fstream library provides C++ programmers with ..... classes for working with files A) Two. B) Three. C) Four. D) Five. Show Answer Correct Answer: B) Three. ← PreviousNext →Related QuizzesClass 11 Computer Science Chapter 6 File Handling Quiz 1Class 11 Computer Science Chapter 6 File Handling Quiz 2Class 11 Computer Science Chapter 6 File Handling Quiz 3Class 11 Computer Science Chapter 6 File Handling Quiz 4Class 11 Computer Science Chapter 6 File Handling Quiz 5Class 11 Computer Science Chapter 6 File Handling Quiz 6Class 11 Computer Science Chapter 6 File Handling Quiz 7Class 11 Computer Science Chapter 6 File Handling Quiz 8Class 11 Computer Science Chapter 6 File Handling Quiz 9Class 11 Computer Science Chapter 6 File Handling Quiz 10 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books