Tag: Dictionary
-
Python Questions and Answers – Dictionary – 4
Python Multiple Choice Questions & Answers (MCQs) focuses on “Dictionary – 4”. Q 1. The following Python code is invalid. class demo(dict):def __test__(self,key):return []a = demo()a[‘test’] = 7print(a)A. TrueB. False Show Answer Answer:-B. False Explanation The output of the code is: {‘test’:7}. Q 2. What will be the output of the following Python code? count={}count[(1,2,4)]…
-
“Python Questions and Answers – Dictionary – 3
Python Multiple Choice Questions & Answers (MCQs) focuses on “Dictionary – 3”. Q 1. Which of the statements about dictionary values if false?A. More than one key can have the same valueB. The values of the dictionary can be accessed as dict[key]C. Values of a dictionary must be uniqueD. Values of a dictionary can be…
-
Python Questions and Answers – Dictionary – 2
Python Multiple Choice Questions & Answers (MCQs) focuses on “Dictionary – 2”. Q 1. Which of these about a dictionary is false?A. The values of a dictionary can be accessed using keysB. The keys of a dictionary can be accessed using valuesC. Dictionaries aren’t orderedD. Dictionaries are mutable Show Answer Answer:-B. The keys of a…
-
Python Multiple Choice Questions – Dictionary
Python Multiple Choice Questions & Answers (MCQs) focuses on “Dictionary”. Q 1. Which of the following statements create a dictionary?A. d = {}B. d = {“john”:40, “peter”:45}C. d = {40:”john”, 45:”peter”}D. All of the mentioned Show Answer Answer:-D. All of the mentioned Explanation Dictionaries are created by specifying keys and values. Q 2. What will…