This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 13 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 13 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the correct syntax to open a file for reading? A) Open('file.txt', 'r'). B) Open('file.txt', 'w'). C) Read('file.txt'). D) File('file.txt'). Show Answer Correct Answer: A) Open('file.txt', 'r'). 2. Which method is used to write a sequence of strings to a file in Python? A) Readlines(). B) Read(). C) Writelines(). D) Write(). Show Answer Correct Answer: C) Writelines(). 3. Apa yang akan terjadi jika fopen gagal membuka file? A) Program akan berhenti. B) Mengembalikan NULL. C) File akan dibuat. D) Data akan ditulis ke file. Show Answer Correct Answer: B) Mengembalikan NULL. 4. The common separated value file extension are ..... A) .csv. B) .tsv. C) .txt. D) All these. Show Answer Correct Answer: A) .csv. 5. What does appending to a file do? A) Removes an item from the file. B) Changes an item in a file. C) Deletes the file. D) Adds an item to the file. Show Answer Correct Answer: D) Adds an item to the file. 6. Describe how to write data to a text file in Python. A) Use 'with open("filename.txt", "w") as file:file.write("Your data here")'. B) Use 'open("filename.txt") as file:file.write("Your data here")'. C) File.write("Your data here") without opening the file. D) 'with open("filename.txt", "r") as file:file.write("Your data here")'. Show Answer Correct Answer: A) Use 'with open("filename.txt", "w") as file:file.write("Your data here")'. 7. Which method is used to get the current position of the file handle? A) Tell(). B) Whence. C) Offset. D) Seek(). Show Answer Correct Answer: A) Tell(). 8. What will feof() return when the end of file is reached in C? A) 0. B) 1. C) -1. D) NULL. Show Answer Correct Answer: B) 1. 9. What does the function fopen() do? A) Opens a file. B) Closes an open file. C) Reads data from a file. D) Writes data to a file. Show Answer Correct Answer: A) Opens a file. 10. ..... Open the file for reading and writing. For existing file, data is truncated and over-written. A) W+. B) W. C) Wr. D) Rw. Show Answer Correct Answer: A) W+. 11. What is the significance of the Reader function in CSV file handling? A) The significance of the Reader function is to enable the processing of large CSV files without overwhelming system memory. B) The Reader function is used to convert CSV files into images. C) Reader function is designed to sort CSV files based on file size. D) Reader function allows for real-time editing of CSV files. Show Answer Correct Answer: A) The significance of the Reader function is to enable the processing of large CSV files without overwhelming system memory. 12. How can you create a new directory using pathlib? A) Using the create directory() method. B) Using the mkdir() method. C) All the above. D) None of the above. Show Answer Correct Answer: B) Using the mkdir() method. 13. What is the first step in handling a file in Python? A) Close the file. B) Write to the file. C) Open the file. D) Read the file. Show Answer Correct Answer: C) Open the file. 14. Which of these class is not related to input and output stream in terms of functioning? A) File. B) Write. C) InputStream. D) Reader. Show Answer Correct Answer: A) File. 15. The other names of pickling and unpickling is? A) Serialisation and deserialisation. B) Dump and load. C) Tell and seek. D) None of the above. Show Answer Correct Answer: A) Serialisation and deserialisation. 16. Formal and actual parameters are matched up by A) Name. B) Position. C) ID. D) Interests. Show Answer Correct Answer: B) Position. 17. What method would you use to close a file in Python? A) File.quit(). B) File.stop(). C) File.close(). D) File.end(). Show Answer Correct Answer: C) File.close(). 18. What is the default mode in which a file is opened using 'ifstream'? A) Read mode. B) Write mode. C) Append mode. D) Binary mode. Show Answer Correct Answer: A) Read mode. 19. Pickle. dump() takes two arguments namely ..... and ..... A) Fileobject, file handle of the open file. B) File handle of the open file. C) File handle of the open file, fileobject. D) All of the above. Show Answer Correct Answer: A) Fileobject, file handle of the open file. 20. ..... function changes the position of the file pointer replacing the file pointer at the specified position in the open file. A) Dump(). B) Load(). C) Seek(). D) Tell(). Show Answer Correct Answer: C) Seek(). 21. Which is the correct statement for binary file reading? A) Data=fobj.read(). B) Data=pickle.dump(fobj). C) Data=pickle.load(fobj). D) Pickle.load(data, fobj). Show Answer Correct Answer: C) Data=pickle.load(fobj). 22. Most commonly used delimiter in a CSV file is A) . B) ,. C) :. D) /. Show Answer Correct Answer: B) ,. 23. Which of the following is a valid way to append data to a file? A) F = open('file.txt', 'r'). B) F = open('file.txt', 'w'). C) F = open('file.txt', 'a'). D) F = open('file.txt', 'x'). Show Answer Correct Answer: C) F = open('file.txt', 'a'). 24. What happens when you open a file in 'write' mode? A) It reads the contents of the file. B) It appends text to the end of the file. C) It deletes the old text and replaces it with new text. D) It prints the contents of the file. Show Answer Correct Answer: C) It deletes the old text and replaces it with new text. 25. If we want to do the same thing regardless of the error type that occurs in the try block, which should we use? A) Except:. B) Except ErrorType:. C) All the above. D) None of the above. Show Answer Correct Answer: A) Except:. ← 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