Quiz Space

Programming in Python · Quiz 1 · 26 Oct 2025 · September 2025 term · Set 2

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

Question 4

+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 4 of 18 in the IIT Madras BS Programming in Python (Python) Quiz 1 paper sat on 26 Oct 2025, in the September 2025 term (IIT M IMPROVEMENT AN EXAM QIA4 26 Oct). It carries 3 marks.

This question was also asked in

More questions from this paper

  1. Q1THIS IS QUESTION PAPER FOR THE SUBJECT "FOUNDATION LEVEL : INTRODUCTION TO PYTHON (COMPUTER BASED EXAM)" ARE YOU SURE Y…
  2. Q2Useful InformationNAT → integerFor all NAT questions in this exam, the answer will always be an integer and not a float…
  3. Q3Consider the following Python code. What will be the output?s = "programming" print(s[::-1].replace("g", "#"))
  4. Q5Consider the following python code. What will the value stored in x at the end of the program execution?x = 5 x = x + 2…
  5. Q6You have a list of lists:You want to compute the sum of all even numbers greater than 3. Consider the two code snippets…
  6. Q7Assume s is a str variable. What is the type of the expression "".join(sorted(set(s.lower()))) ?
  7. Q8Consider the following Python code:t = (5, [10, 20], (30, [40, 50],(30,))) Which of the following statements are valid?…
  8. Q9Consider the below code.if x: print('x') else: if y: if z: print('z') print('y') else: print('none') Select the possibl…
  9. Q10Consider 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("…
  10. Q11Consider 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…
  11. Q12Consider 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…
  12. Q13What is the value of output after executing the given code?
  13. Q14How many times is the inner for x in item: loop executed in total when running analyze(sample) ?
  14. Q15Consider the following code:def flipper(matrix): transformed = [] for row in matrix: new_row = [] for element in row: i…
  15. Q16Consider the following code:def flipper(matrix): transformed = [] for row in matrix: new_row = [] for element in row: i…
  16. Q17Consider the following snippet of code and answer the given sub-questions:def analyze(data): result = [] for item in da…
  17. Q18Consider the following code:def flipper(matrix): transformed = [] for row in matrix: new_row = [] for element in row: i…