This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 45 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 45 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What about today's Class? A) Good. B) Average. C) Bad. D) None of the above. Show Answer Correct Answer: A) Good. 2. Sarah wants to add her journal entry at the bottom of journal.txt without losing previous entries. Which mode should she use? A) "r". B) "w". C) "a". D) "r+". Show Answer Correct Answer: C) "a". 3. What is the advantage of Exception Handling A) To avoid abnormal termination of a program. B) To find out errors. C) To Debug program. D) None of these. Show Answer Correct Answer: A) To avoid abnormal termination of a program. 4. What is the purpose of the 'dot strip' method in Python file handling? A) To remove special characters from the text file. B) To remove spaces from the text file. C) To remove punctuation from the text file. D) To remove new line characters from the text file. Show Answer Correct Answer: D) To remove new line characters from the text file. 5. Text file student.txt is stored in the storage device. Identify the correct option out of the following options to open the file in read mode. A) Myfile = open('student.txt', 'rb'). B) Myfile = open('student.txt', 'w'). C) Myfile = open('student.txt', 'r'). D) Myfile = open('student.txt'). Show Answer Correct Answer: C) Myfile = open('student.txt', 'r'). 6. We cannot use text files to store images as the images do not contain characters. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 7. Rewind takes a file pointer and resets position to the A) Start of the file. B) End of the file. C) Desired location of the file. D) All of the above. Show Answer Correct Answer: A) Start of the file. 8. Why is it important to close a file after performing operations on it? A) To release system resources, ensure data integrity, and prevent memory leaks. B) To introduce bugs in the code. C) To confuse other developers. D) To increase system performance. Show Answer Correct Answer: A) To release system resources, ensure data integrity, and prevent memory leaks. 9. To perform file processing in C++, header files and must be included in your C++ source file. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 10. Which function opens a file in C? A) Fopen(). B) Openfile(). C) File open(). D) Startfile(). Show Answer Correct Answer: A) Fopen(). 11. Which function is used to read the entire content of a file? A) File.write(). B) File.readlines(). C) File.read(). D) File.readline(). Show Answer Correct Answer: C) File.read(). 12. In PHP you can use both single quotes ( ' ' ) and double quotes ( '' '' ) for strings: A) True. B) False. C) Both. D) None. Show Answer Correct Answer: C) Both. 13. !feof stands for A) File end of file. B) Not file end of file. C) Exlamatory file end of file. D) None. Show Answer Correct Answer: A) File end of file. 14. What is the mode 'r' used for when opening a file? A) Write-only mode. B) Append mode. C) Binary mode. D) Read-only mode. Show Answer Correct Answer: D) Read-only mode. 15. 4 Which of the following functions do you use to write data in the binary format? A) Write. B) Output. C) Dump. D) Send. Show Answer Correct Answer: C) Dump. 16. Which of the following modes is used to open a file in binary mode? A) 'ios::app'. B) 'ios::binary'. C) 'ios::trunc'. D) 'ios::out'. Show Answer Correct Answer: B) 'ios::binary'. 17. Where can the 'continue' statement be used in C++? A) Inside functions. B) Only inside switch statements. C) Inside loops and switch statements. D) Only inside loops. Show Answer Correct Answer: D) Only inside loops. 18. Which of these is a list? A) ["apples", "oranges", "bananas"]. B) "apples", "oranges", "bananas". C) \{"apples", "oranges", "bananas"\}. D) ("apples", "oranges", "bananas"). Show Answer Correct Answer: A) ["apples", "oranges", "bananas"]. 19. Which statement is used to retrieve the current position within the file? A) Fp.seek(). B) Fp.tell(). C) Fp.loc. D) Fp.pos. Show Answer Correct Answer: B) Fp.tell(). 20. What is the syntax to write to a file in Python? A) Content.write(file). B) File.write(content). C) File.write(content). D) Write.file(content). Show Answer Correct Answer: B) File.write(content). 21. Value erroe occur due to wrong indentation in a program A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 22. What does the anchor attribute of a Path object represent? A) The root folder of the filesystem. B) The name of the file. C) All the above. D) None of the above. Show Answer Correct Answer: A) The root folder of the filesystem. 23. What is the name of the file used in the example? A) Data.txt. B) Example.txt. C) File.txt. D) Text.txt. Show Answer Correct Answer: A) Data.txt. 24. If we want to customize our response to the error type that occurs, which could we use? A) Except:. B) Except ErrorType:. C) All the above. D) None of the above. Show Answer Correct Answer: B) Except ErrorType:. 25. Which method is used to test if a file is readable? A) CanRead(). B) IsReadable(). C) Read(). D) Readable(). Show Answer Correct Answer: A) CanRead(). ← 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