This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 57 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 57 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Apa arti ios::in saat membuka file? A) Membaca isi file. B) Menghapus isi file. C) Menulis ke file. D) Menambah di akhir file. Show Answer Correct Answer: A) Membaca isi file. 2. In what scenarios would you use the Dump function in Python? A) XML formatted string. B) CSV formatted string. C) In scenarios where you need to convert a Python object into a string. D) Binary file. Show Answer Correct Answer: C) In scenarios where you need to convert a Python object into a string. 3. What is the best way to read an entire file into a list of strings? A) .read(). B) .readline(). C) .readlines(). D) .read(all). Show Answer Correct Answer: C) .readlines(). 4. How do you CALL the function name in Python? A) Name(). B) Def name(). C) Call name(). D) GOTO name(). Show Answer Correct Answer: A) Name(). 5. What does the "t" mode specify when opening a file in Python? A) Temporary file. B) Text mode. C) Truncate mode. D) Transfer mode. Show Answer Correct Answer: B) Text mode. 6. How does the OCR Exam Reference Language handle file opening compared to Python? A) Uses different parameters for file modes. B) Does not require specifying the file mode. C) Only allows reading from files. D) Only allows writing to files. Show Answer Correct Answer: B) Does not require specifying the file mode. 7. Which method is used to write a string to a file in Python? A) Write(). B) Read(). C) Seek(). D) Readline(). Show Answer Correct Answer: A) Write(). 8. In file handling, what does the 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. 9. What does rewind() do? A) Resets the file position to the beginning. B) Checks for end of file. C) Closes an open file. D) Opens a file. Show Answer Correct Answer: A) Resets the file position to the beginning. 10. What is the purpose of the getc() function in C? A) Write a line to a file. B) Read a line from a file. C) Write a character to a file. D) Read a character from a file. Show Answer Correct Answer: D) Read a character from a file. 11. What does the 'glob()' method do in the pathlib module? A) Lists all files in a directory. B) Creates new files. C) Filters files based on a pattern. D) Deletes files. Show Answer Correct Answer: C) Filters files based on a pattern. 12. Explain the concept of thrashing in virtual memory. A) Thrashing refers to the process of compressing data in memory storage. B) Thrashing is a condition in virtual memory systems where excessive paging operations degrade system performance. C) Thrashing occurs when a system runs out of physical memory entirely. D) Thrashing is a method to optimize memory allocation in virtual systems. Show Answer Correct Answer: B) Thrashing is a condition in virtual memory systems where excessive paging operations degrade system performance. 13. To read the remaining line of the file from a file object called F ..... H, we use A) F H.readlines(). B) F H.read.remaining(). C) F H.readline(). D) F H.read(remaining). Show Answer Correct Answer: A) F H.readlines(). 14. Explain the concept of appending to a file in Python. A) Create a new file instead of appending to an existing one. B) Append data by using the 'w' flag when opening the file. C) Use the 'r' flag when opening the file to append data. D) Open the file in 'append' mode using the 'a' flag and write data to the file to add content without overwriting. Show Answer Correct Answer: D) Open the file in 'append' mode using the 'a' flag and write data to the file to add content without overwriting. 15. Which of these will raise an error if file already exists? A) 'w'. B) 'a'. C) 'x'. D) 'r'. Show Answer Correct Answer: C) 'x'. 16. File can be added to. File is created if it doesn't already exist. A) Read. B) Append. C) Write. D) None of the above. Show Answer Correct Answer: B) Append. 17. What is the significance of the 'encoding' parameter in file handling? A) The 'encoding' parameter specifies the file size limit. B) The 'encoding' parameter is used to set file permissions. C) The 'encoding' parameter is significant as it determines how text data is encoded and decoded during file operations. D) The 'encoding' parameter determines the file format type. Show Answer Correct Answer: C) The 'encoding' parameter is significant as it determines how text data is encoded and decoded during file operations. 18. In seek()-mode 2 will indicate. A) Current Position of File. B) EOF. C) BOF. D) Pointer Value. Show Answer Correct Answer: B) EOF. 19. In the pseudocode provided, what is the function used to open a file? A) Read(). B) Write(). C) Open(). D) Close(). Show Answer Correct Answer: C) Open(). 20. This method returns the number of characters written to the file. A) Write(). B) Type(). C) Print(). D) None of the above. Show Answer Correct Answer: A) Write(). 21. The content of a file "sample.txt" are shown below:1, 2, 3, 4'a', 'b', 'c'5, 23, 'me', 'peace" to', 'be', 'or' 'not' A) It can be treated as a csv file. B) It can not be treated as CSV file as it is a text file. C) It can not be treated as CSV file as it contains mixed data. D) It can not be treated as CSV file as it contains different number of elements in different lines. Show Answer Correct Answer: A) It can be treated as a csv file. 22. How can you handle errors while working with files in Python? A) Use if-else statements to handle errors when working with files. B) Use try-except blocks in Python to handle errors when working with files. C) Ignore errors and continue execution when working with files. D) Manually terminate the program when errors occur while working with files. Show Answer Correct Answer: B) Use try-except blocks in Python to handle errors when working with files. 23. What is the code to open a file named as Old ..... Data for writing data to it? A) Open("My Data.dat", ios::out). B) Open("My Data.dat", ios $ $ out). C) Open("My Data.dat", ios out). D) Open("My Data.dat", ). Show Answer Correct Answer: A) Open("My Data.dat", ios::out). 24. Which method checks if a file is closed? A) File.status(). B) File.closed. C) File.check(). D) File.terminated(). Show Answer Correct Answer: B) File.closed. 25. What does seek(5) do in a file? A) Finds line 5. B) Moves pointer to 5th byte. C) Skips 5 characters. D) Reads 5 bytes. Show Answer Correct Answer: B) Moves pointer to 5th byte. ← 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