Python Second Sessional_IT_24-25
Python Second Sessional_IT_24-25
SECTION-A
1. Attempt ALL parts. 2 x 5 = 10
Q no. Questions Marks Cognitive CO
level
(a) What is a variable in Python, and how do you declare one? 2 R (BL 1) 1
(b) List at least four basic data types in Python and briefly describe each. 2 R (BL 1) 1
(c) How do if, else, and elif blocks work in Python? Explain with an example. 2 R (BL 1) 2
(d) What is sort(reverse=true) function in python. 2 U (BL 2) 3
(e) What is Tuple in python? 2 R (BL 1) 3
SECTION-B
2. Attempt any TWO Parts 5 x 2 = 10
Q no. Questions Marks Cognitive CO
level
(a) What is Python programming? Explain the various features of Python programming? 5 R (BL 1) 1
(b) Briefly explain the bitwise and logical operator in python. 5 R (BL 1) 2
(c) Construct a program to change the contents of the file by reversing each character separated 5 U (BL 2) 3
by comma:
Sample - Hello!!
Output
H,e,l,l,o,!,!
SECTION C
Q no. Questions Marks Cognitive CO
level
(a) Explain Ternary Operator in Python. WAP in python to check year is leap year or 10 U (BL 2) 1
not using ternary operator.
(b) Define functions in Python. How are they useful in organizing code? Illustrate with an 10 R (BL 1) 3
example.
4. Attempt any ONE Part 10x1=10
5. Attempt any ONE Part 10x1=10
Q no. Questions Marks Cognitive CO
level
(a) Write difference between list and tuple? Concatenate two lists in the following order 10 U (BL 2) 3
list1 = ["Hello ", "take "]
list2 = ["Dear", "Sir"]
Expected output:
['Hello Dear', 'Hello Sir', 'take Dear', 'take Sir']
(b) Illustrate different list slicing constructs for the following operations on the 10 U (BL 2) 3
Signature (Subject Teacher/Subject Coordinator) Signature (HOD)
Page 1 of 2
Roll No :
following list:
L = [1, 2, 3, 4, 5, 6, 7, 8, 9]
1. Return a list of numbers starting from the last to second item of the list
2. Return a list that start from 3rd item to second last item.
3. Return a list that has only even position elements of list L to list M.
4. Return a list that starts from the middle of the list L.
5. Return a list that reverses all the elements starting from element at index 0 to middle index
only and return the entire list.
Divide each element of the list by 2 and replace it with the remainder.
Page 2 of 2