This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 48 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 48 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the difference between 'read()' and 'readlines()' methods? A) 'read()' returns a list of strings, and 'readlines()' returns a single string. B) 'read()' reads a file line by line, while 'readlines()' reads the entire file at once. C) The difference is that 'read()' returns a single string, and 'readlines()' returns a list of strings. D) 'read()' is used for binary files, while 'readlines()' is used for text files. Show Answer Correct Answer: C) The difference is that 'read()' returns a single string, and 'readlines()' returns a list of strings. 2. Load function of pickle module is used to A) Read data from file. B) Append data in the file. C) Write data in the file. D) Pickle module does not have a function load. Show Answer Correct Answer: A) Read data from file. 3. What method is used to read all lines from a text file? A) File.fetch lines(). B) File.readlines(). C) File.read(). D) File.getlines(). Show Answer Correct Answer: B) File.readlines(). 4. What is a binary file in Python? A) A binary file is a text file that can be read by humans. B) A binary file in Python is a file that only contains images. C) A binary file is a file that stores data in a format that is always human-readable. D) A binary file in Python is a file that contains data in a non-human-readable format, accessed in binary mode. Show Answer Correct Answer: D) A binary file in Python is a file that contains data in a non-human-readable format, accessed in binary mode. 5. Which function is used to read all lines from a text file into a list? A) Read(). B) Readline(). C) Readlines(). D) Write(). Show Answer Correct Answer: C) Readlines(). 6. The contents of a csv file "sample.csv" are shown below:sno, name, age1, Amit, 122, Harsh, 133, Vivek, 21 A) It can be treated as a text file. B) It cannot be treated as a text file as it is a CSV file. C) It cannot be opened in a text editor a sit is a CSV file. D) An error will be raised in Python. Show Answer Correct Answer: A) It can be treated as a text file. 7. What is the standard input stream in Python? A) Stdout. B) Input(). C) Stdin. D) Stderr. Show Answer Correct Answer: C) Stdin. 8. What is the first index of an array? A) 1. B) 2. C) 0. D) 3. Show Answer Correct Answer: C) 0. 9. What is the advantage of using CSV files? A) CSV files are faster to handle and smaller in size. B) CSV files can store complex data structures. C) CSV files are encrypted for security. D) CSV files can only be read by specific applications. Show Answer Correct Answer: A) CSV files are faster to handle and smaller in size. 10. Which operator is used in python to import all modules from package A) Operator. B) + operator. C) Operator. D) $\rightarrow$ operator. Show Answer Correct Answer: A) Operator. 11. Which method is used to close a file in Python? A) Close(). B) Open(). C) Seek(). D) Write(). Show Answer Correct Answer: A) Close(). 12. Which of the following function do you use to write data in the binary file? A) Dump. B) Write. C) Output. D) Send. Show Answer Correct Answer: A) Dump. 13. Which method is used to delete a file in Python? A) Os.delete(). B) Os.rmdir(). C) Os.remove(). D) Os.clear(). Show Answer Correct Answer: C) Os.remove(). 14. Which one of the following methods is responsible for sending the query to the database? A) Query(). B) Send query(). C) Query send(). D) None. Show Answer Correct Answer: A) Query(). 15. How do you delete a file in Python? A) Invoke 'remove.file(file path)' to delete a file. B) Call 'os.unlink(file path)' to erase a file. C) Use 'file.delete(file path)' to remove a file. D) Use 'os.remove(file path)' to delete a file. Show Answer Correct Answer: D) Use 'os.remove(file path)' to delete a file. 16. Rashil is working on a project that involves analyzing sales data stored in a CSV file. Which Python module should he primarily use for handling these CSV files? A) Csv. B) Txt. C) Xml. D) Json. Show Answer Correct Answer: A) Csv. 17. How do you properly close a file after performing operations on it in Python? A) File.close(). B) File.stop(). C) File.shutdown(). D) File.end(). Show Answer Correct Answer: A) File.close(). 18. 6 What is the last action that must be performed while working with the files? A) Close(). B) Save(). C) End(). D) Write(). Show Answer Correct Answer: A) Close(). 19. How can you check if a file exists before trying to open it? A) Use 'file.exists(file path)' in Python to check if a file exists. B) Check the file size to determine if it exists. C) Attempt to open the file and catch any errors. D) Use 'os.path.exists(file path)' in Python to check if a file exists. Show Answer Correct Answer: D) Use 'os.path.exists(file path)' in Python to check if a file exists. 20. Existing data is kept intact when append is use to write to a file A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 21. (1) which do we use to output information to a file opened under w/a mode? (2) what data type does it accept as an argument? A) .send(), string. B) .write(), string. C) .write(), any type. D) .send(), any type. Show Answer Correct Answer: B) .write(), string. 22. Which of the following is method for testing whether the specified element is a file or a directory? A) Isfile(). B) Isfile(). C) IsFile(). D) IsFile(). Show Answer Correct Answer: C) IsFile(). 23. The ..... statement means to place the file pointer at 30 bytes behind(backward direction) from end of file. A) F.seek(30, 1). B) F.seek(30, 2). C) F.seek(-30, 2). D) F.seek(-30, 1). Show Answer Correct Answer: C) F.seek(-30, 2). 24. Which file extension is used for a plain text file? A) .jpg. B) .txt. C) .exe. D) .pdf. Show Answer Correct Answer: B) .txt. 25. To iterate through an array in a file, I would use A) A while loop. B) A for loop. C) Sequence. D) Selection. Show Answer Correct Answer: B) A for loop. ← 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