ABCDEFGHIJKLMNOPQRST
1
TimestampEmail AddressScoreFull NameTo open a file c:\test.txt for reading, we should give the statement:To open a file c:\test.txt for writing, we should use the statement:To open a file c:\test.txt for appending data, we can give the statement:Which of the following statements is/are true?To read two characters from a file object fobj, the command should be:To read the entire contents of the file as a string from a file object fobj, the command should be:What will be the output of the following snippet?
f = None
for i in range(5):
with open("data.txt", "w") as f:
if i > 2:
break
print(f.closed)
To read the next line of the file from a file object fobj, we use:The readlines() method returns:Which is/are the basic I/O (input-output) stream(s) in file?
2
8/30/2025 7:55:28krativerma09238@gmail.com8 / 10Krati Verma file1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.readline()Nonefobj.readline()A list of stringsAll of these
3
8/30/2025 7:56:21kp63933@gmail.com9 / 10Krishna Palfile1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.read()Errorfobj.readline()A list of stringsAll of these
4
8/30/2025 7:56:33anon39944@gmail.com8 / 10Aditya Pratap Singhfile1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.read()Errorfobj.readline()A list of stringsStandard Input
5
8/30/2025 7:57:13sharmila22pal@gmail.com5 / 10Anushka Palfile1 = open("c:\\ test.txt", "r")fobj = open("c:\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.readlines()Nonefobj.readlines()A list of single charactersAll of these
6
8/30/2025 7:57:39gaurikashyap462@gamil.com4 / 10isha verma file1= open("c:\ test.txt", "r")fobj = open("c:\test.txt", "w")fobj = open("c:\\test.txt", "a")When we open a file for writing, if the file does not exist, a new file is created.fobj.read(2)fobj.readline()TRUEfobj.readline()A list of single charactersStandard Errors
7
8/30/2025 7:59:16sakshamkat28@gmail.com5 / 10saksham katiyarfile1= open("c:\ test.txt", "r")fobj = open("c:\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read()fobj.readlines()Nonefobj.readline()A list of stringsAll of these
8
8/30/2025 7:59:52gaurikashyap462@gmail.com5 / 10gauri kashyapfile1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")When we open a file for writing, if the file does not exist, a new file is created.fobj.read(2)fobj.read()Errorfobj.read()StringStandard Input
9
8/30/2025 8:00:10riddimatiwari20@gmail.com6 / 10riddima tfile1 = open(file = "c:\ test.txt", "r")fobj = open(file = "c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")When we open a file for writing, if the file does not exist, a new file is created.fobj.read(2)fobj.read()Nonefobj.readline()A list of stringsAll of these
10
8/30/2025 8:02:04gaurikashyap462@gmail.com5 / 10gauri kashyapfile1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")When we open a file for writing, if the file does not exist, a new file is created.fobj.read(2)fobj.readline()FALSEfobj.readline()StringStandard Input
11
8/30/2025 8:02:15samaparveen17290@gmail.com5 / 10Ayanfile1= open("c:\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.readlines()FALSEfobj.read()StringAll of these
12
8/30/2025 8:03:05parthmishra@gmail.com5 / 10Parth Mishrafile1 = open("c:\\ test.txt", "r")fobj = open("c:\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.read(2)fobj.readline()Nonefobj.readline()A list of single charactersStandard Errors
13
8/30/2025 8:03:49abhijeetsengar8888@gmail.com6 / 10Abhijeet Singh Sengarfile1 = open("c:\\ test.txt", "r")fobj = open("c:\\test.txt", "w")fobj = open("c:\\test.txt", "a")All of these.fobj.readline()fobj.readlines()Nonefobj.read(2)A list of stringsAll of these
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100