Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Programming in Python
Expressions, types & strings
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- NAT: Numerical response. No negative marking.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
Quiz 1 · 26 Oct 2025 (AN)Quiz 1
Useful Reference Data for this Paper
Useful Information
NAT → integer
For all NAT questions in this exam, the answer will always be an integer and not a float value. If the answer to a question is 18, then just enter that value. Do not enter 18.0
Q1MCQ3 Marks·Choose one optionConsider the following Python code. What will be the output? s = "programming" print(s[::-1].replace("g", "#"))
- A#nimmarrop#
- B#nimmar#orp
- Cprogrammin#
- Dgni#marropg
- Q2MCQ3 Marks·Choose one 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)))
- A6
- B""
- C"python"
- D0
- ETrue
- Q3MCQ3 Marks·Choose one option
Consider the following python code. What will the value stored in _xat the end of the program execution? x = 5 x = x + 2.0 x = str(x) + "3" x = x * 2 x = [x] x = x + [10]
- A['7.03', '7.03', 10]
- B['7.03', 10]
- C['7.037.03']
- D['7.037.03', 10]
- Q4MCQ4 Marks·Choose one option
Assume _s is a _(str) variable. What is the type of the expression "".join(sorted(set(s.lower()))) ?
- Aint
- Bset
- Clist
- Dbool
- Estr
- FNoneType
- GThe code raises an error.
End Term · 31 Aug 2025 (FN)End Term
- Q5MCQ3 Marks·Choose one option
What will be the output of the following Python code? words = ["jacket", "cap", "scarf", "hat", "sock"] result = [] for idx, word in enumerate(words): if idx % 2 == 0: result.append(word[:2].upper() + str(idx)) elif len(word) > 4: result.append(word[::-1][:3]) else: result.append("0" + word[-1]) print(result)
- A['JA0', 'pa0', 'SC2', 'tah', 'SO4']
- B['JA0', '0p', 'SC2', 'tah', 'SO4']
- C['JA0', '0p', 'SC2', '0t', 'SO4']
- D['JA0', '0p', 'SC2', '0t', '0k']
End Term · 31 Aug 2025 (AN)End Term
- Q6MCQ3 Marks·Choose one option
Given the following code snippet, what will be the output? if None: print("None is True") elif 0: print("0 is True") elif "": print("Empty string is True") else: print("All False")
- ANone is True
- B0 is True
- CEmpty string is True
- DAll False
End Term · 13 Apr 2025 (AN)End Term
- Q7MCQ3 Marks·Choose one option

- AIt converts all vowels to uppercase and consonants to lowercase while leaving digits unchanged.
- BIt reverses the order of characters in the string while converting all letters to lowercase.
- CIt removes all non-alphabetic characters and alternates uppercase and lowercase letters in the remaining string.
- DIt alternates the case of alphabetical characters based on their position, starting with uppercase at index 0, leaving non-alphabetic characters unchanged.
End Term · 22 Dec 2024 (FN)End Term
- Q8MCQ3 Marks·Choose one option

- A

- B

- C

- D

- A
- Q9NAT3 Marks·Write the number
Your answer: - Q10MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- A
- Q11MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- A
End Term · 22 Dec 2024 (AN)End Term
- Q12NAT3 Marks·Write the number
Your answer: - Q13MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- A