This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 30 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 30 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What method would you use to write a list of strings to a file? A) Use the 'write()' method to append strings to the file. B) Employ the 'save()' method to store strings in a database. C) Use the 'writelines()' method after opening the file in write mode. D) Utilize the 'print()' function to display strings on the console. Show Answer Correct Answer: C) Use the 'writelines()' method after opening the file in write mode. 2. In seek () you can move the file pointer in forward direction with the help of ..... values A) Positive values. B) Negative Values. C) None Value. D) Zero Value. Show Answer Correct Answer: A) Positive values. 3. What are the different modes of opening a file using Fileoutputstream in Java? A) Delete mode. B) 1. Create mode 2. Append mode. C) Update mode. D) Read mode. Show Answer Correct Answer: B) 1. Create mode 2. Append mode. 4. ..... helps in storing information. A) Files. B) Pictures. C) Data's. D) Hard Disk. Show Answer Correct Answer: A) Files. 5. Fungsi apa yang digunakan untuk menulis data terformat ke file? A) Fscanf. B) Fprintf. C) Fread. D) Fwrite. Show Answer Correct Answer: B) Fprintf. 6. What function is used to write a list of dictionaries to a csv file in Python? A) Csv.write dicts. B) Csv.writer. C) Writecsvdict(). D) Dicts to csv(). Show Answer Correct Answer: B) Csv.writer. 7. What does the '.write' method do? A) Deletes data from a file. B) Opens a file for writing. C) Reads data from a file. D) Writes data to a file. Show Answer Correct Answer: D) Writes data to a file. 8. Which memory is volatile memory? A) RAM. B) Hard Disk. C) CD. D) Pen drive. Show Answer Correct Answer: A) RAM. 9. A 1D array declaration can be written as: A) DECLARE StudMark:ARRAY[0:4] OF INTEGER. B) DECLARE StudMark:ARRAY[0, 4] OF INTEGER. C) DECLARE:ARRAY[0, 4] OF INTEGER. D) DECLARE StudMark:[0, 4] OF INTEGER. Show Answer Correct Answer: A) DECLARE StudMark:ARRAY[0:4] OF INTEGER. 10. What is the function "r" in file handling A) Read. B) Write. C) Append. D) None of the above. Show Answer Correct Answer: A) Read. 11. The following is an example of what type of error?prnt("Hello World") A) Syntax Error. B) Run-time Error. C) Semantic Error. D) None of the above. Show Answer Correct Answer: A) Syntax Error. 12. The default delimiter of the CSV file is ..... A) Tab. B) Comma. C) Colon. D) Filter. Show Answer Correct Answer: B) Comma. 13. Which of the following option is the correct Python statement to read and display the first 10 characters of a text file "Notes.txt" ? A) F =open('Notes.txt'); print(F.load(10)). B) F =open('Notes.txt'); print(F.dump(10)). C) F = open('Notes.txt'); print(F.read(10)). D) F =open('Notes.txt'); print(F.write(10)). Show Answer Correct Answer: C) F = open('Notes.txt'); print(F.read(10)). 14. What is the result of calling add ..... two(10, -5)? A) 5. B) 15. C) Error. D) None. Show Answer Correct Answer: A) 5. 15. What will happen if you try to open a non-existent file in "r" mode? A) A new file is created. B) The file is opened with no error. C) The program will raise a FileNotFoundError. D) The file will be created and opened. Show Answer Correct Answer: C) The program will raise a FileNotFoundError. 16. Differentiate between binary, CSV, and text files in Python. A) Binary files store data in a tabular format separated by commas. B) Text files store data in a binary format. C) CSV files contain data in a format that is not human-readable. D) Binary files contain data in a format that is not human-readable, CSV files store tabular data separated by commas, and text files store data as plain text without any specific formatting. Show Answer Correct Answer: D) Binary files contain data in a format that is not human-readable, CSV files store tabular data separated by commas, and text files store data as plain text without any specific formatting. 17. What does setting a Boolean variable to false indicate in file handling? A) File is empty. B) End of the file is reached. C) File is corrupted. D) End of the file is not reached. Show Answer Correct Answer: D) End of the file is not reached. 18. Which of the following packages contain classes and interfaces used for input & output operations of file? A) Java.util. B) Java.io. C) Java.lang. D) Java.net. Show Answer Correct Answer: B) Java.io. 19. What does calloc() do in C programming? A) Allocates memory and initializes it to zero. B) Allocates memory without initialization. C) Frees allocated memory. D) Resizes allocated memory. Show Answer Correct Answer: A) Allocates memory and initializes it to zero. 20. Which method is used to close the Stream? A) Close();. B) Flush();. C) Null();. D) Final();. Show Answer Correct Answer: A) Close();. 21. Ravi opened the file myfile.txt in append mode. In this file the file object/file handle will be at the ..... A) Beginning of the file. B) End of the file. C) Second line of the file. D) The end of the first line. Show Answer Correct Answer: B) End of the file. 22. What is the purpose of the 'data dependency' in the context of file handling? A) To separate data into different files. B) To ensure data is encrypted in the file. C) To compress the data in the file. D) To specify the order of data in the file. Show Answer Correct Answer: D) To specify the order of data in the file. 23. Which of the following operator is used for negation? A) !. B) Not. C) Both ! & not. D) None. Show Answer Correct Answer: C) Both ! & not. 24. How can you read only part of a file? A) Deleting parts of the file first. B) Opening the file in 'write' mode. C) By specifying the number of characters in the 'read()' function. D) Using the 'write()' function. Show Answer Correct Answer: C) By specifying the number of characters in the 'read()' function. 25. What does the exists() method check for a Path object? A) If the path is an absolute path. B) If the path points to a valid file or directory. C) All the above. D) None of the above. Show Answer Correct Answer: B) If the path points to a valid file or directory. ← 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