Sequences and File Operations Python QuizIl
1 Predict the output.
X=input(Enter a number)
y=input(Enter another number)
Z=10
value= (x*y)+Z
print(value, type(value)
Assume the values enteredhare 5 and 6.
40, int
3010 str
5610str
Error
T y p e here to search
se Classroom | Edureka +
C alearning-tnsdc.edureka.co/classroom/quiz/4/162/1723?tab=CourseContent
assroom Data Science CourseContent
Sequences and File Operations Python Quizil
2 Consider a file with the name File1.txt. It has the content 'Edureka' OMarks
I want to make the content as 'Edureka Rocks'and print the content. Choose the correct option
for this operation
fo-open(ile1.txtw)
fo.appendCRocks)
data-fo.read)
print(data) Your Answer
fo=open(File1.txt,w+)
fo.write(Rocks)
data=fo.read0
print(data)
fo=open('File1.txt,a)
fo.write( Rocks)
fo.close()
fo=open('File1.txtr)
data=fo.read)
Correct Answer
print(data)
Previs Ne
CourseContent
1Ssroom Data Science
Sequences and File Operations Python QuizI
3 Consider a file with the name File2.txt.It has the content 'Edureka'
Smith has executed the below code.
file_obj=open(File2.txt,r)
while True:
line data=file obj.read(1)
ifline data:
print(line_data+\n)
else
break
fo-open(CFile2.txt)
data-fo.read)
for i in data
print()
( fo-open(File2.txt)
data=fo.read()
while True
for i in data
Previous
room Data Science CourseContent
Sequences and File Operations Python Quiz l
for i in data
print)
fo-open(File2.txt)
data-fo.read()
while True
for i in data
printn)
break
fo=open(File2 txt)
data=fo.read()
while True
for i in data
print(i)
break Your Answer
fo-openFile2txt)
data-fo.read)
for i in data
printin) Correct Answer
OView explanation
Previous Ne
Sequences and File Operations Python QuizI
4 Predit the output
fileobj=open(File2.txtr)
print(file obj.tell0)
fileobj.read0
print(fileobj.tell)
output file obj.read()
whileTrue:
for iin output:
print(output)
break
Assume the Content of the fileis Edureka
Infiniteloop
XInfinite loop
6
Edureka
OView explanation
Previa
Type here to search
Sequences and File Operations Python Quiz Il
5 Consider the below code.
list1=[1,2,1,3,4,5,5,6]
list2-[7,5,3,10,2,2,3,4
list3-1
for i in range (0,len(list1):
for j in range(0,len (list2):
if(list2l==list1[|):
if(list1] not in list3)
list3.append(list1 [i
set(set(list1) | set(list2)
list(set(list1) &set(list2)
list(set(list1) - set(list2))
set(set(list1) - set(list2)
Previs
mtent
Sequences and File Operations Python Quiz I
6 Consider the below code:
list1=[10,20,30]
list2=[40,50,60]
list1.append(list2)
list1:-1]
printlist1)
Choose the option which will give the same output as the mentioned code
list1=[10,20,30]
list2=[40,50,60]
list1.append(list2)
list1.reverse)
print(list1)
listi=[10,20,30]
list2=[40,50,60)
list1.extend(list2)
list1.sort0
printlist1)
list2-140,50,60]
list1append(list2)
list1.reverse)
print(list1)
list1=110,20,30]
list2 40,50,60]
listi.extend(list2)
list1.sort0
print(listi)
list1=[10,20,30]
list2-[40,50,60]
list1.append(list2)
print(list1)
listi [10,20,301
list2-140,50,60]
list1appendlist2)
sorted(list1)
print(list1)
K View explanation
Previou
ralions
Python Quiz I
7 Predict the output:
tuple 1 ((10,20],130,40],60,70,(80,90)) #
Line1
tuple 1=list(tuple 111)
tuple_113][1]=100 #Line 3
tuple_1
[(80, 90) 70, 60,130 1001 [10, 20]
Error at Line 3. Tuple doesnt suPport assignment
Errorat Line invalid tuple cleclaratio
80 90), 70, 60, 130,401,110,20
View explanation
Pre
8 Predict the output
str1 Edureka'
str1.upper()
list1=str1.split(a)
print(list1)
Errorin split function
Edurek,
EDUREK
TEdurek]
O View explanation
Sequenoes and File Operations Python Quiz1
9 Predict the ouput
dict1-{A:[100,200],"B":
del dict1 [B]
(200,300) C"(300,300,400}
print(dict1.get C500))
print(dict1.get("B")
Error invalid dictionary values
500
Error
{400, 300
None
500
None
learning-tnsdc.edureka.co/classroom/quiz/4/162/1723?tab=CourseContent
Data Science CourseContent
ences and File Operations Python Quiz ll
10 Consider the following statements: 0 Marks
i) Dictionary keys have to be unique but it can be mutable
in) Deletion of any value won't result in deleting the key. The key will be there with the value None
Choose the correct option
Only i
Only ii
Your Answer
Bothi and ii
Correct Answer
Neither i nor i
OView explanation
Previous Finish