Question 143

What is the output? d = {'a': 1, 'b': 2}

What is the output? d = {'a': 1, 'b': 2} print(d.get('c', 0))
  1. ANone
  2. BKeyError
  3. C0
  4. D2
Show answerHide answer

Correct answer: (C) 0

Explanation

get() returns the default when the key is missing.

From DSSSB TGT Computer Science Full Mock Test 4

This is question 143 of DSSSB TGT Computer Science Full Mock Test 4. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.