# MCQs For NCERT Class 11 Computer Science Chapter 9 Dictionaries

Please refer to the MCQ Questions for Class 11 Computer Science Chapter 9 Dictionaries with Answers. The following Dictionaries Class 11 Computer Science MCQ Questions have been designed based on the latest syllabus and examination pattern for Class 11. Our experts have designed MCQ Questions for Class 11 Computer Science with Answers for all chapters in your NCERT Class 11 Computer Science book.

## Dictionaries Class 11 MCQ Questions with Answers

See below Dictionaries Class 11 Computer Science MCQ Questions, solve the questions and compare your answers with the solutions provided below.

Question: Which of the following is not true about dictionary keys?
(a) More than one key is not allowed.
(b) Keys must be immutable.
(c) Keys must be integers.
(d) When duplicate keys encountered, the last assignment wins.

C

Question: Suppose d = {“Rahul”:40, “Riya”:45}.
To obtain the number of entries in dictionary which command do we use?
(a) d.size()
(b) len(d)
(c) size(d)
(d) d.len()

B

Question: What will be the output of the following Python code snippet?
dict1={}
dict1[‘a’]=1
dict1[‘b’]=[2,3,4]
print(dict1)
(a) Exception is thrown
(b) {‘b’: [2], ‘a’: 1}
(c) {‘b’: [2], ‘a’: [3]}
(d) {‘b’: [2, 3, 4], ‘a’: 1}

D

Question: What will be the output of the following Python code?
a={1:5,2:3,3:4}
a.pop(3)
print(a)
(a) {1: 5}
(b) {1: 5, 2: 3}
(c) Error, syntax error for pop() method
(d) {1: 5, 3: 4}

B

Question: What will be the output of the following Python code snippet?
d1 = {“Neha”:86, “Yash”:92}
d2 = {“Neha”:86, “Yash”:88}
d1 > d2
(a) True
(b) False
(c) Error
(d) None

C

Question: What will be the output of the following Python code?
Dic1={}
Dic1[2]=85
Dic1[1]=[22,23,24]
print(Dic1[1][1])
(a) [22,23,24]
(b) 23
(c) 22
(d) Error

B

Question: What will be the output of the following Python code?
>>> dic1={}
>>> dic1.fromkeys([1,2,3],“Hello”)
(a) Syntax error
(b) {1:”Hello”,2:”Hello”,3:”Hello”}
(c) “Hello”
(d) {1:None,2:None,3:None}

B

Question: What will be the output of the following Python code snippet?
d = {“Neha” : 140, “Paras” : 145}
print(list(d.keys()))
(a) [“Neha”, “Paras”]
(b) [“Neha” : 140, “Paras” : 145]
(c) (“Neha”, “Paras”)
(d) (“Neha” : 140, “Paras” : 145)

A

Question: What will be the output of the following Python code?
dic1 = {0: ‘One’, 1: ‘Two’, 2: ‘Three’}
for x, y in dic1:
print(x, y)
(a) 0 1 2
(b) One Two Three
(c) 0 One 1 Two 2 Three
(d) Error

D

Question: What is the output of following code?
>>> dic = {‘A’ : ‘One’, ‘B’ : ‘Two’ , ‘C’ : ‘Three’ }
>>> dic.keys ( )
(a) [‘B’, ‘C’, ‘A’]
(b) dict_keys [(‘B’, ‘C’, ‘A’)]
(c) dict_keys ([‘B’, ‘C’, ‘A’])
(d) keys ([‘B’, ‘C’, ‘A’])

C

Question: What will be the output of the following Python code snippet?
dic1 = { 1 : ‘One’, 2 : ‘Two’, 3 : ‘Three’}
dic1 = {}
print (len(dic1))
(a) 1
(b) 0
(c) 3
(d) 2

B

Question: d1={“abc”:5,“def”:6,“ghi”:7}
print(d1[0])
What will be the output of above Python code?
(a) abc
(b) 5
(c) {“abc”:5}
(d) Error

D

Question:Which one of the following is correct?
(a) In Python, a dictionary can have two same keys with different values.
(b) In Python, a dictionary can have two same values with different keys.
(c) In Python, a dictionary can have two same keys or same values but cannot have two same key-value pair.
(d) In Python, a dictionary can neither have two same keys nor two same values.

B

Question: Keys of a dictionary are
(a) mutable
(b) immutable
(c) Both
(a) and (b)
(d) None of these

B

Question: Which of these about a dictionary is false?
(a) The values of a dictionary can be accessed using keys.
(b) The keys of a dictionary can be accessed using values.
(c) Dictionaries are not ordered.
(d) Dictionaries are mutable.

C

Question: Dictionaries are also called
(a) mappings
(b) hashes
(c) associative arrays
(d) All of these

D

Question: Which function returns the value for the given key, if present in the dictionary?
(a) items()
(b) get()
(c) clear()
(d) keys()

B

Question: …… method is used to delete key and respective value from dictionary.
(a) del()
(b) delete()
(c) pop()
(d) remove()

C

Question: A dictionary is used to ……… things you want to store the keys you need to get them.
(a) map
(b) associate
(c) Both
(a) and (b)
(d) None of these

B

Question: Each key-value pair in a dictionary is separated by
(a) ;
(b) :
(c) ,
(d) <

B

Question: Which type of brackets are used to create dictionary?
(a) [ ]
(b) ( )
(c) < >
(d) { }

D

Question: Which of the following dictionary means putting a dictionary inside another dictionary?
(a) Nested
(b) Sub
(c) Classic
(d) Internal

A

Question: What will be the output of following code?
dic = {“Ansh” : 25, “Ritu” : 26}
dic [‘Ritu’]
(a) 25
(b) 26
(c) Ritu : 26
(d) “Ritu” : 26

B

Question: ……… operators are used with dictionary to check whether a specific key is present in dictionary or not.
(a) Comparison
(b) Membership
(c) Logical
(d) Access

B

Question:  Consider the following dictionary :
dic = {1 : [45, 89, 65],‘A’ : (23, 45, 6)}
Based on the above code, answer the following questions.

Question: Choose the correct option of given statement.
print (dic.values())
(a) ([45, 89, 65], (23, 45,6))
(b) dict_values ([45, 89, 65]), (23, 45, 6))
(c) dict_values ([[45, 89, 65], (23, 45, 6)])
(d) dict ([[ 45, 89, 65],(23, 45, 6)])

C

Question: Which output is best suited for given statement?
dic.get (‘A’)
(a) 23, 45, 6
(b) (23, 45, 6)
(c) [23, 45, 6]
(d) Error

B

Question: Identify the output of len(dic).
(a) 2
(b) 6
(c) 8
(d) None of these

A

Question:Find the output.
print (dic.keys())
(a) dict_keys ([‘A’, 1])
(b) dict_key (‘A’, 1)
(c) dict_keys (‘A’, 1)
(d) dict_key [‘A’, 1]