Semester : S1 and S2
Year : 2018
Term : APRIL
Branch : MECHANICAL ENGINEERING
Scheme : 2015 Full Time
Course Code : BE 101-05
Page:2
21 8)
8 5
22 a)
0)
23
24 a)
b)
D1805 Pages: 2
Write a Python function is_prime(n) , which returns True if the number n is
prime and returns False if the number n is not prime. Use the is_prime() function
to generate first N prime numbers.
What is recursion?
PART C
Answer any two full questions, each carries 14 marks.
Write a Python function to generate first N Fibonacci numbers and return as a
list.
Explain any three methods of Dictionary type and write a Python program to
display the frequency of each word in a string. Use Dictionary to store the word-
frequency pairs.
Write a menu driven program to store the student details (rollno, name, and
mark) of a class as a list tuples. The menu has the following options:
i) add — to add the details of a student
ii) remove — to remove the details of a student by giving rollno
ili) search — to search the details of a student by giving 10110 and to display it
iv) max — to display the details of the student with highest mark.
Write a Python program to read two matrices from two files, find the sum and
display the resultant matrix. Assume that the first line of the input file represents
the order of the matrix in a comma separated format and the remaining lines
represent the rows of the matrix in a comma separated format.
Differentiate between read() and readlines() methods of file.
aK KK
Page 2 of 2
(6)
(7)
(7)
(14)
(12)
(2)