This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 38 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 38 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which mode in Python is used to open a file for append? A) W. B) A. C) R. D) X. Show Answer Correct Answer: B) A. 2. How can you read data from a binary file? A) Use a text editor to view the binary file directly. B) Open the file in text mode and read it line by line. C) Convert the binary file to a CSV format before reading. D) Open the file in binary mode, read the data into a buffer, and process it. Show Answer Correct Answer: D) Open the file in binary mode, read the data into a buffer, and process it. 3. What method is used to read the entire content of a file in Python? A) Close(). B) Write(). C) Read(). D) Open(). Show Answer Correct Answer: C) Read(). 4. N= int(input("Please enter an integer: "))if n < 0:raise Exception (" Only Positive Numbers are Allowed ") print ("Great, you successfully entered an integer!")what is the output if the given input is-12 A) Great, you successfully entered an integer!. B) Only Positive Numbers are Allowed. C) Only Positive Numbers are Allowed Great, you successfully entered an integer!. D) None of the above Option. Show Answer Correct Answer: B) Only Positive Numbers are Allowed. 5. ..... is used to read and write data to a file on disk. A) File Object. B) Raw String. C) Modes. D) Nono of this. Show Answer Correct Answer: A) File Object. 6. What will be the output of print(5/0)? A) NaN. B) Infinity. C) 5. D) ZeroDivisionError. Show Answer Correct Answer: D) ZeroDivisionError. 7. What are the two built-in functions to read a line of text from standard input, which is by default the keyboard? A) Input. B) Read. C) Scanner. D) None of the above. Show Answer Correct Answer: A) Input. 8. You need to be on "r" mode in order to read from a file. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 9. This method replaces a string with another string. A) Upper(). B) Lower(). C) Strip(). D) Replace(). Show Answer Correct Answer: D) Replace(). 10. Which of the following function is used to open the file in python file handling? A) Open(). B) Unlock(). C) Unfold(). D) Extend(). Show Answer Correct Answer: A) Open(). 11. What is the difference between a module and a package in Python? A) Modules are collections of packages. B) Packages are collections of modules. C) Packages contain a single module. D) There is no difference. Show Answer Correct Answer: B) Packages are collections of modules. 12. What does the function add ..... two(a, b) do? A) It takes two numbers and returns their sum. B) It subtracts two numbers. C) It multiplies two numbers. D) It divides two numbers. Show Answer Correct Answer: A) It takes two numbers and returns their sum. 13. Assertion:Exception handling handles all types of errors and exceptions.Reasoning:Exception handling is responsible for handling anomalous situations during the execution of a program. A) Both A and R are true and R is the correct explanation of A. B) Both A and R are true and R is not the correct explanation of A. C) Assertion is True but the Reason is False. D) Both the Assertion and Reason is False. Show Answer Correct Answer: A) Both A and R are true and R is the correct explanation of A. 14. How do you open a file in Python? A) Write(). B) Close(). C) Open(). D) Read(). Show Answer Correct Answer: C) Open(). 15. Which mode is used to open binary file in write read mode A) Rw+. B) Rwb+. C) Wb+. D) Rb+. Show Answer Correct Answer: C) Wb+. 16. What is the main advantage of using binary files over text files? A) Efficiency in storage and processing speed. B) Higher level of security for sensitive data. C) Easier to edit and modify the content. D) Better compatibility with different operating systems. Show Answer Correct Answer: A) Efficiency in storage and processing speed. 17. What parameter is used to append to a file in Python? A) A. B) R. C) W. D) B. Show Answer Correct Answer: A) A. 18. What is the purpose of the program described in the video? A) To write data to a text file. B) To create a connection between two programs. C) To play a text-based game. D) To demonstrate basic file handling operations. Show Answer Correct Answer: D) To demonstrate basic file handling operations. 19. ..... to read the remaining lines of the file from a file object infi we use ..... A) Infi.readline(). B) Infi.readlines(). C) Infi.read(). D) Infi.read(all). Show Answer Correct Answer: B) Infi.readlines(). 20. The sys.stdout is always opened in ..... mode. A) Read. B) Write. C) Append. D) Read and Write. Show Answer Correct Answer: B) Write. 21. An ..... allows multiple items to be stored under one variable name, this reduces the need for multiples variables. A) Variable. B) Array. C) Constant. D) None of the above. Show Answer Correct Answer: B) Array. 22. What is the output of the divmod(15, 4) function in Python? A) (4, 3). B) 3.75. C) (3, 1). D) 4. Show Answer Correct Answer: C) (3, 1). 23. Which of the following is nor a proper file access mode? A) Close. B) Read. C) Write. D) Append. Show Answer Correct Answer: A) Close. 24. What type of loop is ideal for processing a file when the number of lines is unknown? A) Count controlled loop. B) Infinite loop. C) Condition-controlled loop. D) Nested loop. Show Answer Correct Answer: C) Condition-controlled loop. 25. Which of the following is not an exception handling keyword in Python? A) Accept. B) Finally. C) Try. D) Except. Show Answer Correct Answer: A) Accept. ← 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