GATE DA Python Data Structures & Collections | Set 1

Questions 41-45 of 100

0% completed (0/100 answered)
Your score 0/100 0 answered
Correct 0 Incorrect 0 Unanswered 100 Accuracy 0%

Question 41

MCQ · Single Correct 1 mark

What will be printed by the following code snippet?

keys = ['a', 'b', 'c']
vals = [1, 2]
d = dict(zip(keys, vals))
print(d)

Answers for question 41

Question 42

NAT · Numerical Answer 1 mark

Find the output value of total:

CODE
d = {'p': 5, 'q': 10, 'r': 15}
total = sum(d.values()) - len(d)
Answers for question 42

Question 43

MCQ · Single Correct 1 mark

Which set operation corresponds to the operator - in Python (s1 - s2)?

Answers for question 43

Question 44

MCQ · Single Correct 1 mark

What will happen if we execute d = {}; d[[1, 2]] = 'val'?

Answers for question 44

Question 45

NAT · Numerical Answer 1 mark

Evaluate len(s) after set comprehension:

PYTHON
s = {x % 4 for x in range(20)}
print(len(s))
Answers for question 45
Scroll to Top