This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 33 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 33 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What happens if you try to read from a file that doesn't exist? A) The file is created. B) An error occurs. C) A warning is issued. D) The system ignores it and proceeds. Show Answer Correct Answer: B) An error occurs. 2. Which of the following class is used to read characters from a file? A) FileWriter. B) FileReader. C) InputStreamReader. D) FileInputStream. Show Answer Correct Answer: B) FileReader. 3. When would you use the Load function in Python? A) Creating a new Python package. B) Deserializing of data. C) Connecting to a database. D) Sorting a list of integers. Show Answer Correct Answer: B) Deserializing of data. 4. Both "w" mode and "a" mode can be used to edit a file. A) True. B) False. C) All the above. D) None of the above. Show Answer Correct Answer: A) True. 5. What does the OPENFILE command do in file handling? A) Closes the file. B) Reads data from the file. C) Opens the file for reading, writing, or both. D) Deletes the file. Show Answer Correct Answer: C) Opens the file for reading, writing, or both. 6. If I want to add to the end of a text file, I should: A) MyCipher = open("MyCipher.txt", "w"). B) MyCipher = open("MyCipher.txt", "a"). C) MyCipher = open("MyCipher.txt", "w+"). D) MyCipher = open("MyCipher.txt", "s"). Show Answer Correct Answer: B) MyCipher = open("MyCipher.txt", "a"). 7. Jika kita ingin menghapus isi lama saat membuka file, kita memakai apa? A) Ios::out. B) Ios::trunc. C) Ios::in. D) Ios::app. Show Answer Correct Answer: B) Ios::trunc. 8. Which method is used to delete a file in Java? A) Erase(). B) Delete(). C) Remove(). D) Clear(). Show Answer Correct Answer: B) Delete(). 9. The PHP ..... function is used to open a file. A) Open(). B) Fopen(). C) Create(). D) Insert(). Show Answer Correct Answer: B) Fopen(). 10. What will be the output of the following C code? (Assuming size of char = 1, int = 4, double = 8) #include union utemp \{ int a; double b; char c; \}u; int main() \{ u.c = 'A'; u.a = 1; printf("%zu", sizeof(u)); \} A) 8. B) 4. C) 1. D) 13. Show Answer Correct Answer: A) 8. 11. Differentiate between Absolute Path and Relative Path in file handling. A) Absolute path includes the root directory, while relative path does not include the root directory. B) Absolute path is always case-sensitive. C) Relative path includes the root directory. D) Absolute path is shorter than relative path. Show Answer Correct Answer: A) Absolute path includes the root directory, while relative path does not include the root directory. 12. What is Java serialization? A) It is the process of converting an object into a string of characters. B) It is the process of converting an object into a stream of bytes. C) It is the process of converting an object into a stream of integers. D) It is the process of converting a stream of bytes into an object. Show Answer Correct Answer: B) It is the process of converting an object into a stream of bytes. 13. What type of storage is a file typically stored in? A) Primary storage. B) Secondary storage. C) Volatile storage. D) Temporary storage. Show Answer Correct Answer: B) Secondary storage. 14. What does the "" operator do when used with a function parameter in Python? A) It multiplies the value of the parameter by 2. B) It unpacks an inerrable object into individual arguments. C) It converts the parameter to a string. D) It raises an error because "" is not a valid operator for function parameters. Show Answer Correct Answer: B) It unpacks an inerrable object into individual arguments. 15. What does 'a+' means in file handling? A) Overwrite. B) Append. C) Append and read. D) Write and read. Show Answer Correct Answer: C) Append and read. 16. Where is data typically stored to ensure it is external to the program's main data? A) Primary Storage. B) Cloud Storage. C) Secondary Storage. D) Internal Memory. Show Answer Correct Answer: C) Secondary Storage. 17. Spaces, tabs, new lines are the example of ..... A) White spaces. B) Empty Spaces. C) Null values. D) None of these. Show Answer Correct Answer: A) White spaces. 18. What method is used to check if a file exists? A) IsExisting(). B) Exists(). C) IsPresent(). D) IsAvailable(). Show Answer Correct Answer: B) Exists(). 19. It opens the file for a read. A) Ios::ate. B) Ios::in. C) Ios::out. D) Ios::app. E) Ios::trunc. Show Answer Correct Answer: B) Ios::in. 20. Which Is data type of file pointer is ..... A) Int. B) Double. C) File. D) Char. Show Answer Correct Answer: C) File. 21. What will be the output of the following Python code?def getMonth(m):if m <1 or m>12:raise ValueError("Invalid")print(m)getMonth(6) A) ValueError. B) ValueError( "Invalid" ). C) Invalid. D) 6. Show Answer Correct Answer: D) 6. 22. The ..... function removes the given character from trailing right ends. A) Strip(). B) Lstrip(). C) Rstrip(). D) All these. Show Answer Correct Answer: C) Rstrip(). 23. What happens if the data in the text file is not in the expected format? A) The program deletes the file. B) The program will not run. C) The program outputs incorrect data. D) The program requests user re-input. Show Answer Correct Answer: C) The program outputs incorrect data. 24. Which is/are the basic I/O (input-output) stream(s) in files? A) Standard Input. B) Standard Output. C) Standard Errors. D) All of the above. Show Answer Correct Answer: D) All of the above. 25. Class IT\{static public void main(String ..... args)\{String s=null;System.out.println("length is:"+s.length());\}\} A) It throws NullPointerException. B) It throws IOException. C) It throws StringExeption. D) Output is 0. Show Answer Correct Answer: A) It throws NullPointerException. ← 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