GATE DA Python Data Structures & Collections | Set 1

Questions 31-35 of 100

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

Question 31

MCQ · Single Correct 1 mark
Previous Year Question GATE DA 2025 PYQ
PYTHON
Consider sets A, B, C defined as:
A = {1, 2, 3}
B = {2, 3, 4}
C = {3, 4, 5}
What is the output of <code class="cbt-inline-code">print((A & B) | C)</code>?
Answers for question 31

Question 32

NAT · Numerical Answer 1 mark

What is the output of the following code snippet?

tup = (10, 20, 30, 40)
a, *b, c = tup
print(sum(b))

Answers for question 32

Question 33

MCQ · Single Correct 1 mark

What will happen when executing the code below?

PYTHON
d = {'x': 1, 'y': 2}
print(d['z'])
Answers for question 33

Question 34

NAT · Numerical Answer 1 mark

Calculate the value printed by len(d) after execution:

PYTHON
d = {x: x**2 for x in range(10) if x % 2 == 0}
print(len(d))
Answers for question 34

Question 35

MCQ · Single Correct 1 mark

What is the output of the set mutation method s.discard(x) vs s.remove(x) when x is NOT in set s?

Answers for question 35
Scroll to Top