This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 51 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 51 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What does the seek() function do in file handling? A) The seek() function closes the file. B) The seek() function reads data from a file. C) The seek() function writes data to a file. D) The seek() function changes the current file position. Show Answer Correct Answer: D) The seek() function changes the current file position. 2. Reyansh is working on a project where he needs to save the results of his experiments in a structured format. He decides to use a CSV file for this purpose. What does the csv.writer() function do? A) It reads data from a CSV file. B) It converts CSV data to JSON format. C) It writes data to a CSV file. D) It deletes data from a CSV file. Show Answer Correct Answer: C) It writes data to a CSV file. 3. ..... is the process of converting Python object hierarchy into a byte stream so that it can be written to a file A) Conversion. B) Translation. C) Serialization. D) Unpickling. Show Answer Correct Answer: C) Serialization. 4. Which method is used to list all files and directories in a directory in Python? A) Os.files(). B) Os.listdir(). C) Os.list(). D) Os.getdir(). Show Answer Correct Answer: B) Os.listdir(). 5. What is the key function for working with files in Python? A) Close(). B) File(). C) Open(). D) Read(). Show Answer Correct Answer: C) Open(). 6. Where files are store permanently? A) RAM. B) Hard Disk. C) Cache memory. D) None of these. Show Answer Correct Answer: B) Hard Disk. 7. Flush() is used to A) Transfer the contents from buffer to file. B) Its closes the file. C) Transfer the contents from buffer to file and closes the file. D) Erase the data from the file. Show Answer Correct Answer: A) Transfer the contents from buffer to file. 8. What is the Output of following program?#include int main()\{ int x = 5; int * const ptr = &x; ++(*ptr); printf("%d", x); return 0; \} A) Compiler error. B) Runtime error. C) 5. D) 6. Show Answer Correct Answer: D) 6. 9. If CSV contains values like "New, Delhi", how is it handled? A) Error occurs. B) Split into 2 fields. C) Enclosed in quotes. D) Removed comma. Show Answer Correct Answer: C) Enclosed in quotes. 10. The prefix r in front of a string makes it raw string that means ..... A) Special meaning to a number. B) No Special meaning to a number. C) No Special meaning to a character. D) Special meaning to a character. Show Answer Correct Answer: C) No Special meaning to a character. 11. What is the default mode in which a file is opened using open()? A) Write. B) Append. C) Read. D) Exclusive. Show Answer Correct Answer: C) Read. 12. ..... file is used to transfer data from one application to another A) Text. B) Binary. C) CSV. D) None. Show Answer Correct Answer: A) Text. 13. Which method is used to deserialize object from binary file? A) Dump(). B) Unpickle(). C) Load(). D) Readobj(). Show Answer Correct Answer: C) Load(). 14. Apa yang terjadi apabila user mencoba membuka file yang tidak tersedia dengan menggunakan fungsi open() dan mode "x" ? A) Program akan memunculkan Error berupa FileNotFoundError. B) Program akan memunculkan Error berupa FileExistsError. C) Program akan mengembalikan string kosong. D) Program akan membuat file baru sesuai filepath yang diminta. Show Answer Correct Answer: D) Program akan membuat file baru sesuai filepath yang diminta. 15. How can you write data to a file in binary mode? A) Use open('filename', 'r') to write binary data. B) Use open('filename', 'wb') to write binary data. C) Use open('filename', 'w') to write binary data. D) Use open('filename', 'ab') to write binary data. Show Answer Correct Answer: B) Use open('filename', 'wb') to write binary data. 16. The separator character which is used in csv file is called as ..... A) Delimiter. B) Semicolon. C) Colon. D) Tab space. Show Answer Correct Answer: A) Delimiter. 17. What is the default mode of opening a file in Python? A) A. B) R. C) W. D) X. Show Answer Correct Answer: B) R. 18. Which of the following is a benefit of using the 'with' statement for file operations? A) It automatically deletes the file after use. B) It automatically handles opening and closing the file. C) It allows multiple files to be opened simultaneously. D) It prevents the file from being modified. Show Answer Correct Answer: B) It automatically handles opening and closing the file. 19. Which of the following is not a file handling method A) Read. B) Write. C) Append. D) Remove. Show Answer Correct Answer: D) Remove. 20. What does the "x" mode do when opening a file in Python? A) Creates the specified file, error if the file does not exist. B) Creates the specified file, appends to the file if it exists. C) Creates the specified file, truncates the file first. D) Creates the specified file, returns an error if the file exists. Show Answer Correct Answer: D) Creates the specified file, returns an error if the file exists. 21. Can we read file without opening. (T/F) A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 22. What method is used to read all lines from a text file at once? A) Readlines(). B) Readfile(). C) Fetchlines(). D) Getlines(). Show Answer Correct Answer: A) Readlines(). 23. How do you write "Hello, world!" to a file in Python? A) File.writeText("Hello, world!"). B) File.write("Hello, world!"). C) File.writelines("Hello, world!"). D) File.save("Hello, world!"). Show Answer Correct Answer: B) File.write("Hello, world!"). 24. Try:a=10/5 print (a) except ArithmeticError:print ("This statement is raising an exception" )finally:print (" final block executed '' ) A) 2.0 final block executed. B) This statement is raising an exceptionfinal block executed. C) Final block executed. D) 2.0. Show Answer Correct Answer: A) 2.0 final block executed. 25. A collection of characters that is written or read during file handling in C++ is called A) Variable. B) Stream. C) Bits. D) Numbers. Show Answer Correct Answer: B) Stream. ← 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