This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 36 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 36 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. How do you create an array in PHP? A) $ cars = array("Volvo", "BMW", "Toyota");. B) $ cars = "Volvo", "BMW", "Toyota";. C) $ cars = array["Volvo", "BMW", "Toyota"];. D) None. Show Answer Correct Answer: A) $ cars = array("Volvo", "BMW", "Toyota");. 2. Di poster "Hierarki Stream File C++", mana stream untuk terminal? A) Fstream dan cout. B) MyFile dan open. C) Cin dan cout. D) Ifstream dan ofstream. Show Answer Correct Answer: C) Cin dan cout. 3. How can you handle exceptions when working with file operations? A) Close the file before performing any operations. B) Always ignore exceptions when they occur. C) Use try-except blocks to catch and handle exceptions during file operations. D) Use print statements to debug file operations. Show Answer Correct Answer: C) Use try-except blocks to catch and handle exceptions during file operations. 4. Consider:f=open("data.txt", "r")print(f.readline(4))If file contains "Python", output will be: A) "Python". B) "Pyth". C) "Py". D) Error. Show Answer Correct Answer: B) "Pyth". 5. The ..... function returns the current position of file pointer in the file. A) Tell(). B) Loc. C) Seek(). D) Pos(). Show Answer Correct Answer: A) Tell(). 6. Which of these keywords must be used to monitor for exceptions? A) Try. B) Finally. C) Throw. D) Catch. Show Answer Correct Answer: A) Try. 7. The type of operation possible in an opened file is governed by A) File Object. B) File Mode. C) File Path. D) Open() Method. Show Answer Correct Answer: B) File Mode. 8. Which of the following statements correctly explain the function of tell() method? A) Move the current file position to a different location. B) Tells the current position within the file. C) It changes the file position only if allowed to do so else returns an error. D) None. Show Answer Correct Answer: B) Tells the current position within the file. 9. What is the significance of the 'b' mode in file handling? A) The 'b' mode compresses files to save space. B) The 'b' mode allows for binary file handling, ensuring data integrity for non-text files. C) The 'b' mode is exclusive to image files. D) The 'b' mode is used for text file handling only. Show Answer Correct Answer: B) The 'b' mode allows for binary file handling, ensuring data integrity for non-text files. 10. A file object is also known as? A) File object. B) File pointer. C) File handle. D) Text file. Show Answer Correct Answer: C) File handle. 11. Which Python module helps with file path manipulations? A) Path. B) Os. C) Io. D) Sys. Show Answer Correct Answer: B) Os. 12. What is the output of:b=2c=2print(b is c)c +=2print(b is c) A) FalseFalse. B) FalseTrue. C) TrueFalse. D) TrueTrue. Show Answer Correct Answer: C) TrueFalse. 13. What does the 'EOF()' function return when the end of a file has NOT been reached? A) TRUE. B) NULL. C) FALSE. D) -1. Show Answer Correct Answer: C) FALSE. 14. In Which file the data get stored in tabular format? A) Text file. B) Binary file. C) Csv file. D) Both (a) and (c). Show Answer Correct Answer: C) Csv file. 15. Which Tkinter widget is used for multi-line text input? A) Text Widget. B) Label. C) Button. D) Slider. Show Answer Correct Answer: A) Text Widget. 16. The ..... function forces the writing of data on disc stil pending in output buffer. A) Dump(). B) Load(). C) Seek(). D) Flush(). Show Answer Correct Answer: D) Flush(). 17. In which format Binary file contains information A) Unicode. B) Quick response code. C) Same format in which the data is held in memory. D) ASCII. Show Answer Correct Answer: C) Same format in which the data is held in memory. 18. What precautions should be taken while working with Binary File Handling in Python? A) Ensure to open files in binary mode, handle exceptions, close files after operations, avoid mixing modes, and use proper encoding/decoding. B) Always mix modes when opening files. C) Ignore exceptions while working with files. D) Use incorrect encoding/decoding methods. Show Answer Correct Answer: A) Ensure to open files in binary mode, handle exceptions, close files after operations, avoid mixing modes, and use proper encoding/decoding. 19. Which option is True, in reference to the the 'a' and 'w' mode in open()? A) A and w are the same. B) A means overwrite the previous contents, w means append to the end of file. C) A means read all the contents of the file, w means write to the file. D) A means append to the end of file, w means overwrite the previous contents. Show Answer Correct Answer: D) A means append to the end of file, w means overwrite the previous contents. 20. The sys.stdin is always opened in ..... mode. A) Read. B) Write. C) Append. D) Read and Write. Show Answer Correct Answer: A) Read. 21. Default file opening mode is ..... A) Write. B) Read and write. C) Read. D) Append. Show Answer Correct Answer: C) Read. 22. Which method is used to read the entire content of a text file in a single string? A) Read(). B) Readline(). C) Readlines(). D) Both a and c. Show Answer Correct Answer: A) Read(). 23. In Python, which keyword is used to read data from a file? A) Open. B) Write. C) Read. D) Close. Show Answer Correct Answer: C) Read. 24. What does remove() do? A) Deletes a file. B) Renames a file. C) Opens a file. D) Writes data to a file. Show Answer Correct Answer: A) Deletes a file. 25. In seek () you can move the file pointer in backward direction with the help of ..... values A) Positive values. B) Negative Values. C) None Value. D) Zero Value. Show Answer Correct Answer: B) Negative Values. ← 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