This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 44 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 44 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. File handling commands vary from language to language A) TRUE. B) FALSE. C) All the above. D) None of the above. Show Answer Correct Answer: A) TRUE. 2. Which method reads only a single line from the file? A) Read(). B) Readline(). C) Readlines(). D) Line(). Show Answer Correct Answer: B) Readline(). 3. When we want to read from or write to a file, we need to open it first. When we are done, it needs to be closed, so that resources that are tied with the file are freed. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 4. What will happen if we forget to close a file? A) File gets deleted. B) File cannot be accessed again. C) May not save data. D) Nothing. Show Answer Correct Answer: C) May not save data. 5. Making some changes in the data of the existing file or adding more data is called A) Editing. B) Appending. C) Modification. D) Alteration. Show Answer Correct Answer: C) Modification. 6. What is the purpose of the program in Program 13.5? A) Copy source file to destination file. B) Write characters to a file. C) Position I/O operation in a file. D) Read integers from a file. Show Answer Correct Answer: C) Position I/O operation in a file. 7. Which method is used to break the link of file object and the file on the disk. A) Open. B) Close. C) Break. D) End. Show Answer Correct Answer: B) Close. 8. What does the 'read' method do when used on a file? A) It writes data to the file. B) It gets all data from the file. C) It deletes the file. D) It creates a new file. Show Answer Correct Answer: B) It gets all data from the file. 9. Which of the following is correct for reading the entire contents of a file as a string? A) File.read(). B) File.readlines(). C) File.readline(). D) File.readchars(). Show Answer Correct Answer: A) File.read(). 10. What method would you use to write data to a file? A) Use file writing methods such as 'write()' or 'writelines()' after opening the file in write mode. B) Use 'read()' to access file data. C) Use 'delete()' to remove file contents. D) Open the file in append mode only. Show Answer Correct Answer: A) Use file writing methods such as 'write()' or 'writelines()' after opening the file in write mode. 11. What does the fwrite() function do in PHP? A) Closes a file. B) Opens a file for reading. C) Writes data to a file. D) Reads data from a file. Show Answer Correct Answer: C) Writes data to a file. 12. Select a function which is used to write a string to a file A) Pits(). B) Putc(). C) Fputs(). D) Fgets(). Show Answer Correct Answer: C) Fputs(). 13. Java uses the concept of A) Source. B) Stream. C) Section. D) Standard. Show Answer Correct Answer: B) Stream. 14. How does the Pickle Module help in storing Python objects? A) The Pickle Module converts Python objects into JSON format for storage. B) The Pickle Module compresses Python objects into smaller files for storage. C) The Pickle Module encrypts Python objects for secure storage. D) The Pickle Module serializes Python objects into byte streams for storage and retrieval. Show Answer Correct Answer: D) The Pickle Module serializes Python objects into byte streams for storage and retrieval. 15. What is the purpose of the 'close' function in file handling? A) To delete the file. B) To open a new file. C) To read data from the file. D) To save changes and release resources. Show Answer Correct Answer: D) To save changes and release resources. 16. M=open("rt.dat", "wb+")Here, the above coed, b will indicate ..... A) Write mode. B) Read Mode. C) Byte. D) Binary Mode. Show Answer Correct Answer: D) Binary Mode. 17. What method would you use to write data to a text file? A) Utilize the 'writefile' method directly on the file object. B) Use the 'open' function with 'write' mode and the 'write' method. C) Open the file in 'read' mode and modify its contents. D) Use the 'append' function with 'read' mode. Show Answer Correct Answer: B) Use the 'open' function with 'write' mode and the 'write' method. 18. When the pointer variable is declared, the variable name must be preceded by which symbol? A) &. B) *. C) $\rightarrow$. D) . Show Answer Correct Answer: B) *. 19. How can you write a string to a file in Python? A) Open('filename.txt', 'a').write('Your string here'). B) Open('filename.txt', 'w').write('Your string here'). C) Write('Your string here', 'filename.txt'). D) Open('filename.txt', 'r').write('Your string here'). Show Answer Correct Answer: B) Open('filename.txt', 'w').write('Your string here'). 20. The void pointer can point to which type of objects? A) Int. B) Float. C) Double. D) All of the above. Show Answer Correct Answer: D) All of the above. 21. What is missing form this code?file = open ( "test1.txt" , " ..... " ) A) Written. B) Write. C) W. D) Wrt. Show Answer Correct Answer: C) W. 22. Explain the concept of data serialization. A) Data serialization is a method of creating backups of data in cloud storage. B) Data serialization refers to the physical storage of data on hard drives. C) Data serialization allows for the efficient storage and transmission of data by converting it into a standardized format. D) Data serialization is the process of encrypting data for security purposes. Show Answer Correct Answer: C) Data serialization allows for the efficient storage and transmission of data by converting it into a standardized format. 23. Which of the following key word is optional in Exception handling program A) Try. B) Catch. C) Finally. D) Throw. Show Answer Correct Answer: C) Finally. 24. Explain the difference between 'rb' and 'wb' modes. A) 'rb' is for writing text files, while 'wb' is for reading text files. B) Both 'rb' and 'wb' are used for reading files only. C) 'rb' is for reading files in a compressed format, while 'wb' is for writing in plain text. D) The difference between 'rb' and 'wb' modes is that 'rb' is for reading binary files, while 'wb' is for writing binary files. Show Answer Correct Answer: D) The difference between 'rb' and 'wb' modes is that 'rb' is for reading binary files, while 'wb' is for writing binary files. 25. Which method would you use to read all lines of a file into a list? A) 'read()'. B) 'readline()'. C) 'readlines()'. D) 'writelines()'. Show Answer Correct Answer: C) 'readlines()'. ← 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