This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 37 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 37 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which of the following statements is/are true? A) When you open a file for reading, if the file does not exist, an error occurs. B) When you open a file for writing, if the file does not exist, a new file is created. C) When you open a file for writing, if the file exists, the existing file is overwritten with the new file. D) All of the above. Show Answer Correct Answer: D) All of the above. 2. The default file open mode is ..... mode A) Read. B) Write. C) Append. D) None. Show Answer Correct Answer: A) Read. 3. A structure can contain: A) Arrays. B) Pointers. C) Other structures. D) All. Show Answer Correct Answer: D) All. 4. How does the 'continue' statement affect the flow of a loop in C++? A) Terminates the loop immediately. B) Skips the current iteration and proceeds with the next one. C) Pauses the loop temporarily. D) None of the above. Show Answer Correct Answer: B) Skips the current iteration and proceeds with the next one. 5. What is the use of the 'open()' function in file handling? A) To initialize a variable. B) To open a file for reading or writing. C) To create a new directory. D) To close a file. Show Answer Correct Answer: B) To open a file for reading or writing. 6. Apa yang dilakukan fungsi fwrite? A) Membaca data dari file. B) Menulis blok data ke file. C) Menutup file. D) Menghapus file. Show Answer Correct Answer: B) Menulis blok data ke file. 7. When is the finally block executed? A) When an exception occurs. B) When no exception occurs. C) Never. D) Always. Show Answer Correct Answer: D) Always. 8. What is the purpose of the 'ofstream' class in C++? A) To handle standard input. B) To handle standard output. C) To write data to a file. D) To read data from a file. Show Answer Correct Answer: C) To write data to a file. 9. The correct syntax for converting the string x to uppercase is: A) X.upper(). B) Upper(x). C) X.UPPER[ ]. D) X.upper(). Show Answer Correct Answer: A) X.upper(). 10. Which of these class is highest in hierarchy in java A) Java.lang.Exception. B) Java.lang.Error. C) Java.lang.Throwable. D) Java.lang.Object. Show Answer Correct Answer: D) Java.lang.Object. 11. How do you open a binary file in Python? A) Open('filename', 'rb'). B) Open('filename', 'a'). C) Open('filename', 'r'). D) Open('filename', 'wb'). Show Answer Correct Answer: A) Open('filename', 'rb'). 12. Which of the following mode argument is used to truncate? A) R. B) W. C) A. D) All of the above. Show Answer Correct Answer: B) W. 13. Can one except block handle multiple exceptions? A) Yes. B) No. C) May be. D) Insufficient information. Show Answer Correct Answer: A) Yes. 14. During a school project, Reyansh, Taran, and Tanisha need to save their data into a CSV file. Which method should they use to write multiple rows in one call? A) Writeall(). B) BulkInsert(). C) AddRows(). D) Writerows(). Show Answer Correct Answer: D) Writerows(). 15. Differentiate between a text file and a binary file in C++. A) A text file is always larger in size than a binary file. B) A text file can only be opened in read mode, while a binary file can only be opened in write mode. C) A text file contains human-readable characters, while a binary file contains machine-readable data in the form of 0s and 1s. D) A text file contains only numbers, while a binary file contains only letters. Show Answer Correct Answer: C) A text file contains human-readable characters, while a binary file contains machine-readable data in the form of 0s and 1s. 16. Why we use file handling? A) To create folders. B) To store input output data temporarily. C) It facilitates us to cut, copy, paste files. D) To store input output data permanently. Show Answer Correct Answer: D) To store input output data permanently. 17. How do you read specific columns from a CSV file using pandas? A) Import pandas as pddf = pd.read csv('file.csv', usecols=['column1', 'column2']). B) Df = pd.read csv('file.csv', select=['column1', 'column2']). C) Df = pd.read csv('file.csv', readcols=['column1', 'column2']). D) Df = pd.read csv('file.csv', columns=['column1', 'column2']). Show Answer Correct Answer: A) Import pandas as pddf = pd.read csv('file.csv', usecols=['column1', 'column2']). 18. Which keyword creates a structure? A) Struct. B) Structure. C) Record. D) Class. Show Answer Correct Answer: A) Struct. 19. File in python is treated as sequence of ..... ? A) Bytes. B) Bites. C) All the above. D) None of the above. Show Answer Correct Answer: A) Bytes. 20. A variable defined between two functions A) Nested variable. B) Local variable. C) Formal variable. D) Enclosed Variable. Show Answer Correct Answer: D) Enclosed Variable. 21. What will be the position of File pointer after executing the following command?F.seek(-10, 2) A) 10 Characters ahead from beginning of the file. B) 10 Characters ahead from current position of the file pointer. C) 10 Characters behind from current position of the file pointer. D) 10 Characters behind from end of the file. Show Answer Correct Answer: D) 10 Characters behind from end of the file. 22. What is the Output of following program#include int fun(int n)\{ static int s = 0; s = s + n; return (s); \}int main()\{ int i = 10, x; while (i > 0) \{ x = fun(i); i ..... ; \} printf ("%d ", x); return 0; \} A) 0. B) 100. C) 110. D) 55. Show Answer Correct Answer: D) 55. 23. What is the purpose of the fopen() function in PHP? A) To create a new directory. B) To delete a file. C) To close an open file. D) To open a file for reading or writing. Show Answer Correct Answer: D) To open a file for reading or writing. 24. What type of file contains only ASCII code? A) Binary files. B) Text files. C) Image files. D) Executable files. Show Answer Correct Answer: B) Text files. 25. What is the purpose of the 'F' variable in the Python file handling examples? A) To store the file contents. B) To store the file name. C) To store the file type. D) To store the file size. Show Answer Correct Answer: A) To store the file contents. ← 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