Beruflich Dokumente
Kultur Dokumente
NAME OF PROGRAM
(SEM ….) THEORY EXAMINATION 2019-20
SUBJECT NAME
Time: 3 Hours Total Marks: 100
Note: 1. Attempt all Sections. If require any missing data; then choose suitably.
SECTION A
i. Write a lambda function that takes one string argument x and returns a 2 3
tuple (x, lenx). Here lenx is the length of string x.
SECTION B
1|Page
shl(“PYTHON”, 3) returns “HON%%%”
shl(“PYTHON”, 6) returns “%%%%%%”
shl(“PYTHON”, 20) returns “%%%%%%”
SECTION C
3. Attempt any one part of the following:
Q no. Question Marks CO
a. What is a class in Python? What is the use of a class? 10 4
2|Page
6. Attempt any one part of the following:
Q no. Question Marks CO
a. Write a Python program, pattern(N), that prints a parallelogram 10 2
having N * symbols on each side, as shown in these examples:
pattern(3) prints:
***
***
***
pattern(5) prints:
*****
*****
*****
*****
*****
b. A positive number 𝑧 can be called a Fibonacci Number if it occurs in 10 2
the Fibonacci series 𝑓𝑖𝑏, defined as:
𝑓𝑖𝑏(0) = 1, 𝑓𝑖𝑏(1) = 1,
𝑓𝑖𝑏(𝑛) = 𝑓𝑖𝑏(𝑛 − 1) + 𝑓𝑖𝑏(𝑛 − 2) 𝑓𝑜𝑟 𝑛 ≥ 2
3|Page