This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 31 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 31 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. In binary file data is used in A) Byte. B) Text. C) Graphics. D) None. Show Answer Correct Answer: A) Byte. 2. What will be the output of the following code?f=open('abc.txt', 'w')print(f.close) A) True. B) False. C) 1. D) 0. Show Answer Correct Answer: B) False. 3. What is the purpose of the first argument in the 'fopen()' function? A) To specify the mode in which the file should be opened. B) To indicate the name of the file to be opened. C) To define the size of the file to be opened. D) To set the permissions for the file. Show Answer Correct Answer: B) To indicate the name of the file to be opened. 4. Which Python module is used to interact with the operating system for file operations? A) Sys. B) Os. C) Pickle. D) Csv. Show Answer Correct Answer: B) Os. 5. Name the two function used to read and write in binary files A) Seek(), Tell(). B) Dump(), Load(). C) Pickle(), Unpickle(). D) Read(), Write(). Show Answer Correct Answer: B) Dump(), Load(). 6. What is the purpose of the 'close' operation in file handling? A) To free up resources. B) To rename the file. C) To save changes to the file. D) To delete the file. Show Answer Correct Answer: A) To free up resources. 7. Which of the following is NOT a valid method of handling file operations? A) Storing a file's contents directly in a Boolean variable. B) Opening a file before reading data from it. C) Writing data to a file using an appropriate file mode. D) Closing a file after reading or writing to it. Show Answer Correct Answer: A) Storing a file's contents directly in a Boolean variable. 8. Which function is used to pickle data to a binary file? A) Pickle.load(). B) Pickle.dump(). C) Pickle.read(). D) Pickle.write(). Show Answer Correct Answer: B) Pickle.dump(). 9. Files can be opened in multiple modes at the same time A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 10. I want an array that stores 10 values, which of the following is correct? A) MyArray[1]. B) MyArray10. C) MyArray[10]. D) MyArray\{10\}. Show Answer Correct Answer: C) MyArray[10]. 11. What is the use of "w" in file handling? A) Read. B) Write. C) Append. D) None of the above. Show Answer Correct Answer: B) Write. 12. Which keyword is used to use(add) a module in Python Programming? A) Insert. B) Input. C) Import. D) None. Show Answer Correct Answer: C) Import. 13. What is the return type of fopen()? A) Int. B) FILE. C) FILE *. D) Char *. Show Answer Correct Answer: C) FILE *. 14. Which function serializes objects to binary file? A) Dump(). B) Write(). C) Save(). D) Store(). Show Answer Correct Answer: A) Dump(). 15. Which of the following statements are true regarding the opening modes of a file? A) When you open a file for reading, if the file does not exist, an error occurs. B) When you open a file for writing, if the file does not exist, an error occurs. C) When you open a file for reading, if the file does not exist, the program will open an empty file. D) None of the above. Show Answer Correct Answer: A) When you open a file for reading, if the file does not exist, an error occurs. 16. Which statement is used to change the file position to an offset value from the start? A) Fp.seek(offset, 0). B) Fp.seek(offset, 1). C) Fp.seek(offset, 2). D) None of these. Show Answer Correct Answer: A) Fp.seek(offset, 0). 17. Which command properly closes a file in Python? A) File.close(). B) File.end(). C) File.quit(). D) File.exit(). Show Answer Correct Answer: A) File.close(). 18. Which class is used to read the contents of a text file in Java? A) BufferedWriter. B) FileReader. C) FileWriter. D) Scanner. Show Answer Correct Answer: D) Scanner. 19. What is the best way to read the first line of a file? A) .read(). B) .readline(). C) .readlines(). D) .read(all). Show Answer Correct Answer: B) .readline(). 20. The correct syntax of with statement is ..... A) With open(, ) as . B) With Open(, ) . C) With open(, ) as :. D) All of the above. Show Answer Correct Answer: C) With open(, ) as :. 21. The tab separated value file extension are ..... A) .csv. B) .tsv. C) .txt. D) All these. Show Answer Correct Answer: B) .tsv. 22. What does ferror() check for? A) Checks for file errors. B) Opens a file. C) Closes an open file. D) Reads data from a file. Show Answer Correct Answer: A) Checks for file errors. 23. What should you do after finishing reading from a file? A) Close the file. B) Leave it open. C) Delete the file. D) Rename the file. Show Answer Correct Answer: A) Close the file. 24. This file does not have EOL character to mark the end of line A) Binary Files. B) Text Files. C) All the above. D) None of the above. Show Answer Correct Answer: A) Binary Files. 25. In file handling, what does this term means"r, a" ? A) Read, append. B) Append, read. C) All of the mentioned. D) None of these. Show Answer Correct Answer: A) Read, append. ← 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