This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 18 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 18 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. To remove the spaces present at start and end of the string, you can use A) Split(). B) Len(). C) Strip(). D) Remove(). Show Answer Correct Answer: C) Strip(). 2. What is the purpose of using 'rb' mode when opening a binary file in Python? A) It indicates that the file is being opened in write mode for binary data. B) It signifies that the file is being opened in append mode for binary data. C) It specifies that the file is being opened in read mode for text data. D) It signifies that the file is being opened in read mode specifically for binary data. Show Answer Correct Answer: D) It signifies that the file is being opened in read mode specifically for binary data. 3. How can programs ensure that data is not lost when they are closed? A) By using temporary variables. B) By storing data in external files. C) By deleting unused data. D) By ignoring data preservation. Show Answer Correct Answer: B) By storing data in external files. 4. Which file contains information in the same format as it is stored in memory? A) Text File. B) Binary File. C) CSV File. D) All Files. Show Answer Correct Answer: B) Binary File. 5. Delimiters, such as (, :; \t | ) are present in A) Text file. B) CSV files. C) Binary files. D) All of the above. Show Answer Correct Answer: B) CSV files. 6. Which method would you use to read a file line by line in Python? A) Read(). B) Readline(). C) Readlines(). D) Readfile(). Show Answer Correct Answer: B) Readline(). 7. In seek()-mode 1 will indicate. A) Current Position of File. B) EOF. C) BOF. D) Pointer Value. Show Answer Correct Answer: A) Current Position of File. 8. What is the purpose of the 'close()' method? A) To write data to a file. B) To open a file. C) To read data from a file. D) To terminate all resources in use. Show Answer Correct Answer: D) To terminate all resources in use. 9. It describe how to access a given file or directory, starting from the root of the file system. A) Relative file path. B) Absolute file path. C) Root file path. D) None. Show Answer Correct Answer: B) Absolute file path. 10. What does the 'WRITE' mode do when a file is opened in this mode? A) Reads data from the file. B) Writes data to the file, overwriting any existing content. C) Adds data to the end of the file. D) Reads and writes data to the file. Show Answer Correct Answer: B) Writes data to the file, overwriting any existing content. 11. What are some common exceptions that can occur during file operations in Python? A) ValueError. B) FileNotFoundError, PermissionError, IOError, OSError. C) IndexError. D) SyntaxError. Show Answer Correct Answer: B) FileNotFoundError, PermissionError, IOError, OSError. 12. Abhishek and Adivya are working on a project that involves reading data from a CSV file. They need to skip the header row to process the data correctly. How can they achieve this? A) Set skip header=True in csv.reader(). B) Use next() before iterating over rows. C) Both a and b. D) Use csv.Sniffer() to detect headers. Show Answer Correct Answer: B) Use next() before iterating over rows. 13. How can you check if a file exists at a specified path in Python? A) Import osfile path = 'path/to/file'if os.path.exists(file path):print('File exists')else:print('File does not exist'). B) Verify file existence with 'file exists' method. C) Use the 'check file' function. D) Check the file using 'file check' module. Show Answer Correct Answer: A) Import osfile path = 'path/to/file'if os.path.exists(file path):print('File exists')else:print('File does not exist'). 14. Which module in Python is used to process csv file A) Pickle. B) Random. C) CSV. D) Csv.reader(). Show Answer Correct Answer: C) CSV. 15. What is the primary purpose of file handling in Python? A) To manage memory allocation. B) To create graphical user interfaces. C) To save data for further use. D) To display data on the console. Show Answer Correct Answer: C) To save data for further use. 16. What modules can be used for binary and CSV file operations in Python? A) Pandas. B) Numpy. C) Os. D) Struct, csv. Show Answer Correct Answer: D) Struct, csv. 17. How can you handle errors in file operations in Python? A) Use try-except blocks to handle specific errors that may occur during file operations. B) Ignore errors that occur during file operations. C) Use if-else statements to handle errors in file operations. D) Handle errors by restarting the Python interpreter. Show Answer Correct Answer: A) Use try-except blocks to handle specific errors that may occur during file operations. 18. Internal translations takes place in ..... files A) Text. B) Binary. C) Csv. D) All. Show Answer Correct Answer: A) Text. 19. The ..... device able to read an error message. A) Stdout. B) Stdin. C) Stderr. D) None of this. Show Answer Correct Answer: C) Stderr. 20. Which function is used to open a file in C? A) Fopen(). B) Openfile(). C) Fileopen(). D) Open(). Show Answer Correct Answer: A) Fopen(). 21. Which module is required to use function dump()? A) Math. B) Flush. C) Pickle. D) Unpickle. Show Answer Correct Answer: C) Pickle. 22. When Reading from text files, which of the following should appear in the loop? A) READFILE. B) OPENFILE. C) DECLARE. D) READ. Show Answer Correct Answer: A) READFILE. 23. Which of the following is not a valid mode to open a text file? A) Ab. B) R+. C) W+. D) R. Show Answer Correct Answer: A) Ab. 24. What mode should be used to write to a binary file? A) Wb. B) Rb. C) Wbx. D) Ab. Show Answer Correct Answer: A) Wb. 25. The ..... function removes the given character from trailing left ends. A) Strip(). B) Lstrip(). C) Rstrip(). D) All these. Show Answer Correct Answer: B) Lstrip(). ← 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