B.Tech. Examination, May 2026
Semester: B.Tech. IV Sem. | Paper Code: TU-834 (A)
Subject: Python Programming | Subject Code: BT-410 | Branch: CS/EC/EI
Time: Three Hours | Maximum Marks: 70
Note: Attempt questions from all sections as per instructions.
Section A – Very Short Answer Questions
Attempt all questions. 5 × 2 = 10 Marks
- Define Python variables and give an example of a numeric data type. (2)
- Write a simple
forloop in Python to print numbers from 1 to 5. (2) - Explain the use of the
continuekeyword in a Python loop with an example. (2) - Write a Python function that takes a string and returns its reverse. (2)
- How do you access the last element of a list in Python? (2)
Section B – Short Answer Questions
Attempt any two questions. 2 × 9 = 18 Marks
- Write a Python program that uses a
whileloop to read numbers from the user until they enter0, and then prints the sum of all entered numbers. (9) - Given a list of strings, write a Python program to create a new list that contains each string in upper case. (9)
- How do you create a dictionary in Python? Provide an example with at least two key-value pairs. (9)
Section C – Detailed Answer Questions
Attempt any three questions. 3 × 14 = 42 Marks
- Describe the process of using a
forloop in Python to calculate the sum of all numbers in a list. Explain the difference betweenappend()method andextend()method in a Python list. (14) - Provide an example of using
input()function to get user input and then print that input to screen. Using NumPy, demonstrate how to create a 2D array. (14) - Explain how to handle exceptions in Python with a
try-exceptblock, including multiple exceptions. (14) - Create a Python script that checks whether a given number is odd or even and prints an appropriate message. (14)
- Explain how the
passkeyword is used in Python with an example. Write a Python program that takes two numbers as arguments and returns their sum. (14)

