This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 23 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 23 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which of the following functions do you use to write data in the binary format using PICKLE module? A) Write. B) Output. C) Dump. D) Send. Show Answer Correct Answer: C) Dump. 2. Write the method to read from a csv file A) Read(). B) Reader(). C) Readline(). D) Readlines(). Show Answer Correct Answer: B) Reader(). 3. What is the purpose of CSV File Handling in Python? A) The purpose of CSV File Handling in Python is to read, write, and manipulate data stored in CSV files. B) CSV File Handling in Python is designed for creating 3D graphics. C) The purpose of CSV File Handling in Python is to play audio files. D) CSV File Handling in Python is used for image processing. Show Answer Correct Answer: A) The purpose of CSV File Handling in Python is to read, write, and manipulate data stored in CSV files. 4. Which of the following functions changes the position of file pointer and returns its new position? A) Flush(). B) Tell(). C) Seek(). D) Offset(). Show Answer Correct Answer: C) Seek(). 5. ..... is the other name for the file object? A) File. B) File pointer. C) File handle. D) File name. Show Answer Correct Answer: C) File handle. 6. Which logical operator is used to checks for each and every condition is true? A) And. B) Or. C) Not. D) None. Show Answer Correct Answer: A) And. 7. Files that can be read bye text editors are called A) Text. B) Editor. C) Source. D) Binary. Show Answer Correct Answer: A) Text. 8. Why is it important to close a file after operations in Python? A) To release system resources and ensure data is written properly. B) To speed up file operations. C) To save memory space. D) To increase system performance. Show Answer Correct Answer: A) To release system resources and ensure data is written properly. 9. Which of the following commands can be used to read "n" number of characters from a file using the file object ? A) File.read(n). B) N = file.read(). C) File.readline(n). D) File.readlines(). Show Answer Correct Answer: A) File.read(n). 10. How can you read a specific number of characters from a file? A) Read the entire file and then slice the string. B) Use 'file.get(n)' to retrieve characters. C) Use 'file.readline(n)' to read a specific number of characters. D) Use 'file.read(n)' after opening the file. Show Answer Correct Answer: D) Use 'file.read(n)' after opening the file. 11. What function is used to open a file in Python for writing? A) Create('filename.txt'). B) Open('filename.txt', 'w'). C) Write('filename.txt'). D) Open('filename.txt', 'r'). Show Answer Correct Answer: B) Open('filename.txt', 'w'). 12. In fopen("mystory.txt", "r"), what does the mode "r" mean? A) Read and write. B) Write only. C) Read only. D) Append to the file. Show Answer Correct Answer: C) Read only. 13. Assume that size of an integer is 32 bit. What is the output of following program?#includestruct st\{ static int x; int y;\};int main()\{ printf("%zu, sizeof(struct st)); return 0; \} A) 4. B) 8. C) Compile error. D) Runtime error. Show Answer Correct Answer: C) Compile error. 14. Which function is best to check if a file exists before opening? A) Os.path.exists(). B) F.check(). C) F.isFile(). D) File.exists(). Show Answer Correct Answer: A) Os.path.exists(). 15. We can manage (create/read/update)CSV files using A) A text editor. B) A Python program. C) A Spreadsheet application. D) All of the above. Show Answer Correct Answer: D) All of the above. 16. Which function is used to read the contents of a file in Python? A) Open. B) Close. C) Write. D) Read. Show Answer Correct Answer: D) Read. 17. What will happen if file.read() is called twice? A) Reads twice. B) Reads same content. C) Second call returns ''. D) Returns error. Show Answer Correct Answer: C) Second call returns ''. 18. This statement terminates the loop containing it. A) End statement. B) Break statement. C) Terminating statement. D) None of the above. Show Answer Correct Answer: B) Break statement. 19. Mention the data type of variable check in the following statements? a. check=f.read()b. check=f.readline()c. check=f.readlines() A) Str b. str c. list. B) List b. str c. list. C) Str b. list c. list. D) Str b. list c. str. Show Answer Correct Answer: A) Str b. str c. list. 20. What is the purpose of the 'os.path.exists()' function? A) To check if a file exists. B) To delete a file. C) To create a new file. D) To open a file. Show Answer Correct Answer: A) To check if a file exists. 21. Which of the following exception is thrown in case when the file specified for writing is not found? A) FileNotFoundException. B) IOException. C) FileInputException. D) FileException. Show Answer Correct Answer: A) FileNotFoundException. 22. What is the result of this code snippet?with open('data.txt', 'r') as f:content = f.read() print(content) A) Writes data to 'data.txt'. B) Prints the entire contents of 'data.txt'. C) Appends data to 'data.txt'. D) Deletes the contents of 'data.txt'. Show Answer Correct Answer: B) Prints the entire contents of 'data.txt'. 23. Apa yang dimaksud dengan file biner? A) File yang hanya berisi teks. B) File yang berisi data dalam format terstruktur. C) File yang tidak dapat dibaca. D) File yang hanya berisi angka. Show Answer Correct Answer: B) File yang berisi data dalam format terstruktur. 24. To read the next line of the file from a file object infi, we use: A) Infi.read(all). B) Infi.read(). C) Infi.readline(). D) Infi.readlines(). Show Answer Correct Answer: C) Infi.readline(). 25. How do you append data to an existing file in Python? A) Use open('filename', 'r') to append data to a file. B) Use open('filename', 'w') to append data to a file. C) Use open('filename', 'a') to append data to a file. D) Use open('filename', 'x') to append data to a file. Show Answer Correct Answer: C) Use open('filename', 'a') to append data to a file. ← 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