This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 59 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 59 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the purpose of debugging? A) To find and fix errors in the code. B) To write new code. C) To optimize the code. D) To document the code. Show Answer Correct Answer: A) To find and fix errors in the code. 2. The command file.closed returns: A) File size. B) File name. C) True or False. D) Error. Show Answer Correct Answer: C) True or False. 3. What happens if you try to read past the end of a file? A) It sets the eof flag. B) It loops indefinitely. C) It returns an error code. D) The program crashes. Show Answer Correct Answer: A) It sets the eof flag. 4. A class which is used for reading information from data files is called A) Ofstream. B) Ifstream. C) Fstream. D) Iostream. Show Answer Correct Answer: B) Ifstream. 5. Python deals with ..... different types of a file. A) Four. B) Two. C) Three. D) Five. Show Answer Correct Answer: C) Three. 6. What is the purpose of the 'shelve' module? A) To manage file paths. B) To create temporary files. C) To read text files. D) To save variables in a binary format. Show Answer Correct Answer: D) To save variables in a binary format. 7. What does the program that checks for end of file do? A) Prints the contents of the file until EOF. B) Writes data to the file. C) Checks for file errors. D) Opens a file. Show Answer Correct Answer: A) Prints the contents of the file until EOF. 8. The best mode to store a structure is: A) Text mode. B) Binary mode. C) Append mode. D) Console mode. Show Answer Correct Answer: B) Binary mode. 9. When a program reads a file, it enters every character into memory as a tuple A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 10. What is the first step in writing to a file? A) Deleting the file. B) Reading the file. C) Closing the file. D) Opening the file. Show Answer Correct Answer: D) Opening the file. 11. What is the purpose of the 'fgetc()' function in C? A) To write a character to a file. B) To read the next character from a file stream. C) To close a file. D) To check if a file exists. Show Answer Correct Answer: B) To read the next character from a file stream. 12. Explain the process of writing data to a binary file. A) The process involves opening the binary file, converting data to binary format, writing the binary data, and then closing the file. B) Skipping the step of closing the file after writing. C) Writing the data in reverse order. D) Converting data to text format before writing. Show Answer Correct Answer: A) The process involves opening the binary file, converting data to binary format, writing the binary data, and then closing the file. 13. Which statement is TRUE about the 'EOF' function? A) It writes data to the file. B) It returns TRUE if the end of the file is reached. C) It returns FALSE when the file is first opened. D) It reads the last line of the file. Show Answer Correct Answer: B) It returns TRUE if the end of the file is reached. 14. A programmer want to read, write or append file to do some specific operation .while doing this, a programmer must ..... file. A) Open. B) Create. C) Close. D) Create. Show Answer Correct Answer: A) Open. 15. Which of the following is an example of pseudocode for reading a line from a file? A) 'line = readFile("file.txt")'. B) 'OPEN file.txt FOR READ'. C) 'line = file.readLine()'. D) 'READ line FROM file.txt'. Show Answer Correct Answer: D) 'READ line FROM file.txt'. 16. Which Python module is commonly used for handling CSV files? A) Csv. B) Json. C) Txt. D) Xml. Show Answer Correct Answer: A) Csv. 17. Matilda and Alexander are working on a coding project. Can you help them figure out the correct way to close a file object named file? A) File.close(). B) Close(file). C) File.close. D) Close.file(). Show Answer Correct Answer: A) File.close(). 18. Apa nama method yang membaca semua baris dalam file dan menyimpannya dalam list? A) .read(). B) .readline(). C) .readall(). D) .readlines(). Show Answer Correct Answer: D) .readlines(). 19. What is the purpose of using Fileinputstream in Java? A) To delete a file. B) To create a new file. C) To read data from a file. D) To write data to a file. Show Answer Correct Answer: C) To read data from a file. 20. What is the use of seek() method in files? A) Sets the file's current position at the offset. B) Sets the file's previous position at the offset. C) Sets the file's current position within the file. D) None of the mentioned. Show Answer Correct Answer: C) Sets the file's current position within the file. 21. What does the 'close()' method do for a file object? A) Opens the file. B) Reads the file. C) Closes the file and saves changes. D) Deletes the file. Show Answer Correct Answer: C) Closes the file and saves changes. 22. "w" mode deletes everything first, and then writes the content. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 23. What could happen if you forget to close a file after writing to it? A) You may not be able to access the file again. B) The file will be read-only. C) The file will be encrypted. D) The file will be deleted. Show Answer Correct Answer: A) You may not be able to access the file again. 24. Select a function which is used as a formatted output file function A) Printf(). B) Fprintf(). C) Puts(). D) Fputs(). Show Answer Correct Answer: B) Fprintf(). 25. How do you check if a file exists in Python? A) Os.path.exists(). B) Os.path.isfile(). C) Os.path.isdir(). D) Os.path.getsize(). Show Answer Correct Answer: A) Os.path.exists(). ← 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