This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 12 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 12 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which file type is more secure? A) Csv file. B) Text file. C) Binary file. D) All of the above. Show Answer Correct Answer: C) Binary file. 2. Which function returns the current position of file pointer? A) Tell(). B) Seek(). C) Position(). D) Getpos(). Show Answer Correct Answer: A) Tell(). 3. Which PHP function is used to open a file for reading or writing? A) File open(). B) Open file(). C) Fopen(). D) File(). Show Answer Correct Answer: C) Fopen(). 4. What is involved in the process of writing to a file? A) Deleting data from a file. B) Reading data from a file. C) Adding data to a file. D) Creating a new file. Show Answer Correct Answer: C) Adding data to a file. 5. Files are kept in secondary storage A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: A) TRUE. 6. Expand CSV A) Code separated values. B) Comma separated values. C) Comma Sequence value. D) Code sequence value. Show Answer Correct Answer: B) Comma separated values. 7. A function can return A) Only single value. B) Cant return any value. C) It can return multiple values. D) Returns 0. Show Answer Correct Answer: C) It can return multiple values. 8. What will be the output of following codevoid main \{ ofstream out ..... obj; out ..... obj.open ("abc.txt"); out ..... obj << "MOOCS" << endl;cout << "Data written to file" << endl;out ..... obj.close(); \} A) Compile error. B) Program will print "written to file". C) Program will write "MOOCS" into abc.txt. D) None of the above. Show Answer Correct Answer: C) Program will write "MOOCS" into abc.txt. 9. Which of these packages contain classes and interfaces used for input & output operations of a program? A) Java.util. B) Java.lang. C) Java.io. D) All of the mentioned. Show Answer Correct Answer: C) Java.io. 10. What is the actual use of ofstream? A) It helps to switch off the streams. B) It help to write on the file. C) It helps to read from file. D) It allows to both read and write on the file. Show Answer Correct Answer: B) It help to write on the file. 11. Which method is used to open a file in Python? A) Append(). B) Write(). C) Read(). D) Open(). Show Answer Correct Answer: D) Open(). 12. A logical group of related objects are known as A) Memory. B) Global space. C) Local space. D) Namespace. Show Answer Correct Answer: D) Namespace. 13. What method is used to open a file in Python? A) Open(). B) ReadFile(). C) LoadFile(). D) FileOpen(). Show Answer Correct Answer: A) Open(). 14. ..... In this type of file, there is no terminator for a line and the data is stored after converting it into machine understandable binary language. A) Character Files. B) Binary Files. C) Text Files. D) Bin File. Show Answer Correct Answer: B) Binary Files. 15. What is the last thing you should do to a file? A) Read. B) Write. C) Save. D) Close. Show Answer Correct Answer: D) Close. 16. Which attribute provides information about a file object in Python? A) File Object Attributes. B) File Positions. C) Seek() function. D) Writelines() method. Show Answer Correct Answer: A) File Object Attributes. 17. What does the program that reads from a file do? A) Prints the contents of the file. B) Writes data to the file. C) Checks for end of file. D) Opens a file. Show Answer Correct Answer: A) Prints the contents of the file. 18. What is the default mode for opening a file in Python? A) W. B) A. C) R. D) X. Show Answer Correct Answer: C) R. 19. Apa yang dilakukan fungsi fclose? A) Membuka file. B) Menutup file. C) Membaca data dari file. D) Menulis data ke file. Show Answer Correct Answer: B) Menutup file. 20. Can you read a CSV file using the same method as reading a text file in Python? A) Sometimes. B) Maybe. C) No. D) Yes. Show Answer Correct Answer: D) Yes. 21. How do you read a single line from a file using Python? A) Line = open('filename.txt').read(). B) Line = open('filename.txt').readline(0). C) Line = open('filename.txt').readlines(). D) Line = open('filename.txt').readline(). Show Answer Correct Answer: D) Line = open('filename.txt').readline(). 22. Apa yang dilakukan mode "a" saat membuka file? A) Menghapus isi file. B) Menambahkan data ke akhir file. C) Membaca data dari file. D) Menulis data baru ke file. Show Answer Correct Answer: B) Menambahkan data ke akhir file. 23. When we open file in reading mode the initial position of the cursor is- A) 0. B) After the last written word. C) Middle of the file. D) None. Show Answer Correct Answer: A) 0. 24. What is the purpose of the 'with' statement when opening files? A) To write files in append mode. B) To read files in binary mode. C) To open multiple files at once. D) To ensure the file is closed automatically. Show Answer Correct Answer: D) To ensure the file is closed automatically. 25. Which of the following is NOT a valid file mode in Python? A) W. B) D. C) A. D) R. Show Answer Correct Answer: B) D. ← 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