This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 22 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 22 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the function used to get the current working directory in Python? A) Os.chdir(). B) Os.currentdir(). C) Os.getdir(). D) Os.getcwd(). Show Answer Correct Answer: D) Os.getcwd(). 2. What is the first step to read a file in Python? A) Print the file. B) Delete the file. C) Open the file. D) Rename the file. Show Answer Correct Answer: C) Open the file. 3. In Text file, each line of text is terminated with special character known as ..... A) Endl. B) Carriage Return. C) CSV. D) EOL. Show Answer Correct Answer: D) EOL. 4. The difference between 'r+' and 'w+' modes is that 'r+' empties the file first, while 'w+' does not. A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 5. What is the full form of CSV? A) Common separated value. B) Comma separated value. C) Comma secured value. D) None. Show Answer Correct Answer: B) Comma separated value. 6. What function is used to open a file in Python? A) Open(). B) FileOpen(). C) LoadFile(). D) ReadFile(). Show Answer Correct Answer: A) Open(). 7. How can you read a text file in Python? A) Read('file.txt'). B) Open('file.txt').read(). C) Open('file.txt', 'w').read(). D) Open('file.txt', 'r').read(). Show Answer Correct Answer: D) Open('file.txt', 'r').read(). 8. To read the next line of the file from a file object called F ..... H, we use A) F H.readlines(). B) F H.read(all). C) F H.readline(). D) F H.read(). Show Answer Correct Answer: C) F H.readline(). 9. To unpickle the data coming from the file ..... function of the pickle module is used. A) Pickle, load(). B) Pickle.load(). C) Pickle.load. D) Pickle:load(). Show Answer Correct Answer: B) Pickle.load(). 10. The suspicious code is put inside the A) Try Block. B) Finally Block. C) Else Block. D) Except Block. Show Answer Correct Answer: A) Try Block. 11. How do you get information from a form that is submitted using the "get" method? A) $ GET[];. B) Request.Form;. C) Request.QueryString;. D) None. Show Answer Correct Answer: A) $ GET[];. 12. File handle is another term for file name A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: B) FALSE. 13. Explain the process of reading a CSV file using the Reader function. A) Download csv file, read file line by line, convert each line to list. B) Open csv file, create csv.writer object, write data to file. C) Import csv module, open CSV file, create csv.reader object, iterate over reader object. D) Import pandas module, read csv file using pandas function. Show Answer Correct Answer: C) Import csv module, open CSV file, create csv.reader object, iterate over reader object. 14. Since Random Access Memory (RAM) is volatile which loses its data when computer is turned off, we use files for future use of the data. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 15. When you open a file for appending and if the file exist, the existing file is? A) Will be added with the new content. B) Will be erased. C) Will be overwritten. D) Will be added as a new file. Show Answer Correct Answer: A) Will be added with the new content. 16. Which of the following value is returned by read() method when end of file (EOF) is encountered? A) 1. B) -1. C) 0. D) Null. Show Answer Correct Answer: B) -1. 17. What does a single period (dot) represent in a path? A) This directory. B) The parent folder. C) All the above. D) None of the above. Show Answer Correct Answer: A) This directory. 18. Discuss the importance of closing a file after performing operations on it. A) Closing a file after performing operations on it helps release system resources and ensures data integrity and security. B) Leaving a file open improves system performance. C) Not closing a file enhances file security. D) Closing a file can lead to data loss. Show Answer Correct Answer: A) Closing a file after performing operations on it helps release system resources and ensures data integrity and security. 19. When does the finally block excecute? A) Only run if no errors happened. B) Only runs if we catch the error that occurred. C) There is no finally block. D) Always runs regardless of if error occurred. Show Answer Correct Answer: D) Always runs regardless of if error occurred. 20. What is the difference between read(10) and read()? A) Read(10) reads 10 characters and read() reads the entire content of the file and returns it in the form of a List . B) Read(10) reads 10 characters and read() reads the entire content of the file and returns it in the form of a string . C) Read(10) reads 10 characters and read() reads the entire content of the file and returns it in the form of List of String . D) All of the above. Show Answer Correct Answer: B) Read(10) reads 10 characters and read() reads the entire content of the file and returns it in the form of a string . 21. The files length can be found using the ..... function. A) Fsize(). B) Fcount(). C) Filesize(). D) Count(). Show Answer Correct Answer: C) Filesize(). 22. Which mode is used to open CSV file for writing? A) "w". B) "wb". C) "wt". D) "w+". Show Answer Correct Answer: A) "w". 23. What happens when a file is opened in write mode which is in fact not existing? A) File is automatically created. B) Error raised. C) Let's the user create one. D) A test file is automatically created. Show Answer Correct Answer: A) File is automatically created. 24. What is the function of fwrite()? A) Reads formatted input from a file. B) Writes data to a file. C) Checks for end of file. D) Renames a file. Show Answer Correct Answer: B) Writes data to a file. 25. Which operator used to compares equality? A) ==. B) =. C) <. D) >. Show Answer Correct Answer: 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