Test Index

CBSE Class 12 Computer Science 2025 Paper Set 4 Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 12 of 37
Marks: +1, -0
Which of the following built-in function/method returns a dictionary ?
Solution:  
Explanation:
dict() creates and returns a dictionary, e.g. dict(a=1) → {'a': 1}.
keys(), values() and items() return view objects (dict_keys, dict_values, dict_items), not dictionaries.
>>> type(dict())
<class 'dict'>
>>> type({'a': 1}.keys())
<class 'dict_keys'>
Answer:
Option A (dict())
© examsnet.com
Advertisements
Go to Question: