This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 63 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 63 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the correct definition for a VARIABLE? A) A changeable value, such as a score in a computer game. B) A value that cannot be changed. C) All the above. D) None of the above. Show Answer Correct Answer: A) A changeable value, such as a score in a computer game. 2. What is the primary purpose of file handling in programming? A) To create databases. B) To store and retrieve data. C) To handle network connections. D) To manage memory. Show Answer Correct Answer: B) To store and retrieve data. 3. Given the following file opened as song ..... file:I can't write one song that's not about youCan't drink without thinkin' about youIs it too late to tell you thatEverything means nothing if I can't have you?What is the result ofprint(song ..... file.read(4))? A) I ca. B) I canI cI can't write one song that's not about youCan't drink without thinkin' about. C) I c. D) YouIs it too late to tell you thatEverything means nothing if I can't have you?. Show Answer Correct Answer: A) I ca. 4. What does file handling in Python allow you to do? A) Access and modify files on your computer. B) Create new programming languages. C) Design websites. D) Play video games. Show Answer Correct Answer: A) Access and modify files on your computer. 5. Which of the following error is returned when we try to open a file in read mode which does not exist? A) FileNotFoundError. B) FileFoundError. C) FileNotExistError. D) None of the above. Show Answer Correct Answer: A) FileNotFoundError. 6. What happens if you try to read from a closed file? A) It will read the last line. B) It will raise an error. C) It will return an empty string. D) It will read the entire file. Show Answer Correct Answer: B) It will raise an error. 7. File can be 'looked at' by the program but not changed. Error if the file doesn't already exist. A) Read. B) Append. C) Write. D) None of the above. Show Answer Correct Answer: A) Read. 8. Assertion:'Pickling' is the process whereby a Python object hierarchy is converted into a byte-streams. Reason:A binary file works with byte-streams. A) Both A and R are true and R is the correct explanation of A. B) Both A and R are true and R is not the correct explanation of A. C) A is true but R is false (or partly true). D) A is false (or partly true) but R is true. Show Answer Correct Answer: A) Both A and R are true and R is the correct explanation of A. 9. Which function in pseudocode is used to write data to a file? A) 'WRITE line TO file'. B) 'WRITE data TO file'. C) 'WRITE TO file'. D) 'APPEND data TO file'. Show Answer Correct Answer: B) 'WRITE data TO file'. 10. What is the importance of closing a file after file handling operations in Python? A) It frees up resources. B) It speeds up file access. C) It improves file security. D) It prevents data loss. Show Answer Correct Answer: A) It frees up resources. 11. Explain how to read a specific number of bytes from a binary file. A) Use the read method without specifying a byte count. B) Open the file in text mode and use the write method. C) Open the file in binary mode and use the read method with the desired byte count. D) Read the entire file into memory before accessing specific bytes. Show Answer Correct Answer: C) Open the file in binary mode and use the read method with the desired byte count. 12. Predict the output of the following program#include int main()\{ register int i = 10; int *ptr = &i; printf("%d ", *ptr); return 0; \} A) 10. B) Compiler error. C) 0. D) Runtime error. Show Answer Correct Answer: B) Compiler error. 13. Which file is not binary file? A) Student.mp4. B) Student.jpeg. C) Student.csv. D) Student.exe. Show Answer Correct Answer: C) Student.csv. 14. What are the different access modes available in Python for file handling? A) Y. B) Z. C) X. D) 'r', 'w', 'a', 'r+', 'w+', 'a+'. Show Answer Correct Answer: D) 'r', 'w', 'a', 'r+', 'w+', 'a+'. 15. How can you read the next line of a file using streaming? A) Using the 'next()' function. B) Using the 'close()' function. C) Using the 'read()' function. D) Using the 'write()' function. Show Answer Correct Answer: A) Using the 'next()' function. 16. Apa nilai default parameter dtype yang dikembalikan oleh fungsi numpy.loadtxt()? A) String. B) Integer. C) Float. D) Object. Show Answer Correct Answer: C) Float. 17. What does fread() do? A) Reads data from a file. B) Writes data to a file. C) Checks for file errors. D) Deletes a file. Show Answer Correct Answer: A) Reads data from a file. 18. What should a program do to prevent errors when working with files? A) Check if the file exists before attempting to open it. B) Always delete the file before writing to it. C) All the above. D) None of the above. Show Answer Correct Answer: A) Check if the file exists before attempting to open it. 19. Which function will read a single line at a time? A) Read(). B) Read(n). C) Readline(). D) Readlines(). Show Answer Correct Answer: C) Readline(). 20. Which of the following file modes allows both reading and writing without overwriting? A) R+. B) A. C) W. D) R. Show Answer Correct Answer: A) R+. 21. What will be the output of the following C code? #include struct student \{ int no; char name[20]; \}; void main() \{ student s; s.no = 8; printf("%d", s.no); \} A) Nothing. B) 8. C) Compile time error. D) Junk. Show Answer Correct Answer: C) Compile time error. 22. Which methods will create the file if it is not found? A) Read. B) Write. C) Append. D) Write and append. Show Answer Correct Answer: D) Write and append. 23. Name and explain at least three CPU scheduling algorithms. A) Multilevel Queue Scheduling (MQS). B) Priority Scheduling (PS). C) 1) First-Come, First-Served (FCFS), 2) Shortest Job Next (SJN), 3) Round Robin (RR). D) Shortest Remaining Time (SRT). Show Answer Correct Answer: C) 1) First-Come, First-Served (FCFS), 2) Shortest Job Next (SJN), 3) Round Robin (RR). 24. Which mode allows us to add data to an existing file?file =open("poem.txt", " ..... ") A) R. B) A. C) W. D) X. Show Answer Correct Answer: B) A. 25. Apa fungsi dari fopen dalam pemrograman C? A) Menutup file. B) Membuka file. C) Membaca data dari file. D) Menulis data ke file. Show Answer Correct Answer: B) Membuka file. ← 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