Dictionary in Python Quiz #3

Share with others

Enter details and click on Next

Name
Email
School Name
Q21. The following code will return data as __________

B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"}
print(B.values())

Q22. Write the output of the following code :

A = {1 : "One", 2 : "Two", 3 : "Three"}
B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"}
A.update(B)
#print(B.values())
print(B)

Q23. Write the output of the following code :

A = {1 : "One", 2 : "Two", 3 : "Three"}
B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"}
print(A.get(4,"Key Not Found"))

Q24. Write the output of the following:

A = {1 : "One", 2 : "Two", 3 : "Three"}
B = {'A' : "Apple", 'B' : "Bat", 'C' : "Cat", 'D' : "Doll"}
for i in A:
print(i)

Q25. Which statement is not correct for the following code?

A = {1 : "One", 2 : "Two", 3 : "Three"}
A[4] = "Four"

Q26. There is no index value in dictionary like we have in List.(T/F)

Q27. The following code is an example of ___________________

N = {A: {'name': 'Ravi', 'age': '5', 'sex': 'M'}, B: {'name': 'Golu', 'age': '2', 'sex': 'F'}}

Q28. pop( ) function delete and _______ the element of dictionary.

Q29. Which of the following is not method of dictionary?

Q30. Write the output of the following code :

A = {1 : "One", 2 : "Two", 3 : "Three"}
print(A[2] + A[1])


Share with others

Leave a Reply

error: Content is protected !!