This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 67 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 67 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Class exception ..... handling \{ public static void main(String args[]) \{ try \{ int a, b; b = 0; a = 5 / b; System.out.print("A"); \} catch(ArithmeticException e) \{ System.out.print("B"); \} finally \{ System.out.print("C"); \} \} \} A) A. B) B. C) AC. D) BC. Show Answer Correct Answer: D) BC. 2. How do you close a binary file in Python? A) File.quit(). B) File.stop(). C) File.close(). D) File.end(). Show Answer Correct Answer: C) File.close(). 3. Which function is used to open file? A) New(). B) Create(). C) Open(). D) None of the above. Show Answer Correct Answer: C) Open(). 4. If you want to read and write to a file, which mode should you use? A) 'r'. B) 'w'. C) 'a'. D) 'r+'. Show Answer Correct Answer: D) 'r+'. 5. How do you serialize and deserialize an object in Java? A) Use the Serializable class to write the object to a database. B) Use ObjectOutputStream to write the object to a network socket. C) Use ObjectOutput to write the object to a text file. D) Implement the Serializable interface and use ObjectOutputStream to write the object to a file, then use ObjectInputStream to read the object from the file. Show Answer Correct Answer: D) Implement the Serializable interface and use ObjectOutputStream to write the object to a file, then use ObjectInputStream to read the object from the file. 6. What will be the output of the program?try \{ int x = 0; int y = 5 / x; \} catch (Exception e) \{ System.out.println("Exception"); \} catch (ArithmeticException ae) \{ System.out.println(" Arithmetic Exception"); \} System.out.println("finished"); A) Finished. B) Runtime error. C) Compilation fails. D) Exception. Show Answer Correct Answer: C) Compilation fails. 7. What is a user-defined function? A) A function provided by the programming language. B) A command that you create yourself. C) A built-in library function. D) A function that cannot be modified. Show Answer Correct Answer: B) A command that you create yourself. 8. Explain the concepts of pickling and unpickling in Python file handling. A) Pickling and unpickling are used for sorting data in Python files. B) Pickling and unpickling involve converting Python objects to JSON format. C) Pickling is used for compressing files, while unpickling is used for decompressing files. D) Pickling and unpickling in Python file handling involve converting Python objects to byte streams and vice versa. Show Answer Correct Answer: D) Pickling and unpickling in Python file handling involve converting Python objects to byte streams and vice versa. 9. ..... is itself a bunch of bytes stored on some storage device like hard disk, thumb drive etc A) Text file. B) File. C) Binary file. D) Folder. Show Answer Correct Answer: B) File. 10. While working on a group project, Abhishek and Tanisha are reading a CSV file containing data about their survey results. They want to skip the header row to directly access the data. Which of the following is the correct way to use next() to skip the header row while reading the CSV file in Python? A) Next(csv.reader(file)). B) Reader = csv.reader(file)reader.next(). C) Reader = csv.reader(file)next(reader). D) Reader = csv.reader(file)csv.next(reader). Show Answer Correct Answer: C) Reader = csv.reader(file)next(reader). 11. What does this code snippet do?with open('numbers.txt', 'r') as f:for line in f:print(line.strip()) A) Writes each line to 'numbers.txt'. B) Appends each line to 'numbers.txt'. C) Reads each line from 'numbers.txt' and prints it without trailing newline characters. D) Deletes each line from 'numbers.txt'. Show Answer Correct Answer: C) Reads each line from 'numbers.txt' and prints it without trailing newline characters. 12. Structure padding increases: A) Memory. B) Speed. C) Both. D) Neither. Show Answer Correct Answer: A) Memory. 13. What is the main advantage of using the pathlib module over os.path? A) It is more complex. B) It provides a more intuitive interface. C) It is only available in Python 3.8. D) It does not support file paths. Show Answer Correct Answer: B) It provides a more intuitive interface. 14. Apa kelebihan penggunaan context manager ketika membuka sebuah file? A) Untuk menangani error yang mungkin muncul dengan lebih baik. B) Untuk menulis file dalam format tertentu. C) Untuk menutup file secara otomatis setelah digunakan. D) Untuk membaca file dengan lebih cepat. Show Answer Correct Answer: C) Untuk menutup file secara otomatis setelah digunakan. 15. To force python to write the contents of file buffer on to storage file, ..... method may be used. A) Buffer(). B) Write(). C) Close(). D) Flush(). Show Answer Correct Answer: D) Flush(). 16. Which Tkinter widget allows users to select one option from a set? A) Radiobuttons. B) Checkboxes. C) Sliders. D) Dialogs. Show Answer Correct Answer: A) Radiobuttons. 17. Which of the following function can be used to set the file pointer at a given position A) Seek. B) Tell. C) All the above. D) None of the above. Show Answer Correct Answer: A) Seek. 18. Which file mode should be used if you need to both read from and write to the same file without deleting its contents? A) READ. B) WRITE. C) APPEND. D) READ/WRITE. Show Answer Correct Answer: D) READ/WRITE. 19. Which of the following is NOT a mode for opening a file? A) R. B) W. C) Z. D) A. Show Answer Correct Answer: C) Z. 20. Which of the following function is used to write data in text mode? A) Write. B) Output. C) Dump. D) Send. Show Answer Correct Answer: A) Write. 21. Which of the following format of files can be created programmatically through Python to some data? A) Data files. B) Text files. C) Video files. D) CSV Files. Show Answer Correct Answer: B) Text files. 22. Which mode should be used to open a file for appending data in C++? A) Ios::in. B) Ios::out. C) Ios::app. D) Ios::trunc. Show Answer Correct Answer: C) Ios::app. 23. Which of the following codes will close a file named as Sample? A) Close(Sample);. B) Close.Sample();. C) Sample.close();. D) Sample(close);. Show Answer Correct Answer: C) Sample.close();. 24. Which of the following strings is used to open a file in read as well as write modes? A) R+. B) Rw. C) Rwrite. D) Readw. Show Answer Correct Answer: A) R+. 25. How to import python math modules? A) Form import math. B) Import math. C) Import from math. D) From math. Show Answer Correct Answer: B) Import math. ← 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