Python Programming Exam Questions
Python Programming Exam Questions
82
PB1889 [Total No. of Pages : 2
ic-
[6237]-507
t
sta
T.Y. [Link].
COMPUTER SCIENCE
3
6:1
CS-3510 : Python Programming
1
3:3
4/2 21
(Revised 2019 Pattern) (CBCS) (Semester - V)
41
Time : 2 Hours] 0/0 10 [Max. Marks : 35
02
Instructions to the candidates:
0
9.8 AP
23
82
ic-
Q1) Attempt any Eight of the following. [8×1=8]
.21
tat
3s
a) What in indentation?
2.1
6:1
b) List the features of Python?
11
20
3:3
c) What are break and continue statements?
02
41
-82
g) Compare for and while loop.
9.8
sta
49
13
02
24
[6237]-507 1 P.T.O.
Q3) Attempt any two of the following. [2×4=8]
82
a) Write a phython program to find factorial of a number.
ic-
b) Write a python program to check if a given number is Armstrong.
t
sta
c) Write a python program to check whether a given string is Palindrome or
3
not.
6:1
1
3:3
4/2 21
Q4) Attempt any two of the following. [2×4=8]
41
0/0 10
a) Write a python program to check if a given key already exists in a
02
dictionary.
0
9.8 AP
b) Write a python program to put even and odd elements of a list into two
different lists.
49 CA
23
82
ic-
.21
tat
Q5) Attempt any one of the following. [1×3=3]
3s
a) Trace the output of the following
2.1
6:1
import tracebook
11
20
try:
3:3
02
41
x =8/0
02
01
print(x)
4/2
except:
AP
0/0
traceback print-exc ( )
-82
9.8
:13
2.1
i=5
:36
11
20
s=0
13
02
while i < n :
24
st = i
01
/20
i + = 10
9.8 AP
/04
Print (“ i =” , i)
0
49
2.1
20
[6237]-507 2
Total No. of Questions : 5] SEAT No. :
82
PC1585 [6328]-57 [Total No. of Pages : 2
ic-
[Link]. (C.S.)
t
sta
CS - 3510 : PYTHON PROGRAMMING
4
(Revised 2019 Pattern) (Semester-V)
1:4
1
3:2
Time : 2 Hours] [Max. Marks : 35
2/2 21
Instructions to the candidates:
41
3/1 10
1) All questions are compulsory.
02
2) Figures to the right indicate full marks.
0
9.8 AP
20
82
a) Explain features of python.
ic-
b) What is purpose of range ( ) function.
.21
tat
4s
c) What is indentation.
2.1
1:4
d) Define anonymous function.
11
20
3:2
e) Compare List and dictionary.
02
41
-82
i) Compare for and while loop?
9.8
tic
.21
:44
2.1
:21
13
02
i) If ii) If else
CA
20
[6328]-57 1 P.T.O.
Q3) Attempt any Two of the following : [2×4=8]
82
a) Write a python program to find sum of natural numbers.
t ic-
sta
b) Write a python function to check whether a number is perfect or not.
4
c) Write a python program to convert a list to a tuple.
1:4
1
3:2
2/2 21
41
3/1 10
Q4) Attempt any Two of the following : [2×4=8]
02
0
a) Write python program to accept the strings which contains all vowels.
9.8 AP
20
82
c) Write a python program to check number is odd or even.
ic-
.21
tat
4s
2.1
1:4
Q5) Attempt any One of the following : [1×3=3]
11
20
3:2
a) def myfun(name, msg = “Good morning”) :
02
41
myfun(“Amar”)
AP
3/1
-82
b) try :
9.8
tic
.21
a=5
sta
49
b=0
:44
2.1
:21
11
print(a|b)
20
13
02
Print(‘unsupported operation’)
/20
9.8 AP
/12
49
2.1
20
[6328]-57 2
Total No. of Questions : 5] SEAT No. :
82
PD1577 [Total No. of Pages : 2
ic-
[6468]-57
t
sta
[Link]. (Computer Science)
5
1:1
CS-3510 : PYTHON PROGRAMMING
1
3:3
(Revised 2019 Pattern) (Semester -V)
4/2 21
51
Time : 2 Hours] [Max. Marks : 35
9/0 10
Instructions to the candidates:
02
1) All questions are compulsory.
0
9.8 AP
21
82
Q1) Attempt any Eight of the following (out of Ten) [8×1=8]
ic-
.21
tat
a) What is the purpose of range ( ) function?
5s
b) What is a list? Explain with suitable example.
2.1
1:1
11
20
-82
9.8
sta
i) Give the use of index ( ) method of string.
49
:15
:31
11
20
13
02
P.T.O.
P.T.O.
Q3) Attempt any two of the following (out of Three) [2×4=8]
82
a) Which methods are used to read from file? Explain any two of them with
ic-
example.
t
sta
b) Write a python program to check if a given string as palindrome or not.
5
c) Write a program to find GCD of number using recursion.
1:1
1
3:3
4/2 21
Q4) Attempt any two of the following (out of Three) [2×4=8]
51
9/0 10
a) List the various methods of re package explain any two methods in detail
02
with example.
0
9.8 AP
21
82
c) Write a python program to append the contents of file 2 to file 1. Acept
ic-
file names from user
.21
tat
5s
Q5) Attempt any one of the following (one of two) [1×3=3]
2.1
1:1
a) What will be the output of the following code
11
20
3:3
r = lambda q : q*2
02
51
s= lambda q : q*3
02
01
x=2
4/2
AP
x = r(x)
9/0
x = s(x)
CA
21
x = r(x)
-82
9.8
print (x)
tic
.21
code
:15
2.1
count = 1
:31
11
20
13
def do This ( ) :
02
25
global count
01
/20
for i in (1 , 2, 3)
9.8 AP
/04
Count + =1
9
CA
21
do This ( )
print (Count)
.21
49
2.1
20
[6468]-57 2
Total No. of Questions : 5] SEAT No. :
38
P6396 [Total No. of Pages : 3
ic-
[6155]-57
tat
T.Y. [Link]. (Computer Science)
8s
CS-3510 : PYTHON PROGRAMMING
7:1
30 1
(Revised 2019 Pattern) (CBCS) (Semester - V)
1
9:1
2/2 02
Time : 2 Hours] [Max. Marks : 35
1
Instructions to the candidates:
02
8 1 P0
1) All questions are compulsory.
2) Figures to the right indicate full marks.
A
9/1
38
7.3
ic-
tat
Q1) Attempt any Eight of the following: [8×1=8]
8s
.24
7:1
a) What is indentation?
49
11
9:1
b) Write code to print the elements of the list 11 = [10, 20, 30, 40, 50]
02
30
01
38
7.3
sta
g) Write a lambda function to add 10 to a given integer.
.24
:18
11
:17
b) What are the usage of tuples zip (), tuple(), count() and index() functions?
.24
49
[6155]-57 1 P.T.O.
c) What is an anonymous function? How to create it? Explain with example.
38
d) Explain the following loops with example.
ic-
tat
i) While
8s
ii) For
7:1
30 1
1
e) How to perform input output operations? Explain with example.
9:1
2/2 02
1
02
8 1 P0
a) Write a program to accept a string from user and display the string in
38
reverse order eliminating the letter ‘s’ from the string.
7.3
ic-
tat
b) Write a program to raise a user defined exception to check if age is less
8s
.24
that 18.
7:1
49
11
c) Write a Python program to check that a string contains only a certain set
9:1
02
a) Write a Python program to add ‘ing’ at the end of a given string (length
81
38
should be at least 3). If the given string already ends with 'ing', add 'ly'
7.3
-
instead. If the string length of the given string is less than 3, leave it
tic
8.7
sta
unchanged.
.24
:18
11
:17
data: [{'item': 'item 1', 'amount': 400}, {'item': 'item2', 'amount': 300},
02
09
c) Write a Python program to extract year, month, date and time using
9/
CA
Lambda.
7.3
8.7
.24
49
[6155]-57 2
Q5) Attempt any one of the following: [1×3=3]
38
a) Check1 = ['Learn', 'Quiz', 'Practice', 'Contribute']
ic-
Check2 = check1
tat
8s
Check3 = check1 [:]
7:1
30 1
Check2[0] = 'Code'
1
9:1
2/2 02
Check3[1] = 'Mcq'
1
02
Count = 0
8 1 P0
if c[0] == 'Code':
38
count + = 1
7.3
ic-
if c[1] == 'Mcq':
tat
8s
.24
count + = 10
7:1
49
11
print (count)
9:1
02
b) Counter = {}
30
01
02
If country in counter:
9/1
CA
Counter [country] + = 1
81
38
Else:
7.3
-
tic
8.7
Counter [country] = 1
sta
.24
11
:17
Print (len(counter))
8 1 P0
/20
12
A
9/
CA
7.3
8.7
.24
49
[6155]-57 3