This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 54 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 54 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. How can you ensure user input is treated as a string? A) Use the int() function to convert input to an integer. B) Use the input() function without conversion. C) Use the str() function to convert input to a string. D) Store input in a variable without any changes. Show Answer Correct Answer: C) Use the str() function to convert input to a string. 2. What is the correct syntax of open() function? A) File name = open(file name [, access mode][, buffering]). B) File object = open(file name [, access mode][, buffering]). C) File object = open(file name). D) None of the above. Show Answer Correct Answer: B) File object = open(file name [, access mode][, buffering]). 3. Apa yang harus dilakukan setelah selesai menggunakan file? A) Menghapus file. B) Menutup file. C) Membaca file. D) Menulis data ke file. Show Answer Correct Answer: B) Menutup file. 4. Which exception is raised when a file is not found? A) IOError. B) ValueError. C) FileNotFoundError. D) ImportError. Show Answer Correct Answer: C) FileNotFoundError. 5. If you append something to a file it will appear: A) At the start of the file. B) At the end of the file. C) All the above. D) None of the above. Show Answer Correct Answer: B) At the end of the file. 6. What are the different file access methods? A) Sequential Access, Direct Access, Random Access. B) Stream Access. C) Buffered Access. D) File Access Method. Show Answer Correct Answer: A) Sequential Access, Direct Access, Random Access. 7. Full form of CSV file is ..... A) Comma Separated Vault. B) Comma Separated Value. C) Common Separated Value. D) Common System Value. Show Answer Correct Answer: B) Comma Separated Value. 8. Which is the correct syntax to open text file? A) Ofstreamobj.open(abc.txt);. B) Ofstreamobj::open( "abc.txt" );. C) Ofstreamobj.open( "abc.txt" );. D) Ofstreamobj:open( "abc.txt" );. Show Answer Correct Answer: B) Ofstreamobj::open( "abc.txt" );. 9. What is the purpose of using binary files? A) To store data in a human-readable format. B) To store data in its original format. C) To create text files. D) To compress data. Show Answer Correct Answer: B) To store data in its original format. 10. Which of the following is a correct way to create a new directory using pathlib? A) Path('new folder').mkdir(). B) Os.makedirs('new folder'). C) Os.mkdir('new folder'). D) Path('new folder').makedirs(). Show Answer Correct Answer: A) Path('new folder').mkdir(). 11. How can you append data to an existing file? A) Open the file in write mode and overwrite the data. B) Open the file in append mode and write the data. C) Delete the existing file and create a new one with the data. D) Open the file in read mode and write the data. Show Answer Correct Answer: B) Open the file in append mode and write the data. 12. To read from a file in python, which of the following is incorrect A) Filehandle.read([n]). B) Filehandle.readline([n]). C) Filehandle.readlines([n]). D) Filehandle.readlines([n]). Show Answer Correct Answer: C) Filehandle.readlines([n]). 13. What exception is raised if you try to open a file that does not exist in read mode? A) FileReadError. B) FileNotFoundError. C) FileMissingException. D) FileAccessError. Show Answer Correct Answer: B) FileNotFoundError. 14. The method to get the current position of the file marker. A) Tell(). B) Told(). C) Told(. D) Tell(. Show Answer Correct Answer: A) Tell(). 15. What is the code to open a file named as Updated ..... Data for output and move the read/write control to the end of the file? A) Open("Updated Data.dat" | ios::ate). B) Open("Updated Data.dat", ios::ate). C) Open("Updated Data.dat" && ios::ate). D) Open("Updated Data.dat" $ $ ios::ate). Show Answer Correct Answer: B) Open("Updated Data.dat", ios::ate). 16. Select the most appropriate format for load function. A) =pickle.load(). B) =pickle.load():. C) =pickle.load(). D) =pickle.load():. Show Answer Correct Answer: A) =pickle.load(). 17. How can you handle exceptions while working with files in Python? A) Manually raise exceptions when encountering issues with files in Python. B) Use try-except blocks to catch specific exceptions like FileNotFoundError, PermissionError, etc. when working with files in Python. C) Ignore exceptions and continue with the file operations in Python. D) Use if-else statements to handle exceptions when working with files in Python. Show Answer Correct Answer: B) Use try-except blocks to catch specific exceptions like FileNotFoundError, PermissionError, etc. when working with files in Python. 18. Apa nama fungsi yang disediakan python standard library untuk membaca sebuah file txt? A) Open(). B) Read file(). C) Fetch(). D) Load(). Show Answer Correct Answer: A) Open(). 19. ..... function is used to write single row at a time. A) Writerow(). B) Writerows(). C) Writerecords(). D) Writelines(). Show Answer Correct Answer: A) Writerow(). 20. How to write binary data to a file? A) 'rb'. B) 'wb'. C) 'ab'. D) B and c. Show Answer Correct Answer: D) B and c. 21. What is the correct way to open a file for writing in Python? A) Open('file.txt', 'a'). B) Open('file.txt', 'x'). C) Open('file.txt', 'w'). D) Open('file.txt', 'r'). Show Answer Correct Answer: C) Open('file.txt', 'w'). 22. What does the 'is ..... absolute()' method check for in a Path object? A) If the path exists. B) If the path is an absolute path. C) If the path is a directory. D) If the path is valid. Show Answer Correct Answer: B) If the path is an absolute path. 23. What is the function of fputs()? A) Read a line from a fileread a character from a file. B) Write a line to a file. C) Write a character to a file. D) Read a character from a file. Show Answer Correct Answer: B) Write a line to a file. 24. The error encountered during the code being translating from human readable to machine code A) Syntax. B) Logical. C) Run time. D) All of the above. Show Answer Correct Answer: A) Syntax. 25. What type of variable can a file be considered as? A) String. B) Integer. C) File variable. D) Boolean. Show Answer Correct Answer: C) File variable. ← 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