Class 11 Computer Science Chapter 6 File Handling Quiz 14 (60 MCQs)

Quiz Instructions

Select an option to see the correct answer instantly.

1. Differentiate between Absolute Path and Relative Path in file handling.
2. What is Java serialization?
3. What type of storage is a file typically stored in?
4. What does the "" operator do when used with a function parameter in Python?
5. What does 'a+' means in file handling?
6. Where is data typically stored to ensure it is external to the program's main data?
7. Spaces, tabs, new lines are the example of .....
8. What method is used to check if a file exists?
9. It opens the file for a read.
10. Which Is data type of file pointer is .....
11. 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)
12. What happens if the data in the text file is not in the expected format?
13. Class IT{static public void main(String ..... args){String s=null;System.out.println("length is:"+s.length());}}
14. The output sent to the file is appended to it.
15. File is created if does not exist. If the file exists, file is truncated( past data is lost). Both reading and writing operation can take place. What is the text file mode?
16. What does the 'read()' function do?
17. Which method is used to set the file handle's position within a file?
18. Which function is used to count or display words from a file?
19. File.seek(0) followed by file.read() will:
20. What is the first file handling operation mentioned in the text?
21. What does the 'open' command do in Python file handling?
22. What will be the output of the following code?def add(a, b):return a + bprint(add(5, 7))
23. Which method is used to read the entire contents of a file in Python?
24. What will be the output of the following C code#include union temp { int a; float b; char c; }; int main() { union temp s = {1, 2.5, 'A'}; printf("%c", s.c); return 0; }
25. What is the function used to read from a file in Python?
26. How can you read from a file in Python?
27. What is the function used to check if a file exists in Python?
28. What is the significance of the 'rb' mode when opening a binary file?
29. What does the 'readlines' method do in Python file handling?
30. To read 4th line from text file, which of the following statement is true?
31. What is the significance of file modes in file handling?
32. Which one of these variables has an illegal name?
33. What does the os.path.isfile() function return if the file does not exist?
34. Which of the following modes allows both reading and writing to a file?
35. Ravi opened a file in a certain mode. After opening the file, he forgot the mode. One interesting fact about that mode is '' If the file already exists, all the contents will be overwritten" . Help him to identify the correct mode.
36. What is the index of the last character in a string?
37. What are some common use cases for binary files in programming?
38. What happens if you try to write to a file that does not exist?
39. What does ftell() function return in C?
40. What is the data type of data read to and from a file?
41. Which of the following is used to read all lines in a file as a list?
42. If we want to add new data without overwriting the previous content then we should write using ..... mode
43. What is the purpose of the 'close()' function in programming languages when working with files?
44. Which of the following is not a standard exception in Python?
45. Which Python function is used to open a text file for reading?
46. A binary file stores information in ASCII or Unicode characters.
47. In which scenario would you use the 'APPEND' mode?
48. Which mode in Python is used to open a file for reading?
49. How can you read a file using a context manager?
50. The ..... character is used to seprate the values in TSV files.
51. Kamut accidentally used "w" mode on a project file that contains important information. What is the immediate risk?
52. Files need to be closed when using file handling in order to save data
53. What does the 'read ..... text()' method do?
54. The read() is indicate .....
55. What is the use of tell() method in Python?
56. Which function is used to close the file?
57. Which command is used to close an open file in a program?
58. What is the difference between absolute and relative paths?
59. Which step is necessary after writing to a file?
60. What is a CSV file and how is it different from a text file?