This quiz works best with JavaScript enabled. Home > Class 11 > Class 11 Computer Science Chapter 6 File Handling – Quiz 28 🏠 Homepage 📘 Download PDF Books 📕 Premium PDF Books Class 11 Computer Science Chapter 6 File Handling Quiz 28 (25 MCQs) Quiz Instructions Select an option to see the correct answer instantly. 1. What is the purpose of using Fileoutputstream in Java? A) To create a new file. B) To write data to a file. C) To read data from a file. D) To delete a file. Show Answer Correct Answer: B) To write data to a file. 2. What is the purpose of the 'csv.writer' object? A) To convert CSV data into JSON format. B) To read data from a CSV file. C) To display CSV data in a graphical interface. D) To write data to a CSV file. Show Answer Correct Answer: D) To write data to a CSV file. 3. If there is any error while opening a file, fopen will return? A) Nothing. B) EOF. C) NULL. D) Depends on compiler. Show Answer Correct Answer: C) NULL. 4. What happens when you try to open a file that does not exist using the code?with open("test.txt", 'w') as f: A) A new file is created. B) Error message pops up. C) Nothing happens. D) None of the above. Show Answer Correct Answer: A) A new file is created. 5. Choose the correct statement to close a file stream named myfile: A) Myfile.terminate(). B) Myfile.end(). C) Myfile.close(). D) Myfile.remove(). Show Answer Correct Answer: C) Myfile.close(). 6. Apa yang dimaksud dengan operasi "menambahkan data" ke file? A) Menghapus data yang ada. B) Menulis data baru di awal file. C) Menulis data baru di akhir file. D) Membaca data dari file. Show Answer Correct Answer: C) Menulis data baru di akhir file. 7. You must write pickle.load() enclosed in ..... and ..... statements. A) Pickle & Unpickle. B) Try & Catch. C) Try & Except. D) Dunp & Load. Show Answer Correct Answer: C) Try & Except. 8. What is the correct syntax to close a file in the pseudocode provided? A) Myfile.open(). B) Myfile.read(). C) Myfile.write(). D) Myfile.close(). Show Answer Correct Answer: D) Myfile.close(). 9. Which function is used to convert a string to an integer in Python? A) Int(). B) Str(). C) Float(). D) Eval(). Show Answer Correct Answer: A) Int(). 10. How do you open a CSV file in Python? A) Open('file.csv'). B) Pandas.read csv('file.csv'). C) Csv.load('file.csv'). D) Import csvwith open('file.csv', mode='r') as file:reader = csv.reader(file) for row in reader:print(row). Show Answer Correct Answer: D) Import csvwith open('file.csv', mode='r') as file:reader = csv.reader(file) for row in reader:print(row). 11. Which mode opens a file for reading and writing in Python? A) "r". B) "w". C) "r+". D) "a+". Show Answer Correct Answer: C) "r+". 12. F = open("test.txt", "a") f.write("Hello World!") A) It opens tht file in write mode which clears the previous text. B) It opens the file in write mode which adds text to the end of the file. C) It opens tht file in append mode which clears the previous text. D) It opens the file in append mode which adds text to the end of the file. Show Answer Correct Answer: D) It opens the file in append mode which adds text to the end of the file. 13. The ..... files are not in human readable form. A) Delimited text file. B) CSV File. C) Binary File. D) Text file. Show Answer Correct Answer: C) Binary File. 14. How do you read data from a file using Fileinputstream in Java? A) Create a FileInputStream object and use its read() method to read the data from the file. B) Open the file in a text editor and manually copy the data. C) Use a PrintWriter object to read the data from the file. D) Use a Scanner object to read the data from the file. Show Answer Correct Answer: A) Create a FileInputStream object and use its read() method to read the data from the file. 15. Each line in a CSV file is called a ..... A) Record. B) Data Record. C) File. D) Modules. Show Answer Correct Answer: B) Data Record. 16. How do you open a file for both reading and writing in C++? A) By using an 'ifstream' object. B) By using an 'ofstream' object. C) By using an 'fstream' object. D) By using an 'iostream' object. Show Answer Correct Answer: C) By using an 'fstream' object. 17. Which of the following modes should be used when opening a file for writing? A) "w" (write mode). B) "r" (read mode). C) "a" (append mode). D) "rw" (read and write mode). Show Answer Correct Answer: A) "w" (write mode). 18. The ..... text files which store the text in the same form as typed. A) Regular text file. B) Delimited text file. C) CSV File. D) Binary File. Show Answer Correct Answer: A) Regular text file. 19. Which statement is CORRECT about the 'READ' mode? A) It allows reading and writing. B) It allows only reading. C) It erases the file before reading. D) It adds new lines to the file. Show Answer Correct Answer: B) It allows only reading. 20. Apa nilai default dari parameter delimiter yang digunakan pada fungsi pandas.read ..... csv() dan numpy.loadtxt()? A) Spasi ( ). B) Koma (, ). C) Titik koma (;). D) Strip (-). Show Answer Correct Answer: B) Koma (, ). 21. Which of the following is a valid way to define a pointer to a structure? A) Struct student *ptr;. B) Struct *ptr student;. C) Ptr struct student;. D) Student *ptr struct;. Show Answer Correct Answer: A) Struct student *ptr;. 22. What happens if a program does not properly close a file after writing to it? A) Data may not be saved correctly. B) The file will be deleted automatically. C) The program will always crash immediately. D) The file's contents will be locked permanently. Show Answer Correct Answer: A) Data may not be saved correctly. 23. How can you pass a variable number of arguments to a function? A) Declare a fixed number of parameters in the function definition. B) Use *args in Python to accept a variable number of arguments. C) Use **kwargs** to pass keyword arguments only. D) Use a list to pass multiple arguments as a single parameter. Show Answer Correct Answer: B) Use *args in Python to accept a variable number of arguments. 24. What is the difference between text files and binary files? A) Binary files can be opened in any text editor. B) Text files are human-readable and use characters; binary files are not human-readable and use bytes. C) Text files contain only images and videos. D) Text files are always larger than binary files. Show Answer Correct Answer: B) Text files are human-readable and use characters; binary files are not human-readable and use bytes. 25. Apa yang akan ditampilkan jika fgets berhasil membaca baris dari file? A) NULL. B) Pesan kesalahan. C) Konten baris yang dibaca. D) ID file. Show Answer Correct Answer: C) Konten baris yang dibaca. ← 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