Professional Documents
Culture Documents
19CS PC PP14
19CS PC PP14
SECTION A (5 X 2 = 10)
ANSWER ALL THE FOLLOWING
1. What is the output of the following code?
7. A. Explain the code given. Debug the errors if any and write the output.
b. Explain range function with appropriate examples.
8. Explain the concept involved in the following diagram with respect to classes and
objects.
10. Write a program for the following lottery game. The program randomly generates a two-
digit number(r), prompts the user to enter a two-digit number(u), and determines the amount
won by the user using the following rule:
a. If the user’s input matches the lottery in the reverse order, the award is Rs. 10,000.
11. Write the code to draw a square using turtle and explain.
SECTION C (2 X 10 = 20 marks)
ANSWER ANY TWO OF THE FOLLOWING
12. Explain the following with examples.
a) try except block b) mutable and immutable objects
13. Answer all the following.
a. Suppose a function header is as follows. (2.5 marks)
def f(p1, p2, p3, p4):
Which of the following calls is/are correct? Justify.
f(1, p2 = 3, p3 = 4, p4 = 4)
f(1, p2 = 3, 4, p4 = 4)
f(p1 = 1, p2 = 3, 4, p4 = 4)
f(p1 = 1, p2 = 3, p3 = 4, p4 = 4)
f(p4 = 1, p2 = 3, p3 = 4, p1 = 4)
b. Write the output of the following program and explain the output. (2.5 marks)
c. Explain call stack with an example program. (5 marks)
14. Write a program to count the number of occurrences of every word in a given string
“Python is easy and simple to learn. Python uses simple syntax. Everyone finds Py-
thon easy and fun to learn”