This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 4 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 4 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Apa yang akan ditampilkan jika fwrite berhasil menulis data ke file? A) Pesan kesalahan. B) Data yang ditulis. C) Tidak ada output. D) ID file. Show Answer Correct Answer: B) Data yang ditulis. 2. What does feof() check for? A) Checks for end of file. B) Checks for file errors. C) Opens a file. D) Writes data to a file. Show Answer Correct Answer: A) Checks for end of file. 3. While writing data to file using ..... mode, the previous content of existing file will be overwritten and new content will be saved. A) W. B) R. C) A. D) None. Show Answer Correct Answer: A) W. 4. What is a relative path? A) A path that specifies the location of a file relative to the current directory. B) A relative path is the absolute location of a file on the system. C) A relative path is a URL that points to a web resource. D) A relative path is a method of organizing files in a database. Show Answer Correct Answer: A) A path that specifies the location of a file relative to the current directory. 5. What is the need for data files in Python? A) To store data in RAM. B) To permanently store data for future use. C) To erase data when the program is over. D) To handle small amount of data. Show Answer Correct Answer: B) To permanently store data for future use. 6. Which of the following is NOT a characteristic of a user-defined function? A) It can be reused in the program. B) It is defined by the user. C) It is automatically available in all programs. D) It can take parameters. Show Answer Correct Answer: C) It is automatically available in all programs. 7. Return type of which of the following methods is list A) Readline. B) Writeline. C) Writelines. D) Flush. Show Answer Correct Answer: C) Writelines. 8. Select the most appropriate format of seek () A) .seek():. B) .seek(). C) seek():. D) .seek():. Show Answer Correct Answer: B) .seek(). 9. Which Tkinter widget allows users to select multiple options? A) Checkboxes. B) Radiobuttons. C) Sliders. D) Dialogs. Show Answer Correct Answer: A) Checkboxes. 10. Select the statement to open a file named MYDATA.dat in read binary mode. Let the file object name be myfile. A) Myfile=open("MYDATA.dat", "rb"). B) Myfile=open("MYDATA.dat", "r+"). C) Myfile=open("MYDATA.dat", "r"). D) None of the above. Show Answer Correct Answer: A) Myfile=open("MYDATA.dat", "rb"). 11. Fungsi mana yang digunakan untuk membaca data dari file biner? A) Fread. B) Fprintf. C) Fscanf. D) Fwrite. Show Answer Correct Answer: A) Fread. 12. Function returns the current position of file pointer in the file A) Tell(). B) Seek(). C) Read(). D) Flush(). Show Answer Correct Answer: A) Tell(). 13. What will the following code output if data.dat contains a pickled dictionary \{'A':1, 'B':2\}? import pickle with open('data.dat', 'rb') as f:data = pickle.load(f) print(data['A']) A) 1. B) 2. C) Error. D) \{'A':1, 'B':2\}. Show Answer Correct Answer: A) 1. 14. What happens if you open a file in 'write' mode? A) You can only read the file. B) The current content is deleted. C) You can add more content. D) The file becomes read-only. Show Answer Correct Answer: B) The current content is deleted. 15. Which of the following is not a valid mode to open a file? A) Ab. B) Rw. C) R+. D) W+. Show Answer Correct Answer: B) Rw. 16. What are the different modes in which you can open a file in Python? A) X. B) B. C) Z. D) 'r', 'w', 'a', 'r+', 'w+', 'a+'. Show Answer Correct Answer: D) 'r', 'w', 'a', 'r+', 'w+', 'a+'. 17. ..... and ..... statements are used to prevent an exception from terminating a program A) Try, catch. B) Try, except,. C) Try. D) Try, else. Show Answer Correct Answer: B) Try, except,. 18. What is the method to read a file line by line in Python? A) Use 'for line in read(filename):' to read a file line by line. B) Use 'file.read()' to read the entire file at once. C) Use 'open(filename).readlines()' to read a file line by line. D) Use 'with open(filename) as file:for line in file:' to read a file line by line. Show Answer Correct Answer: D) Use 'with open(filename) as file:for line in file:' to read a file line by line. 19. Which mode(s) will error if the file is not found when trying to open() it? A) Read. B) Write. C) Append. D) All of them. Show Answer Correct Answer: A) Read. 20. Which method is used to check if a file is writable? A) Write(). B) IsWritable(). C) CanWrite(). D) CanRead(). Show Answer Correct Answer: C) CanWrite(). 21. Which method is used to close an opened file in Python? A) File.closeFile(). B) File.end(). C) File.close(). D) Close(file). Show Answer Correct Answer: C) File.close(). 22. Where files are stored permanently? A) RAM. B) Hard Disk. C) Cache memory. D) None of these. Show Answer Correct Answer: B) Hard Disk. 23. Is it possible to create a text file in python? A) Yes. B) No. C) Machine dependent. D) All of the mentioned. Show Answer Correct Answer: A) Yes. 24. Information stored on a storage device with a specific name is called a ..... A) Tuple. B) Array. C) Dictionary. D) File. Show Answer Correct Answer: D) File. 25. What is the method used to read a specific number of bytes from a file in Python? A) Read(n). B) Readlines(). C) Readline(). D) Readall(). Show Answer Correct Answer: A) Read(n). ← 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 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 10Class 11 Computer Science Chapter 6 File Handling Quiz 11 🏠 Back to Homepage 📘 Download PDF Books 📕 Premium PDF Books