Question 1
Consider the following code snippet.
What will be the output?
1 1
2 2
1 2
Error

The IIT Madras BS Programming in Python (Python) End Term paper sat on 13 Sept 2026, in the May 2026 term, set 1: 17 questions for 48 marks in 180 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 snippet.
What will be the output?
1 1
2 2
1 2
Error
Correct answer
2 2
Hari runs a yoga class and grades students into levels based on a flexibility score out of 100.
Which of the following snippets correctly compute and print the level after accepting the score as input? Assume the input entered will always be an integer in the range [0,100]. Snippet-1
Snippet-2
Snippet-3
Snippet-1 and Snippet-2 are correct, Snippet-3 is incorrect.
Only Snippet-1 is correct.
Snippet-1 and Snippet-3 are correct, Snippet-2 is incorrect.
All three snippets are correct.
Correct answer
Snippet-1 and Snippet-2 are correct, Snippet-3 is incorrect.
Consider the following code.
What is the output?
5 B KeyError
4 C E
2 C E
2 A D
Correct answer
2 C E
Govinda runs a fruit stall. Each day he sells fruit and restocks.
What is the output?
Correct answer
Consider the following program.
Which of the following statements correctly explains why the printed value is obtained?
Correct answer
Consider the following code snippet.
What is printed?
2 3
3 3
2 2
Error
Correct answer
2 3
Madhava maintains a ledger file for the shop.
There are 4 lines in the output.
The output contains empty lines.
Correct answers
There are 4 lines in the output.
You are reviewing a connection-manager script for a load balancer.
Which of the following statements are true at the end of the script?
Correct answers
Consider the following code snippet.
What is the output produced by the above code?
Correct answer: 12
Consider the following code.
What is the output of the above code?
Correct answer: 20
In order to protect secrecy, OTPs are often encrypted across the network. Caesar cipher is one such encryption technique.
Consider the following code.
What is the output of the above code?
Correct answer: 2075
How many characters does the file contain after complete execution?
Correct answer: 14
Consider the following code.
What is the output of the above code?
Correct answer: 9
Example:
The following program processes the file.
Correct answer
Example:
The following program processes the file.
Replace with
(A figure from the original paper is missing from the source site.)
Replace with
(A figure from the original paper is missing from the source site.)
(A figure from the original paper is missing from the source site.)
Replace with
(A figure from the original paper is missing from the source site.)
Correct answer
Replace with
(A figure from the original paper is missing from the source site.)
Allowed : No Group Comprehension Questions : No Question Pattern Type : NonMatrix A university stores information about students as a list of dictionaries. A student is allotted an elective only if: the student's CGPA is at least 8, and• the requested course has remaining seats.•
Based on the above data, answer the given subquestions
Which ONE of the following statements must be true after execution?
Every student having CGPA ≥ 8 receives a course.
Every course requested by at least one eligible student has zero remaining capacity.
Correct answer
Allowed : No Group Comprehension Questions : No Question Pattern Type : NonMatrix A university stores information about students as a list of dictionaries. A student is allotted an elective only if: the student's CGPA is at least 8, and• the requested course has remaining seats.•
Based on the above data, answer the given subquestions
Suppose the order of students in the list is changed arbitrarily, while keeping every student's information unchanged. Which ONE of the following statements is correct?
The set of allotted students is guaranteed to remain unchanged.
The number of allotted students is guaranteed to remain unchanged, but the students receiving a particular course may change.
Correct answer
The number of allotted students is guaranteed to remain unchanged, but the students receiving a particular course may change.