Semester : S1 and S2
Year : 2018
Term : DECEMBER
Branch : MECHANICAL ENGINEERING
Scheme : 2015 Full Time
Course Code : BE 101-05
Page:3
D R1909 Pages: 3
111) generate factors of the number
| What is recursion? Write a python program to calculate nPr. Use a recursive (8)
function fact() to find the factorial of a number.[nPr=n!/ (n-r)!]
PART C
Answer any two full questions, each carries 14 marks.
21 ஐ Write a Python program to input a string and perform the following operations.
i. Reverse the string without using reverse() function.
11. Check for a substring in the string
iti. | Find all the occurrences of a particular character in the string and print (7)
the indices at which the character appears.
b) Write a python program to store a line of text to a file. Read the file and display (7)
only the palindrome words in the file.
22 a) What is a dictionary? With an example explain any five dictionary operations (7)
in python.
b) Define a class in Python to store the details of students (rollNumber, Markl, (7)
Mark2), with the following methods:
readData()- to assign values to class attributes
computeTotal() - find the total marks
print_details()- to display the attribute values and the total marks
Create an object of the class and invoke the methods.
23 a) Write a Python program to read two matrices and perform matrix addition. (7)
b) What are the basic file operations and operating modes in Python? Explain. (7)
೫೫೫%
Page 3 of 3