This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 11 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 11 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What happens if fopen("abc.txt", "r") fails? A) Program crashes. B) Returns NULL. C) Creates file. D) Returns 0. Show Answer Correct Answer: B) Returns NULL. 2. What does the 'r' mode in the 'open()' function signify? A) Append to the file. B) Write to the file. C) Read from the file. D) Execute the file. Show Answer Correct Answer: C) Read from the file. 3. What happens if you try to close a file that is already closed? A) An error is raised. B) The file gets corrupted. C) Nothing happens. D) The file gets reopened. Show Answer Correct Answer: C) Nothing happens. 4. In CSV file all data's are stored in ..... format A) Image. B) Table. C) Animation. D) Gif. Show Answer Correct Answer: B) Table. 5. What is the purpose of the sys.path list? A) To keep track of all open files. B) To search for modules when importing. C) To store the current directory path. D) To list all Python keywords. Show Answer Correct Answer: B) To search for modules when importing. 6. The csv file is a ..... file. A) Plain text. B) Binary. C) Combination of both. D) None of the above. Show Answer Correct Answer: A) Plain text. 7. What happens if the CSV file being read by Reyansh contains inconsistent row lengths? A) All rows will be padded with empty values to match the longest row. B) The CSV file will be ignored entirely if row lengths are inconsistent. C) Inconsistent row lengths are automatically corrected during the read process. D) Inconsistent row lengths can cause errors or misalignment in data when reading a CSV file. Show Answer Correct Answer: D) Inconsistent row lengths can cause errors or misalignment in data when reading a CSV file. 8. ..... Open the file for writing. The file is created if it does not exist. A) W. B) Open(). C) R. D) A. Show Answer Correct Answer: D) A. 9. What will be the ouput-f=open('abc.txt', 'w')x=f.read()f.close()print(x) A) Error(not readable). B) Error(not writable). C) It will read all the data of the file. D) None. Show Answer Correct Answer: A) Error(not readable). 10. What is the role of the function fputs in file handling? A) To check if the file has reached the end. B) To read the contents of a file. C) To write a string of text to a file. D) To determine if the file has been opened successfully. Show Answer Correct Answer: C) To write a string of text to a file. 11. Which types of file requires translation? A) Text file. B) Binary file. C) CSV file. D) All files. Show Answer Correct Answer: A) Text file. 12. What is the significance of file modes like 'r', 'w', 'a'? A) 'r' for read, 'w' for wipe, 'a' for archive. B) 'r' for retrieve, 'w' for wrap, 'a' for add. C) 'r' for remove, 'w' for write, 'a' for alter. D) 'r' for read, 'w' for write, 'a' for append. Show Answer Correct Answer: D) 'r' for read, 'w' for write, 'a' for append. 13. File handling isn't needed as programs can save data to be accessed again later without them A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: B) False. 14. A stream is a sequence of data and stream is composed of ..... A) Bits. B) Bytes. C) Both bits and Bytes. D) None of given. Show Answer Correct Answer: B) Bytes. 15. How can standard output be redirected to a file in Python? A) Reassigning sys.stdout. B) Sys.stdout.writelines(). C) Print('data', file=fileobject). D) Sys.stdout.write(). Show Answer Correct Answer: C) Print('data', file=fileobject). 16. What will be the output of the following code?import mathprint(math.sqrt(16)) A) 8. B) 4. C) 2. D) Error. Show Answer Correct Answer: B) 4. 17. Which mode should be used with the 'open()' function to append data to an existing file? A) 'r'. B) 'w'. C) 'a'. D) 'r+'. Show Answer Correct Answer: C) 'a'. 18. ..... and ..... are the two objects associated with the csv module to read and write onto a CSV file. A) Reader() and writer(). B) Read() and write(). C) Dump() and load(). D) Write() and writelines(). Show Answer Correct Answer: A) Reader() and writer(). 19. Whether following code create file xyz.txt or not?import java.io.*; class demoFile \{ public static void main(String args[]) \{ try \{ File f = new File("C:/java/xyz.txt"); \} catch(Exception e) \{ \} catch(IOException e) \{ \} \} \} A) True. B) False. C) Compailation Error. D) Runtime Error. Show Answer Correct Answer: C) Compailation Error. 20. Which function is used to write multiple lines in text file? A) Write(). B) Writelines(). C) Writeline(). D) Print(). Show Answer Correct Answer: B) Writelines(). 21. What is a binary file and how does it differ from a text file? A) A binary file is always smaller than a text file. B) A binary file contains non-human-readable data, while a text file contains human-readable text. C) Text files can only contain numbers, while binary files can contain letters. D) Binary files are only used for images and videos. Show Answer Correct Answer: B) A binary file contains non-human-readable data, while a text file contains human-readable text. 22. What is the correct order of operations for writing data to a file? A) Write, open, close. B) Close, open, write. C) Open, close, write. D) Open, write, close. Show Answer Correct Answer: D) Open, write, close. 23. EOL can be expanded as A) End of Letter. B) End of Lock. C) Error of Line. D) End of Line. Show Answer Correct Answer: D) End of Line. 24. Which character can work as delimiter for CSV files: A) Comma only. B) Tab only. C) Space only. D) Any character. Show Answer Correct Answer: D) Any character. 25. What happens to the content of a file when opened in 'WRITE' mode? A) The content is appended. B) The content is overwritten. C) The content is read-only. D) The content remains unchanged. Show Answer Correct Answer: B) The content is overwritten. ← 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