Quiz Space

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

Question 2: Consider the following Python code. What will be the outp…

Question 2

+3 marksOne correct option

Consider the following Python code. What will be the output?x, y, z = "", "python", 0 print((x or y) and (z or len(y)))

  1. A

    6

  2. B

    ""

  3. C

    "python"

  4. D

    0

  5. E

    True

Show answer

Correct answer

  • A

    6

Question 2 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. Q3Consider the following python code. What will the value stored in x at the end of the program execution? python x = 5 x…
  3. Q4You have a list of lists:You want to compute the sum of all even numbers greater than 3. Consider the two code snippets…
  4. Q5Assume s\ is a str\ variable. What is the type of the expression "".join(sorted(set(s.lower()))) ?
  5. Q6Consider the following Python code:t = (5, [10, 20], (30, [40, 50],(30,))) Which of the following statements are valid?…
  6. Q7Consider the below code.if x: print('x') else: if y: if z: print('z') print('y') else: print('none') Select the possibl…
  7. 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("…
  8. 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…
  9. Q10Consider 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 | …
  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…