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?
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?
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'])
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?
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?
The len() function gives the number of keys and values in a dictionary.
Q6. Which brackets are used to create a dictionary?
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?
In Python, both Simple Dictionary and Nested Dictionary can be created.
Q8. Identify the Nested Dictionary from the given options?
A Nested Dictionary is one in which a dictionary exists inside another dictionary.