Class 11 Computer Science Chapter 6 File Handling Quiz 42 (25 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. Which operator is used to write data to a file in C++?
2. What would be the size of the following union declaration? (Assuming size of double = 8, size of int = 4, size of char = 1) #include union uTemp \{ double a; int b[10]; char c; \}u;
3. Str = "CBSE Class XII Python Examination 2024"Filein = open("myfile.txt", "w+")print("Name of the file: ", Filein.name)Filein.writelines(Str)Filein.seek(0, 0)for line in Filein:print(line)Filein.close()
4. Why do we save files?
5. What is the return type of the length() method in the File class?
6. What is a file in the context of data storage?
7. When opening a file for writing using OPENFILE "data.txt" FOR WRITE, what happens if "data.txt" already exists?
8. Files don't need to be closed when using file handling in programming
9. Write the output of the following:>>> f = open("test.txt", "w") >>> f.closed >>> f.close() >>> f.closed
10. What is the purpose of the 'seek' method in Python file handling?
11. An interrupt or forced disruption that occurs when a program is run or executed is termed as
12. What is the output of this program? #include int main()\{typedef struct tag \{char str[10];int a;\} tag;tag h1, h2 = \{ "IHelp", 10 \};h1 = h2;h1.str[1] = 'h';printf("%s, %d", h1.str, h1.a);return 0;\}
13. What is the primary function of fopen() in C programming?
14. Which mode should you use to write a binary file?
15. What will malloc() return if it fails to allocate memory?
16. Sizeof(struct) gives:
17. What is one way to avoid accidental changes to a file?
18. Which function is used to open a file in Python?
19. Which is more secure for sensitive data?
20. Explain the process of reading a file line by line in Python.
21. Fp.readlines() returns data as a
22. What does the function fgets do in file handling?
23. What does the abs() function in Python do?
24. What is the purpose of defining a function in Python?
25. What is the prerequisite knowledge before learning file handling?