This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 26 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 26 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Yashi wants to check whether her name is listed in Shortlisted.dat or not. Which command she can write to open the file: A) A=open( "Shortlisted.dat" , "rb" ). B) With open ( "Shortlisted.dat', 'rb" ) as a:. C) None. D) Both a and b. Show Answer Correct Answer: D) Both a and b. 2. What function is used to read a text file in Python? A) FetchFile(). B) ReadFile(). C) LoadText(). D) Open(). Show Answer Correct Answer: D) Open(). 3. Which of the following represents mode of both writing and reading in binary format in file? A) Wb+. B) W. C) Wb. D) W+. Show Answer Correct Answer: A) Wb+. 4. True or False:One way you could use a csv file is to add new units/floorplans to a building A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 5. Which section in the content includes "Random accessing files" ? A) Writing into a file. B) File handling in C. C) Special streams in C. D) Random accessing files. Show Answer Correct Answer: D) Random accessing files. 6. In seek()-mode 0 will indicate. A) Current Position of File. B) EOF. C) BOF. D) Pointer Value. Show Answer Correct Answer: C) BOF. 7. What is the process of reading data from a text file called? A) Data extraction. B) Text scanning. C) File reading. D) File parsing. Show Answer Correct Answer: C) File reading. 8. What type of data does read() return? A) Integer. B) List. C) String. D) Float. Show Answer Correct Answer: C) String. 9. Which of the following prints contents of a file line by line? A) With open("test.txt") as ffor line in f:print(line, end=" ). B) With open("test.txt ", 'w') as f:for line in f:print(line, end=" ). C) With open("test.txt ", 'r') as f for line in f print(line, end=" ). D) With open("test.txt") as f:f.read(). Show Answer Correct Answer: A) With open("test.txt") as ffor line in f:print(line, end=" ). 10. What will happen if you try to open an existing file in 'x' mode? A) It will overwrite the file. B) It will create a new file. C) It will raise an error. D) It will open the file for reading. Show Answer Correct Answer: C) It will raise an error. 11. The type of file doesn't require translation or specific encoding A) Binary. B) Text. C) CSV. D) All of the above. Show Answer Correct Answer: A) Binary. 12. When you try to open a non existing file then A) Error. B) Statement file not available. C) Question should i open new file in given name popped. D) New file will be created in the given name. Show Answer Correct Answer: D) New file will be created in the given name. 13. Provide an example of an Absolute Path in file handling. A) /home/user/documents/file.txt. B) /documents/file.txt. C) /root/user/documents/file.txt. D) C:/user/documents/file.txt. Show Answer Correct Answer: D) C:/user/documents/file.txt. 14. What does the following code do?f = open('file.txt', 'r')lines = f.readlines()f.close() A) Reads the entire file and prints it. B) Reads the entire file into a list of lines. C) Reads the first line of the file. D) Reads the file in binary mode. Show Answer Correct Answer: B) Reads the entire file into a list of lines. 15. What does the readfile() function do in PHP? A) Writes content to a file. B) Reads a file and writes it to the output buffer. C) Creates a new file. D) Delete a file. Show Answer Correct Answer: B) Reads a file and writes it to the output buffer. 16. Which type of file stores data in binary format? A) JSON file. B) CSV file. C) Text file. D) Binary file. Show Answer Correct Answer: D) Binary file. 17. What is the topic that we discussed? A) File Sorting. B) File Organization. C) File Handling and Applications. D) File Editing. Show Answer Correct Answer: C) File Handling and Applications. 18. What happens if no arguments are passed to the seek () method? A) File position is set to the start of file. B) File position is set to the end of file. C) File position remains unchanged. D) Results in an error. Show Answer Correct Answer: C) File position remains unchanged. 19. What is the purpose of closing a file after using it? A) To free up system resources and ensure data is saved correctly. B) To clear all file contents. C) To improve program execution speed. D) To lock the file from other users. Show Answer Correct Answer: A) To free up system resources and ensure data is saved correctly. 20. What happens if you try to read from a file that does not exist? A) The program reads null values from the file. B) The program throws an error indicating the file cannot be found. C) The program automatically creates a backup of the file. D) The program creates a new empty file and reads from it. Show Answer Correct Answer: B) The program throws an error indicating the file cannot be found. 21. How can a program read an entire line from a text file? A) Use a command like file.readLine() (or similar based on the language). B) Read each character separately using a loop. C) Convert the file into an array before reading. D) Open the file in write mode first. Show Answer Correct Answer: A) Use a command like file.readLine() (or similar based on the language). 22. What does the os.path.basename() function return? A) The file size. B) The full path. C) The file name. D) The directory name. Show Answer Correct Answer: C) The file name. 23. The readlines() returns A) Only first line from the file. B) Only last line from the file. C) All lines from the file. D) None of the above. Show Answer Correct Answer: C) All lines from the file. 24. A pre-defined function is known as A) Constructed function. B) Programming function. C) Builtin function. D) User defined function. Show Answer Correct Answer: C) Builtin function. 25. This method returns a list where the text between the specified separator becomes the list items. A) Upper(). B) Lower(). C) Split(). D) Replace(). Show Answer Correct Answer: C) Split(). ← 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