Quiz Space

Python Programming · Quiz 1 · 26 Oct 2025 · September 2025 term · Set QED3

Question 10: Consider the following Python code:P = {1, 2, 3, 4} Q = …

Question 10

+3 marksNumerical answer

Consider the following Python code:P = {1, 2, 3, 4} Q = {3, 4, 5, 6} R = {4, 5, 6, 7} S = {2, 4, 6, 8}
result = ((P | Q) - R) & S print(result) How many elements will be present in result?

Show answer

Correct answer: 1

Question 10 of 14 in the IIT Madras BS Python Programming (Python (ES)) Quiz 1 paper sat on 26 Oct 2025, in the September 2025 term (IIT M ES DIPLOMA AN EXAM QED4 26 Oct). It carries 3 marks.

This question was also asked in

More questions from this paper

  1. Q1Consider the following Python code. What will be the output?s = "programming" print(s[::-1].replace("g", "#"))
  2. Q2Consider the following Python code. What will be the output?x, y, z = "", "python", 0 print((x or y) and (z or len(y)))
  3. Q3Consider the following python code. What will the value stored in x at the end of the program execution?x = 5 x = x + 2…
  4. Q4You have a list of lists:You want to compute the sum of all even numbers greater than 3. Consider the two code snippets…
  5. Q5Assume s\ is a str\ variable. What is the type of the expression "".join(sorted(set(s.lower()))) ?
  6. Q6Consider the following Python code:t = (5, [10, 20], (30, [40, 50],(30,))) Which of the following statements are valid?…
  7. Q7Consider the below code.if x: print('x') else: if y: if z: print('z') print('y') else: print('none') Select the possibl…
  8. Q8Consider the following Python code:for i in range(1, 6): for j in range(1, 6): for k in range(1, 2): if i == j: print("…
  9. Q9Consider the following Python code:for i in range(1, 5): for j in range(1, 5): if j == 3: break if i == 2: continue pri…
  10. Q11What is the value of output\ after executing the given code?
  11. Q12How many times is the inner for x in item:\ loop executed in total when running analyze(sample) ?
  12. Q13Consider the following code:def flipper(matrix): transformed = [] for row in matrix: new_row = [] for element in row: i…
  13. Q14Consider the following code:def flipper(matrix): transformed = [] for row in matrix: new_row = [] for element in row: i…