DS301222 Quiz given on 21/02/23

1)What will be the output:

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

ans :- [1,2,3,4]
(1,2,3,4,[1,2,3,4])

2)What is a correct syntax to return the first character in a string?

x="Hello".sub(0,1)
x=sub("Hello",0,1)
x="Hello"[0]

ans:- “Hello”[0]

3) which method can be used to return a string in upper case letters?

toUpperCase()
upperCase()
upper()
uppercase()

ans :- upper()

Which collection is ordered , provide changes

1)list
2)set
3)dict
4)tuple

ans:- list,set,dict

Which statement is used to stop a loop

1)break
2)continue
3)stop
4)pause

#ans : - 1)break

3 Likes

Correct @nithinsnty1998

2 Likes

@parkar-ta-ds In Ques :1 maybe he will get answer as

[1, 2, 3, 4, 6]
(1, 2, 3, 4, [1, 2, 3, 4, 6])

2 Likes

Yes @sriv.ansh
Please correct your Q1 @nithinsnty1998

1 Like

ok, will correct it
Thank you

1 Like