Professional Documents
Culture Documents
Suppose root directory (School) and present working directory are the same. What will be the
absolute path of the file Syllabus.jpg?
a. School/syllabus.jpg b. School/Academics/syllabus.jpg
c. School/Academics/../syllabus.jpg d. School/Examination/syllabus.jpg
29. What will be the data type of data_rec?
myfile = open("Myfile.txt",”w”)
myfile.writelines(data_rec)
myfile.close().
a. String b. Tuple
c. list d. dictionary
30. Myfile.txt contains : India is my country and all Indians are my brothers and sisters.
What will be the output of the following code?
myfile = open("Myfile.txt")
vlist = list("aeiouAEIOU")
vc=0
x = myfile.read()
for y in x:
if (y in vlist):
vc+=1
print(vc)
myfile.close()
a. 20 b. 19 c. 18 d. 21
31. Myfile.txt contains: India is my country and all Indians are my brothers and sisters.
What will be the output of the following code?
myfile = open("Myfile.txt")
x=myfile.read()
print(myfile.tell())
myfile.close()
e. 64 f. 65 g. 66 h. 67
32. To force python to write the contents of file buffer on to storage file,........method may be
used.
a. Buffer() b. Close()
c. Flush() d. Open()
33. What is the difference between r+ and w+ modes?
a. In r+ mode, file length truncates to zero
b. In w+ mode, file length truncates to zero either file exists or not.
c. No difference
d. Depends on the operating system