This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 17 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 17 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. Which file execute faster? A) Text file. B) Binary file. C) CSV file. D) None of the above. Show Answer Correct Answer: B) Binary file. 2. Apa yang dilakukan ios::app? A) Menimpa seluruh file. B) Menambah di akhir file. C) Mengunci file agar tidak dibuka. D) Membaca dari awal file. Show Answer Correct Answer: B) Menambah di akhir file. 3. Which of the following is not a valid mode for opening a binary file? A) Ab. B) Rw. C) Wb+. D) Rb+. Show Answer Correct Answer: B) Rw. 4. What utility allows you to manage packages from the command line? A) Util. B) Mpc. C) Pkg. D) Pip. Show Answer Correct Answer: D) Pip. 5. Which of the following commands can be used to read the next line in a file using the file object ? A) Tmpfile.read(n). B) Tmpfile.read(). C) Tmpfile.readline(). D) Tmpfile.readlines(). Show Answer Correct Answer: C) Tmpfile.readline(). 6. Describe how to read a specific column from a CSV file. A) Convert the CSV to JSON and access the column from the JSON object. B) Read the CSV file as a text file and search for the column manually. C) Use pandas to read the CSV and access the column by its name. D) Use Excel to open the CSV and copy the column data. Show Answer Correct Answer: C) Use pandas to read the CSV and access the column by its name. 7. Which of the following codes will open a file named as Sample for reading and writing purposes? A) Open("Sample.dat", ios::out | ios::in );. B) Open(ios::out | ios::in, "Sample.dat" );. C) Open("Sample.dat", ios::out && ios::in );. D) Open(ios::out && ios::in, "Sample.dat" );. Show Answer Correct Answer: A) Open("Sample.dat", ios::out | ios::in );. 8. What is the purpose of the seek() function in file handling? A) To close the file. B) To change the current file position to the specified offset. C) To read the file content. D) To delete the file. Show Answer Correct Answer: B) To change the current file position to the specified offset. 9. What does the 'read()' method do when used on a file object? A) Reads a single line from the file. B) Returns the entire contents of the file as a string. C) Returns a list of lines in the file. D) Writes a string to the file. Show Answer Correct Answer: B) Returns the entire contents of the file as a string. 10. ..... returns a writer object which writes data into CSV file. A) Csv.writer():. B) Csv.writer()=import. C) Csv.writer()='w+'. D) Csv.writer(). Show Answer Correct Answer: D) Csv.writer(). 11. A class which is capable of creating files and writing information to files is called A) Ofstream. B) Ifstream. C) Fstream. D) Iostream. Show Answer Correct Answer: A) Ofstream. 12. Mode in the following program to open file for writing in a mode where new data will be added at the end of old datafile =open("poem.txt", " ..... ") A) R. B) A. C) W. D) X. Show Answer Correct Answer: B) A. 13. Which function deletes a file? A) Delete(). B) Os.remove(). C) File.delete(). D) Removefile(). Show Answer Correct Answer: B) Os.remove(). 14. What will be the output of the followingfrom import factorialprint(math.factorial(5)) A) 25. B) 10. C) 120. D) Error bcz factorial is not a module in math. Show Answer Correct Answer: D) Error bcz factorial is not a module in math. 15. What are the advantages of using Fileinputstream and Fileoutputstream in Java? A) They are not compatible with Java serialization. B) They provide high-level access to the file system, making file handling more complicated. C) They provide low-level access to the file system, allowing for efficient and flexible file handling. D) They are slower and less efficient than other file handling methods. Show Answer Correct Answer: C) They provide low-level access to the file system, allowing for efficient and flexible file handling. 16. What does this do? .split() A) Casts an integer to a string. B) Splits all characters up into individual elements. C) Splits the by the . D) Chars split peas. Show Answer Correct Answer: C) Splits the by the . 17. Which is not a text file? A) Data.txt. B) Data.csv. C) Data.rft. D) Data.mp3. Show Answer Correct Answer: D) Data.mp3. 18. Evaluate the following expressions:6 * 3 + 8**4 // 5-8 A) 12. B) 13. C) 11. D) 13.2. Show Answer Correct Answer: B) 13. 19. Which of the following is not a valid attribute of a file object (fp)? A) Fp.name. B) Fp.closed. C) Fp.size. D) Fp.mode. Show Answer Correct Answer: C) Fp.size. 20. Which method is used to rename a file in Python? A) ChangeFileName(). B) Rename.file(). C) File.rename(). D) Os.rename(). Show Answer Correct Answer: D) Os.rename(). 21. What is the function of putc() in C programming? A) Read a line from a file. B) Write a character to a file. C) Read a character from a file. D) Write a line to a file. Show Answer Correct Answer: B) Write a character to a file. 22. What is the purpose of the glob() method in pathlib? A) To list all files matching a specific pattern. B) To create a new file. C) All the above. D) None of the above. Show Answer Correct Answer: A) To list all files matching a specific pattern. 23. What keyword is used to define a function? A) Function. B) Method. C) Procedure. D) Def. Show Answer Correct Answer: D) Def. 24. Which of the following is modes of both writing and reading in binary format in file? A) Wb+. B) W. C) Wb. D) W+. Show Answer Correct Answer: A) Wb+. 25. What is the extension of binary file? A) .bin. B) .nib. C) .dta. D) .dat. Show Answer Correct Answer: D) .dat. ← 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