Python Programming 18ITO02
Python Programming 18ITO02
: 18ITO02
CHAITANYA BHARATHI INSTITUTE OF TECHNOLOGY (Autonomous)
B.E. (ECE) VII Sem (Main) Examination December 2021
Python Programming
Time: 3 Hours Max Marks: 70
Note: Answer all questions from Part - A and Part – B at one place in the same order.
13 (a) Assume you have a module called fact_fib, consists of two (5) 2 3
functions called fact() and fib(). Write a program to calculate the
factorial of given number by importing only fact() from the
above module.
(b) Explain opening and closing files. (5) 2 2
(OR)
14 (a) Where are random numbers useful? Explian the following (5) 2 2
functions
(i) randrange() ii) random() iii) uniform()
(b) Assume you have two files containing sorted numbers. Write a (5) 2 3
program to merge these two files into third file which must be in
sorted order.
Page 1 of 2
Code No.: 18ITO02
15 (a) Discuss any five list methods along with examples (5) 3 2
(b) Write a program to check whether sub string is exiting in main (5) 3 3
string or not. If the sub string does not exist print the same
message. If the sub string exists, then:
i. If it is alphanumeric, print that it is alphanumeric
ii. If it is in lowercase convert into uppercase and vice versa.
(OR)
16 (a) Write a program that reads the contents of a text file and display (5) 3 3
the count of individual words. The program should create a
dictionary in which the keys are the individual words found in
the file and the values are the number of times each word
appears.
(b) Explain the following set operations using examples (5) 3 2
i) union ii) intersection
iii) difference iv) symmetric difference
17 (a) Design a class that holds the following personal data: name, (5) 4 3
address, age, and phone number. Write appropriate accessor and
mutator methods. Write a program that creates three instances of
the class. One instance should hold your information, and the
other two should hold your friends’ or family members’
information.
(b) Explain about handling multiple exceptions with an example. (5) 4 2
(OR)
18 (a) Differentiate between procedure and object oriented (5) 4 4
programming.
(b) Briefly explain special characters in regular expressions with (5) 4 2
examples.
Page 2 of 2