Ds301222 #quiz (21/02/2023)

1)What will be the output:

li=[1,2,3,4]
tup=(1,2,3,4,li)
li.append(6)
print(li)
print(tup)

OUTPUT:-
[1, 2, 3, 4, 6]
(1, 2, 3, 4, [1, 2, 3, 4, 6])

2)What is a correct syntax to return the first character in a string?
a) x=“Hello”.sub(0,1)
b) x=sub(“Hello”,0,1)
c) x=“Hello”[0]

Ans:- c)

3)Which method can be used to return a string in upper case letters?
a) toUpperCase()
b) upperCase()
c) upper()
d) uppercase()

Ans:- d)

4)Which collection is ordered , provide changes
a)list
b)set
c)dict
d)tuple

Ans:- a)b)c)

5)Which statement is used to stop a loop
a)break
b)continue
c)stop
d)pause

Ans:- a)

2 Likes

All correct @vaishu.swap10112016