NEW
Font size
WorksheetsLesson 43 - Dictionary Datatype 1
Total questions: 10
Worksheet time: 5mins
Which of the following is not true ?
set can have a element multiple times.
tuple is mutable
dictionary is set of key value pair
All of the above
Which of the following way is used to add elements to the dictionary ?
a['1']=30
a['22.5']=40
a['rohit']=25
All of the above
which of the following statement is true ?
Dictionary can have same value multiple times with unique keys
Dictionary can have same key multiple times with unique values
Dictionary is immutable in nature
none
a={'rohit': 70, 'rahul': 100, 'rohan': 80}
From above dictioary 100 can be accessed by -
a['rahul']
a['1']
a['rahul'] and a.get("rahul")
none
What will be the output of following code ?
x={'rohit': 20, 'rahul': 25, 'rohan': 30}
for i in x:
print(i)
rohit
rahul
rohan
20
25
30
rohit:20
rahul:25
rohan:30
none
What will be the output of the following code -
x={'rohit': 20, 'rahul': 25, 'rohan': 30}
for i in x.values():
print(i)
rohit
rahul
rohan
20
25
30
rohit 20
rahul 25
rohan 30
none
What will be the output of the following code ?
x={'rohit': 20, 'rahul': 25, 'rohan': 30}
for x, y in x.items():
print(x, y)
rohit
rahul
rohan
20
25
30
rohit 20
rahul 25
rohan 30
none
What will be the output of the following code ?
x="rohit"
y=list(x)
for i in range(len(x)):y[i]=x[(i+3)%len(x)]
s=""
for i in y:s+=i
print(s)
tihor
rohit
itroh
roiht
An empty set can be created by which of the following ways ?
s={}
s=set()
s=()
s=[]
What will be the output of the following code ?
a={"rohit":70,"rahul":75,"rounak":80}
print(a["notchup"])
key error
syntax error
value error
none
