This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 5 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 5 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What method would you use to append data to an existing file? A) Use 'open(file, 'w+')' in Python. B) Use 'open(file, 'r')' in Python. C) Use 'open(file, 'x')' in Python. D) Use 'open(file, 'a')' in Python. Show Answer Correct Answer: D) Use 'open(file, 'a')' in Python. 2. Which mode would you use to append data to a text file? A) A. B) D. C) B. D) C. Show Answer Correct Answer: A) A. 3. How can you use the tell() and seek() methods in Python file handling? A) Tell() and seek() are used for handling exceptions in Python file operations. B) You can use tell() to write data to a file and seek() to read data from a file. C) You can use tell() to get the current position and seek() to move to a specific position in Python file handling. D) Tell() returns the size of the file and seek() is used to close the file in Python. Show Answer Correct Answer: C) You can use tell() to get the current position and seek() to move to a specific position in Python file handling. 4. In file handling, what does EOF stand for, and why is it significant? A) End Of File, it indicates that there is no more data to read from the file. B) Execution Of File, it indicates that the file is currently being executed. C) Each Open File, a reference to all open files in a program. D) Error On File, an error message that occurs when a file cannot be accessed. Show Answer Correct Answer: A) End Of File, it indicates that there is no more data to read from the file. 5. How can you append data to an existing file in Python? A) Use open('filename', 'a') to append data to an existing file. B) Use open('filename', 'r') to read data from a file. C) Use open('filename', 'w') to overwrite the file. D) Use open('filename', 'x') to create a new file. Show Answer Correct Answer: A) Use open('filename', 'a') to append data to an existing file. 6. A binary file has 5 records stored using pickle.dump(). Which error occurs if you try pickle.load() after last record? A) ValueError. B) EOFError. C) IndexError. D) KeyError. Show Answer Correct Answer: B) EOFError. 7. LOCK ..... EX stands for A) Extended lock. B) Excess lock. C) Exclusive lock. D) Extrapolar lock. Show Answer Correct Answer: C) Exclusive lock. 8. Pada akhir presentasi, kata apa yang muncul di layar? A) Sekian sebagai penutup. B) Mulai sebagai pembuka. C) Error sebagai peringatan. D) Halo sebagai salam. Show Answer Correct Answer: A) Sekian sebagai penutup. 9. In a binary file 'wb' mode is equal to ..... A) Read and write. B) Append only. C) Read only. D) Write only. Show Answer Correct Answer: D) Write only. 10. Expand EOL A) End of line. B) Exit Of Line. C) Element of Line. D) None of this. Show Answer Correct Answer: A) End of line. 11. What does the 'R' parameter signify in the 'open' command when opening a file in Python? A) Replace the file. B) Read the file. C) Run the file. D) Remove the file. Show Answer Correct Answer: B) Read the file. 12. Taran is working on a project that involves reading and writing CSV files. He comes across the newline=" argument in the open() function. What does this argument do when working with CSV files? A) It determines the delimiter used in the CSV file. B) It prevents the addition of extra newline characters when reading or writing CSV files. C) It adds extra newline characters when reading CSV files. D) It specifies the encoding type for the CSV file. Show Answer Correct Answer: B) It prevents the addition of extra newline characters when reading or writing CSV files. 13. What does with open( ..... ) as f:ensure? A) File stays open. B) File auto-closes. C) Creates backup. D) Deletes file. Show Answer Correct Answer: B) File auto-closes. 14. Which one of the following is correct syntax for opening a file. A) FILE fopen(const filename). B) FILE fopen(const filename, const char *mode). C) FILE open(const filename, const char *mode). D) FILE open(const*filename). Show Answer Correct Answer: B) FILE fopen(const filename, const char *mode). 15. Which of the following mode is applied while writing into the file? A) 'w'. B) 'r'. C) 'write'. D) 'read'. Show Answer Correct Answer: A) 'w'. 16. Which library is used for CSV handling in Python? A) Csv. B) Pickle. C) Json. D) Pandas only. Show Answer Correct Answer: A) Csv. 17. In the below statement myfile is called ..... myfile=open("school.txt") A) Filename. B) File path. C) File handle. D) Both (b) and (c). Show Answer Correct Answer: C) File handle. 18. What is the purpose of the APPEND mode in file handling? A) To read data from the file. B) To overwrite existing data in the file. C) To add new data to the end of the file without deleting existing data. D) To delete the file after writing data. Show Answer Correct Answer: C) To add new data to the end of the file without deleting existing data. 19. Apa yang digunakan untuk membaca baris demi baris dari file? A) Fgets. B) Fputs. C) Fwrite. D) Fprintf. Show Answer Correct Answer: A) Fgets. 20. What will be the output of the following Python codeprint(4 + '3') A) TypeError. B) NameError. C) IndexError. D) ValueError. Show Answer Correct Answer: A) TypeError. 21. Which method rolls back the present transaction? A) Rollback(). B) Commit(). C) Back(). D) Undo(). Show Answer Correct Answer: A) Rollback(). 22. What will happen if an exception is raised in a 'try' block but no 'except' block is provided? A) The program will terminate. B) No issues. It will continue with a default exception. C) Exception is ignored. D) It raises and error. Show Answer Correct Answer: D) It raises and error. 23. How can you read a specific number of bytes from a file? A) Invoke file.read(n, m) to read 'n' bytes with a buffer size of 'm'. B) Call file.readBytes(n) to access 'n' bytes from a file. C) Use file.get(n) to retrieve 'n' bytes from a file. D) Use file.read(n) to read 'n' bytes from a file. Show Answer Correct Answer: D) Use file.read(n) to read 'n' bytes from a file. 24. What does the createNewFile() method return if the file is successfully created? A) Void. B) False. C) Null. D) True. Show Answer Correct Answer: D) True. 25. What is the purpose of the 'for loop' in Python file handling? A) To close the file. B) To read every line from a file one at a time. C) To write data to the file. D) To append to the end of the file. Show Answer Correct Answer: B) To read every line from a file one at a time. ← 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 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 10Class 11 Computer Science Chapter 6 File Handling Quiz 11 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books