This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 27 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 27 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which of the following is NOT a function mentioned in the literacy section? A) Close. B) Write. C) Delete. D) Read. Show Answer Correct Answer: C) Delete. 2. What role does the file system play in an operating system? A) The file system manages data storage, organization, and access in an operating system. B) The file system provides user interface elements in an operating system. C) The file system manages network connections in an operating system. D) The file system controls hardware performance in an operating system. Show Answer Correct Answer: A) The file system manages data storage, organization, and access in an operating system. 3. What is the significance of the 'Boolean variable' in the Python file handling examples? A) It indicates the file size. B) It indicates the file type. C) It indicates the file name. D) It indicates the end of the file. Show Answer Correct Answer: D) It indicates the end of the file. 4. What does the csv.writerow() function do? A) Writes a single row to a csv file. B) Reads a single row from a csv file. C) Deletes a row from a csv file. D) Appends a row to a csv file. Show Answer Correct Answer: A) Writes a single row to a csv file. 5. What is the file mode 'r' in Python A) Read Mode. B) Write Mode. C) Append Mode. D) None of the above. Show Answer Correct Answer: A) Read Mode. 6. What will file.read() return? A) A list of lines. B) The entire file content as a string. C) One character. D) Nothing. Show Answer Correct Answer: B) The entire file content as a string. 7. What happens if a file opened with 'ofstream' already exists? A) The file is overwritten. B) The file is appended. C) The file is deleted. D) A new file is created with a different name. Show Answer Correct Answer: A) The file is overwritten. 8. What are the two valid keywords used for an exception? A) Run:iferror:. B) Try:except:. C) Try:catch:. D) Try:iferror:. Show Answer Correct Answer: B) Try:except:. 9. 5 'try' block is used to A) Execute a code. B) Through the exceptions. C) To try some random code. D) To give errors. Show Answer Correct Answer: B) Through the exceptions. 10. In f=open("fun.txt", 'r'), 'r' refers to ..... A) File pointer. B) File mode. C) File object. D) File name. Show Answer Correct Answer: B) File mode. 11. How do you create a new directory in Python? A) Create directory('new directory name'). B) Os.mkdir('new directory name'). C) Os.create('new directory name'). D) Make directory('new directory name'). Show Answer Correct Answer: B) Os.mkdir('new directory name'). 12. A variable defined inside the def() we called as A) Global. B) Enclosing. C) Local. D) Local to def(). Show Answer Correct Answer: D) Local to def(). 13. What is the output of the following code?def greet(name="Guest"):print(f"Hello, \{name\}!")greet("Alice")greet() A) Hello, Guest! Hello, Alice!. B) Hello, Alice! Hello, Guest!. C) Hello, Guest! Hello, Guest!. D) Error due to missing argument. Show Answer Correct Answer: A) Hello, Guest! Hello, Alice!. 14. What is the purpose of saving data to a file in a program? A) To increase the speed of the program. B) To store data temporarily in memory. C) To make the data disappear after the program ends. D) To ensure data persists after the program has finished. Show Answer Correct Answer: D) To ensure data persists after the program has finished. 15. What is the output of:x = ["apple", "banana"]print("banana" in x) A) 1. B) True. C) False. D) 2. Show Answer Correct Answer: B) True. 16. Address stored in the pointer variable is of type. A) Declared. B) Initialized. C) Both declared and initialized. D) Not both declared and initialized. Show Answer Correct Answer: C) Both declared and initialized. 17. The ..... enables you to write or read data in a position wherever you want. A) Random Access. B) Read Only. C) All the above. D) None of the above. Show Answer Correct Answer: A) Random Access. 18. What is the role of the 'pickle' module in data serialization? A) The 'pickle' module is used for data visualization in Python. B) The 'pickle' module encrypts data for secure storage. C) The 'pickle' module is a database management tool for Python. D) The 'pickle' module facilitates data serialization by converting Python objects to byte streams and vice versa. Show Answer Correct Answer: D) The 'pickle' module facilitates data serialization by converting Python objects to byte streams and vice versa. 19. How can you read a binary file in Python? A) Use open('filename', 'r') to read a binary file in Python. B) Read the file using open('filename', 'text') for binary data. C) Use open('filename', 'wb') to read a binary file in Python. D) Use open('filename', 'rb') to read a binary file in Python. Show Answer Correct Answer: D) Use open('filename', 'rb') to read a binary file in Python. 20. What does the 'os.path.split()' function return? A) The directory name and base name as a tuple. B) The size of the file. C) The file extension. D) The absolute path of the file. Show Answer Correct Answer: A) The directory name and base name as a tuple. 21. ..... function without any argument removes leading and trailing whitespaces. A) Strip(). B) Lstrip(). C) Rstrip(). D) Trim(). Show Answer Correct Answer: A) Strip(). 22. Explain the difference between reading a file in text mode and binary mode. A) Text mode compresses file size, while binary mode decompresses it. B) Text mode interprets file content as human-readable text, while binary mode reads raw bytes without decoding. C) Text mode converts all characters to uppercase, while binary mode keeps the original case. D) Text mode reads files in reverse order, while binary mode reads them sequentially. Show Answer Correct Answer: B) Text mode interprets file content as human-readable text, while binary mode reads raw bytes without decoding. 23. Which function is used to write data in binary file? A) Pickle.save(). B) Pickle.dump(). C) Pickle.write(). D) Pickle.put(). Show Answer Correct Answer: B) Pickle.dump(). 24. Java is a A) Procedure Oriented Language. B) Structure Oriented Language. C) Object Oriented Language. D) Machine Language. Show Answer Correct Answer: C) Object Oriented Language. 25. In a file, user want to add and write the data means, he want to open the file in ..... , , , mode A) A+. B) W+. C) R+. D) All these. Show Answer Correct Answer: A) A+. ← 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