mcq on dictionary in python class 11

In Class 11, many MCQ questions are asked from the Python Dictionary topic. If you prepare this topic well, you will definitely see its benefits in the exam. This test has been designed according to your Python syllabus.

Q1. What is the correct syntax to create a Dictionary?

d = {'a': 1, 'b': 2}
d = ['a': 1, 'b': 2]
d = ('a': 1, 'b': 2)
none of these
✅ Correct Answer: d = {'a': 1, 'b': 2}

A dictionary works in key-value pairs and it is created inside {} (curly braces).

Q2. In the given code d = {'a': 1, 'b': 2}, which one is a key?

d
a
1
:
✅ Correct Answer: a

In a Python dictionary, keys are written inside quotes and represent the identifier for values.

Q3. What will be the output of the given code? d = {'a': 1, 'b': 2, 'c': 3, 'd': 4} print(d['a'])

1
2
3
4
✅ Correct Answer: 1

In the given code, the key 'a' from the dictionary is printed. It returns its value, so the output will be 1.

Q4. Identify the dictionary from the given options?

d=[1,2,34,,56,7]
d = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
d = ('a': 1, 'b': 2, 'c': 3, 'd': 4)
d=(2,3,4,5,6,7,7)
✅ Correct Answer: d = {'a': 1, 'b': 2, 'c': 3, 'd': 4}

A dictionary is created using key-value pairs and is written inside curly braces {}.

Q5. Which function is used to find the length of a dictionary?

len
length
leg
none of these
✅ Correct Answer: len

The len() function gives the number of keys and values in a dictionary.

Q6. Which brackets are used to create a dictionary?

Curly Braces
Square Brackets
Parentheses
all of these
✅ Correct Answer: Curly Braces

To create a dictionary, we use {} (curly braces), and inside them we define key-value pairs.

Q7. Which type of dictionary can be created in Python?

Simple Dictionary
Nested Dictionary
Both A and B
None of these
✅ Correct Answer: Both A and B

In Python, both Simple Dictionary and Nested Dictionary can be created.

Q8. Identify the Nested Dictionary from the given options?

{"a": 1, "b": 2}
{"a": [1, 2, 3]}
{"a": {"x": 10, "y": 20}}
{"a": 1, "b": [2, 3]}
✅ Correct Answer: {"a": {"x": 10, "y": 20}}

A Nested Dictionary is one in which a dictionary exists inside another dictionary.