Intro to Programming - Old Question 2025 (BT101CO)
← Back to SyllabusPurbanchal University
2025
Bachelor of Technology in Artificial Intelligence/First Semester/Final
BT101CO: Introduction to Programming
Candidates are required to give their answers in their own words as far as practicable.
Figure in the margin indicate full marks.
Group A
1. Write Python code to create a list of 5 elements and: [4+4+4]
- (a) Access the second and last elements,
- (b) Slice the list to get the first three elements, and
- (c) Use an in-built function to sort the list.
2. Explain the working of while and for loops in Python. Write a Python program using either a while or for loop to calculate the sum of all numbers from 1 to 50. [6+6]
3. Define a function in Python. How do you pass parameters to a function and return values from a function? Write a program to find the factorial of a number using recursion. [2+2+8]
Group B
4. What is Python, and what are the different ways to run Python codes? [6]
5. Explain the difference between print() and eval() functions in Python with a suitable example. [2+4]
6. What are arithmetic operators in Python? Write down a Python program that allows a user to enter any two numbers and display their sum, difference, and multiplication. [2+4]
7. What is a list and how is it created? Write a program to create the given list, $Lst = [10, 20, 30, 40, 50]$, and display its first four elements. [3+3]
8. How do you create and access elements in a tuple? Write a program in Python to create a tuple and display its first two elements. [2+4]
9. Explain continue, pass, and return statements and show how to use them within loops or functions. Write a Python program to display the following output: [6]
* *** ***** *******
10. What is the zip() function in Python? Explain with an example. Write a program to demonstrate the use of the zip() function. [6]