Python Unit Test - 1 Paper

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Indira College of Commerce and Science, Pune

UNIT TEST – I
Semester: V Program: TYBBA-CA Course Code: CA-504 Total Marks: 20
Course Name: Python Day & Date: Friday, 15th Sept.-2023 Time: 60 Minutes

Q.
No.
1 Attempt any Six from the following: [6*2 = 12 Marks]
a. Distinguish between List and Tuple.
b. Enlist any FIVE features of Python.
c. Explain the syntax of for loop with sample example.
d. Predict the output :
for x in range(3,8):
for y in range(5,9):
if x * y > 8:
break
print(x * y)

e. List any EIGHT keywords in Python.


f. Explain str.split() function with suitable example.

g. Create a dictionary with elements in Python by any FOUR preferred ways.


h. Enlist all the Arithmetic, Bitwise, and Identity operators in Python.
2 Solve the following : (Any two) [2*4 = 08 Marks]
a. Write a Python script using function named getTotal() which receives a non-
empty list from the user and returns the sum of integer elements.
Example: Assume the input list is [2.5, 9, “ICCS”, 21, [2,3,4], 6-7j, 5, 7.2].
Pass it to the function getTotal(). getTotal() should return the addition of integer
elements. So, the expected output is 35.
b. Write a Python script to print all the spy numbers in the range of 100 to 2000.
Definition : A Number is a Spy number if the sum of its digits is equal to the
product of its digits.
(Example: num = 312, sum_of_digits = 3+1+2 = 6, prod_of_digits = 3*1*2 = 6)
c. What is set? Explain its methods with suitable example.

***************************END***************************

Use backside of this paper for rough work.

You might also like