Question 1
Consider the following code:
What will be the output?
—
—
—
—

The IIT Madras BS Programming in Python (Python) Quiz 1 paper sat on 15 Mar 2026, in the January 2026 term: 32 questions for 104 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following Python code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following Python code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following code:
What will be the output?
—
—
—
—
Correct answer
—
Consider the following Python code:
Which of the following statements are true?
The final value of is
The character increases by
The letter increases the value of by and the character increases by
The letter increases the value of by and the character increases by
Correct answers
The final value of is
The character increases by
The letter increases the value of by and the character increases by
Consider the following Python code:
Which of the following statements are true?
The final value of is
The character increases by
The letter increases the value of by and the character increases by
The letter increases the value of by and the character increases by
Correct answers
The final value of is
The character increases by
The letter increases the value of by and the character increases by
Consider the following Python code:
Which of the following statements are true?
The output of the first statement is
The output of the second statement is
The default value of is used in the second function call
The function returns two values as a tuple
The output of the second statement is
Correct answers
The output of the first statement is
The function returns two values as a tuple
The output of the second statement is
Consider the following Python code:
Which of the following statements are true?
The output of the first statement is
The output of the second statement is
The default value of is used in the second function call
The function returns two values as a tuple
The output of the second statement is
Correct answers
The output of the first statement is
The function returns two values as a tuple
The output of the second statement is
What is the output of the following snippet of code?
A written answer, not marked automatically.
What is the output of the following snippet of code?
A written answer, not marked automatically.
Consider the following snippet of code. What will the output be?
A written answer, not marked automatically.
Consider the following snippet of code. What will the output be?
A written answer, not marked automatically.
What is the output of the following snippet of code? Note: :checks whether an object belongs to a given type or any of its subclasses.
A written answer, not marked automatically.
What is the output of the following snippet of code? Note: :checks whether an object belongs to a given type or any of its subclasses.
A written answer, not marked automatically.
What is the output of the following snippet of code?
A written answer, not marked automatically.
What is the output of the following snippet of code?
A written answer, not marked automatically.
Consider the following snippet of code and answer the sub-questions:
What is the value of after executing the given code?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
What is the value of after executing the given code?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
In the given code, if we change the condition to instead of , what will be the value of ?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
In the given code, if we change the condition to instead of , what will be the value of ?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
What are the values of and after executing the given code?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
What are the values of and after executing the given code?
—
—
—
—
Correct answer
—
Consider the following snippet of code and answer the sub-questions:
Which of the following statements are true?
Both and are substrings of
The expression evaluates to
The comparison ignores uppercase and lowercase letters
The expression evaluates to
Correct answers
Both and are substrings of
The expression evaluates to
Consider the following snippet of code and answer the sub-questions:
Which of the following statements are true?
Both and are substrings of
The expression evaluates to
The comparison ignores uppercase and lowercase letters
The expression evaluates to
Correct answers
Both and are substrings of
The expression evaluates to
Consider the following snippet of code and answer the sub-questions:
A written answer, not marked automatically.
Consider the following snippet of code and answer the sub-questions:
A written answer, not marked automatically.
Consider the following snippet of code and answer the sub-questions:
A written answer, not marked automatically.
Consider the following snippet of code and answer the sub-questions:
A written answer, not marked automatically.