This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 25 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 25 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. A bunch of bytes stored on some storage device is ..... A) File object. B) Data. C) File. D) Content. Show Answer Correct Answer: C) File. 2. What does the 'break' statement do in C++? A) Pauses the execution of the loop. B) Stops the execution of the loop and exits it. C) Skips the rest of the code inside the loop and continues with the next iteration. D) Breaks the program. Show Answer Correct Answer: B) Stops the execution of the loop and exits it. 3. Which function is used to change the file pointer position? A) Tell(). B) Seek(). C) Jump(). D) Move(). Show Answer Correct Answer: B) Seek(). 4. Which of the following commands can be used to read the entire contents of a file as a string using the file object ? A) Tmpfile.read(n). B) Tmpfile.read(). C) Tmpfile.readline(). D) Tmpfile.readlines(). Show Answer Correct Answer: B) Tmpfile.read(). 5. How can you handle file exceptions in Python? A) Ignore exceptions and continue file processing. B) Always close files without exception handling. C) Use try-except blocks to catch exceptions like FileNotFoundError and IOError when performing file operations. D) Use print statements to debug file operations. Show Answer Correct Answer: C) Use try-except blocks to catch exceptions like FileNotFoundError and IOError when performing file operations. 6. Which module is required to use the built-in function dump()? A) Math. B) Flush. C) Pickle. D) Unpickle. Show Answer Correct Answer: C) Pickle. 7. Which method returns the name of the file? A) GetTitle(). B) GetLabel(). C) GetFileName(). D) GetName(). Show Answer Correct Answer: D) GetName(). 8. In Python the default mode while opening the file is ..... A) Write. B) Read. C) Append. D) Close. Show Answer Correct Answer: B) Read. 9. What is the correct order of attributes for a character in the text file as used in the program? A) Name, Stamina, Health, Hunger. B) Stamina, Hunger, Health, Name. C) Health, Stamina, Hunger, Name. D) Name, Health, Stamina, Hunger. Show Answer Correct Answer: D) Name, Health, Stamina, Hunger. 10. Explain the first-fit and best-fit memory allocation techniques. A) First-fit allocates the smallest block, while best-fit allocates the first available block. B) First-fit allocates the largest available block, while best-fit allocates any block. C) First-fit allocates the first suitable memory block, while best-fit allocates the smallest suitable block. D) First-fit allocates memory in a random order, while best-fit uses a fixed size. Show Answer Correct Answer: C) First-fit allocates the first suitable memory block, while best-fit allocates the smallest suitable block. 11. Which method is used to write row by row into a csv file along with writer object? A) Writer(). B) Write(). C) Writeline(). D) Writerow(). Show Answer Correct Answer: D) Writerow(). 12. What is the output of the following code?def greet(name):print("Hello, '' + name)result = greet("John") A) Hello, John. B) Hello, None. C) None. D) Error. Show Answer Correct Answer: A) Hello, John. 13. Class at the top of exception class hierarchy? A) ArithmeticException. B) Throwable. C) Object. D) Exception. Show Answer Correct Answer: B) Throwable. 14. What is a recursive function? A) A function that returns multiple values. B) A function that calls itself. C) A function that takes multiple arguments. D) A function without arguments. Show Answer Correct Answer: B) A function that calls itself. 15. What is the difference between 'r' and 'w' file modes? A) The 'r' mode is for reading and 'w' mode is for appending. B) Both 'r' and 'w' modes are used for reading files only. C) The 'r' mode is for reading, while the 'w' mode is for writing. D) The 'r' mode is for writing, while the 'w' mode is for reading. Show Answer Correct Answer: C) The 'r' mode is for reading, while the 'w' mode is for writing. 16. What does the 'os.path.relpath()' function do? A) Returns a relative path from a start path. B) Lists all files in a directory. C) Returns the absolute path of a file. D) Checks if a path is absolute. Show Answer Correct Answer: A) Returns a relative path from a start path. 17. What letter is added to the modes "r" and "w" to allow them to access non-textual (or binary) information? A) "b". B) "p". C) "d". D) "a". Show Answer Correct Answer: A) "b". 18. Java.lang.NullPointerException is a A) Error. B) Runtime exception. C) Compile time exception. D) None. Show Answer Correct Answer: B) Runtime exception. 19. Which mode should be used to add data to an existing file without deleting its contents? A) READ. B) WRITE. C) APPEND. D) CREATE. Show Answer Correct Answer: C) APPEND. 20. Identify the correct syntax for opening a file A) File object=open("filename"). B) File object=open(filename). C) File object=open(filename). D) None. Show Answer Correct Answer: A) File object=open("filename"). 21. ..... error also known as bug or semantic error A) Run time. B) Logical. C) Compile-time. D) Syntax. Show Answer Correct Answer: B) Logical. 22. FileNotFoundException A) Is a subclass/extends IOException. B) Is a Compile time exception. C) Found in java.io package. D) All. Show Answer Correct Answer: D) All. 23. Select a function which is used to read a single character from a file at a time A) Fscanf(). B) Getch(). C) Fgetc(). D) Fgets(). Show Answer Correct Answer: C) Fgetc(). 24. What is the file extension for CSV files? A) .data. B) .txt. C) .csv. D) .bin. Show Answer Correct Answer: C) .csv. 25. ..... is a location to store permanently (Secondary)in a system for future use A) File. B) Folder. C) Data. D) Information. Show Answer Correct Answer: A) 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