This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 62 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 62 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which stream used to read data from a source, it may be a file, an array, peripheral device or socket? A) InputStream. B) OutputStream. C) Input/OutputStream. D) None of the above. Show Answer Correct Answer: A) InputStream. 2. What is the output of the length() method if the file is empty? A) -1. B) 0. C) Null. D) Undefined. Show Answer Correct Answer: B) 0. 3. Which is called as Direct Access? A) Sequential Access. B) Random Access. C) Both a and b. D) None of the above. Show Answer Correct Answer: B) Random Access. 4. Predict the output of above program. Assume that the size of an integer is 4 bytes and size of character is 1 byte. Also assume that there is no alignment needed.union test\{ int x; char arr[4]; int y;\};int main()\{ union test t; t.x = 0; t.arr[1] ='G'; printf("%s", t.arr); return 0;\} A) Nothing is printed. B) Garbage character followed by 'G'. C) Garbage character followed by 'G', followed by more garbage characters. D) Compiler Error. Show Answer Correct Answer: A) Nothing is printed. 5. A class which is capable of creating files, writing to files, reading from data files is called A) Ofstream. B) Ifstream. C) Fstream. D) Iostream. Show Answer Correct Answer: C) Fstream. 6. Which mode is taken as default mode for opening a File in Python? A) R. B) A. C) W. D) None. Show Answer Correct Answer: A) R. 7. Which of the following method is used to read from file? A) ReadFile(). B) Get(). C) Read(). D) Scanf(). Show Answer Correct Answer: C) Read(). 8. The output of executing string.ascii ..... letters can also be achieved by: A) String.ascii lowercase string.digits. B) String.ascii lowercase+string.ascii uppercase. C) String.letters. D) String.lowercase string.uppercase. Show Answer Correct Answer: B) String.ascii lowercase+string.ascii uppercase. 9. Which Python keyword is used to handle exceptions? A) Try. B) Catch. C) Throw. D) Finally. Show Answer Correct Answer: A) Try. 10. Which Tkinter component is used to manage the arrangement of widgets? A) Layout Management. B) Message Widget. C) Slider. D) Canvas Widget. Show Answer Correct Answer: A) Layout Management. 11. During a class project, Reyansh and Tanisha were discussing how to handle data files. They wondered what the default delimiter is when using the csv module in Python. A) ;. B) ,. C) |. D) Tab. Show Answer Correct Answer: B) ,. 12. Which method is used to write multiple lines to a file? A) File.addlines(). B) File.append(). C) File.writelines(). D) File.write(). Show Answer Correct Answer: C) File.writelines(). 13. Sequential Access will be slower when compared to random access? State True or False A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 14. Which file mode ensures new data is always added at end without overwriting? A) "w". B) "a". C) "r+". D) "w+". Show Answer Correct Answer: B) "a". 15. Mana yang berarti menulis ke file? A) Ios::app. B) Ios::trunc. C) Ios::in. D) Ios::out. Show Answer Correct Answer: D) Ios::out. 16. What does the 'os.rmdir()' function do? A) Removes a file. B) Creates a new directory. C) Removes a directory. D) Renames a file. Show Answer Correct Answer: C) Removes a directory. 17. Which of the following is a valid way to check if a path exists? A) Os.path.exists(path). B) Path.exists(). C) Os.path.isfile(path). D) Os.path.isdir(path). Show Answer Correct Answer: A) Os.path.exists(path). 18. ..... files are used to store binary data(machine code) such as images, video and audio files A) Binary. B) Text. C) CSV. D) All of the above. Show Answer Correct Answer: A) Binary. 19. Identify the error in the following code. 1. f = open ("workfile.txt', 'r+') 2. f.write('0123456789abcdef') 3. f.write('xyz8466') 4. f.close() 5. f.seek (0) 6. f.read() A) Line 1. B) Line 2. C) Line 5. D) Line 6. Show Answer Correct Answer: D) Line 6. 20. What should you do if the data read from the file does not match the search criteria? A) Stop the program. B) Continue reading until the end of the file. C) Delete the data from the file. D) Rewrite the data correctly. Show Answer Correct Answer: B) Continue reading until the end of the file. 21. Which function is used to dynamically allocate memory in C? A) Malloc(). B) Allocate(). C) New(). D) Calloc(). Show Answer Correct Answer: A) Malloc(). 22. The unexpected event happened during program execution should be handled by A) EXCEPTION. B) EXPERIMENT. C) ASSERTION. D) EXTRAORDINARY. Show Answer Correct Answer: A) EXCEPTION. 23. What are the types of files mentioned in the lesson plan? A) Text. B) Binary. C) Both. D) None. Show Answer Correct Answer: C) Both. 24. List and describe different types of directory structures. A) 1. Flat Structure, 2. Hierarchical Structure, 3. Networked Structure, 4. Database Structure. B) Linear Structure. C) Circular Structure. D) Segmented Structure. Show Answer Correct Answer: A) 1. Flat Structure, 2. Hierarchical Structure, 3. Networked Structure, 4. Database Structure. 25. How do you convert user input to a float safely? A) Use print statements to debug the conversion process. B) Convert input to an integer before converting to float. C) Always assume the input is a valid float. D) Use try-except to catch ValueError when converting input to float. Show Answer Correct Answer: D) Use try-except to catch ValueError when converting input to float. ← 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