WorksheetsLesson 42-Various opening modes in file
Total questions: 10
Worksheet time: 5mins
What will be the ouput -
f=open('abc.txt','w')
x=f.read()
f.close()
print(x)
Error(not readable)
Error(not writable)
It will read all the data of the file.
none
What will be the output-
f=open('abc.txt','a')
text="xyz"
f.write(text)
f.close()
Writing into the file without erasing old content
Writing into the file by erasing old content
reading from the file without erasing old content
reading from the file by erasing old content
If you will have to store marks of 10 students then which python datatype will you use ?
Dictionary
set
list
string
If you will have to store roll numbers of all the students, then which python datatype will you use ?
set
Dictionary
list
tuple
Which operator used to compares equality ?
==
=
<
>
What will be the output-
x=""
if(!x):
print("hello")
else:
print("bye")
hello
bye
error
none
which function is used to find the length of the list ?
len()
size()
length()
none
Which logical operator is used to checks for each and every condition is true ?
and
or
not
none
Which logical operator used to check for any one condition to be true ?
or
and
not
none
Which of the following operator is used for negation ?
!
not
both ! and not
none
