Test Index

CBSE Class 12 Computer Science 2026 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 8 of 37
Marks: +1, -0
Consider the statements given below and then choose the correct output from the given options :
K=('A','B')
V='TEST'
D = dict.fromkeys(K, V)
print(D)
Solution:  
Concept:
dict.fromkeys(keys, value) creates a dictionary with every element of keys as a key and the same value for all of them (None if no value is given).
Explanation:
Keys: 'A', 'B'; common value: 'TEST'.
Output:
{'A': 'TEST', 'B': 'TEST'}
Key point: The string 'TEST' is not split over the keys; the whole value goes to every key.
Answer:
Option C ({'A':'TEST', 'B':'TEST'})
© examsnet.com
Advertisements
Go to Question: