This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 9 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 9 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which module is used to write and read binary files with objects? A) Csv. B) Os. C) Pickle. D) Random. Show Answer Correct Answer: C) Pickle. 2. Which function renames a file? A) Os.rename(). B) Os.move(). C) Os.replace(). D) Os.shift(). Show Answer Correct Answer: A) Os.rename(). 3. Which function is used to read data from Text File? A) Read( ). B) Writelines. C) Pickle. D) Dump. Show Answer Correct Answer: A) Read( ). 4. Is the following Python code valid?try:# Do somethingexcept:# Do somethingelse:# Do something A) No, there is no such thing as else. B) No, else cannot be used with except. C) No, else must come before except. D) Yes. Show Answer Correct Answer: D) Yes. 5. .... is the extension of binary files A) .txt. B) .bin. C) .dat. D) .Dat. Show Answer Correct Answer: C) .dat. 6. What does the 'seek()' function do? A) Writes data to a file. B) Closes the file. C) Sets the position of the file pointer. D) Reads data from a file. Show Answer Correct Answer: C) Sets the position of the file pointer. 7. File opening modes for CSV files are: A) Same as those for text files. B) Same as those for binary files. C) Different from text files and binary files. D) Mix of text files and binary files. Show Answer Correct Answer: A) Same as those for text files. 8. The command that terminates the resources in use and frees the system of this program. A) Close(). B) Close(. C) Closed(). D) Closed(. Show Answer Correct Answer: A) Close(). 9. Which function is used to append data to a file in Python? A) Append(). B) Write(). C) Insert(). D) Add(). Show Answer Correct Answer: B) Write(). 10. Dynamic allocation of struct uses: A) Alloc(). B) Malloc(). C) New struct. D) Getmem(). Show Answer Correct Answer: B) Malloc(). 11. Exp(), floor()belongs which module? A) Cmath.py. B) Urlib.py. C) Math.py. D) Statistics.py. Show Answer Correct Answer: C) Math.py. 12. Which method is used to write data to a file in Python? A) Print(). B) Read(). C) Write(). D) Append(). Show Answer Correct Answer: C) Write(). 13. Using append adds data to an existing file A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 14. If there is no error, then what will the error() method return? A) TRUE. B) FALSE. C) Empty String. D) None. Show Answer Correct Answer: C) Empty String. 15. Try block may or may not contains catch blocks A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 16. Which of these keywords is not a part of exception handling? A) Try. B) Finally. C) Thrown. D) Catch. Show Answer Correct Answer: C) Thrown. 17. What is the default mode when opening a file in Python? A) Binary. B) Text. C) Append. D) Write. Show Answer Correct Answer: B) Text. 18. Taran and Tanisha are discussing different file formats in Python for their data science project. They wonder what is a similarity between text files and CSV files. A) Both can only be read using the csv module. B) Both store data in plain text format. C) Both require a specific delimiter to separate data. D) Both are binary files by default. Show Answer Correct Answer: B) Both store data in plain text format. 19. A pointer variable can be A) Passed to a function as argument. B) Changed within a function. C) Returned by a function. D) Can be assigned an integer value. Show Answer Correct Answer: B) Changed within a function. 20. Which function of text file will read the content of the complete file? A) Read(4). B) Readline(). C) Redlines(). D) Read(). Show Answer Correct Answer: D) Read(). 21. 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. 22. What is the significance of file modes like 'r', 'w', and 'a'? A) The significance of file modes like 'r', 'w', and 'a' lies in controlling file access for reading, writing, and appending data. B) File modes specify the file format for data storage. C) File modes determine the size of the file on disk. D) File modes are used to encrypt the contents of a file. Show Answer Correct Answer: A) The significance of file modes like 'r', 'w', and 'a' lies in controlling file access for reading, writing, and appending data. 23. What happens each time you call the 'writeline' function? A) It writes data to the bottom of the file on a new line. B) It writes data to the top of the file. C) It deletes the previous line. D) It overwrites the file. Show Answer Correct Answer: A) It writes data to the bottom of the file on a new line. 24. What is the output of print(add ..... two(2, 's'))? A) Error. B) 5. C) 3. D) None. Show Answer Correct Answer: A) Error. 25. How do you read a CSV file using the csv module? A) Use the csv.reader() function after opening the file with open(). B) Open the file in binary mode and read it line by line. C) Use the pandas library to read the file directly. D) Use the json.load() function to parse the CSV file. Show Answer Correct Answer: A) Use the csv.reader() function after opening the file with open(). ← 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 10Class 11 Computer Science Chapter 6 File Handling Quiz 11 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books