Semester : S1 and S2
Year : 2016
Term : SEPTEMBER
Branch : MECHANICAL ENGINEERING
Scheme : 2015 Full Time
Course Code : BE 101-05
Page:3
b) Write a Python program to calculate the area of a circle, given the centre and a point on the
perimeter. Use a function to find radius as the distance between two points. (5)
Answer any 2 complete questions each having 14 marks
22. ೩) With examples explain the built-in methods used for list operations. (7)
b) Create a dictionary named ‘stock’. Add the following elements to stock and perform the
following operations.
pencil - 400, pen - 1000, eraser- 200,
ink -50
i. Print stock.
11. Delete ink and print stock.
111. Explain keys and key- value pairs find the number of key-value pairs and identify
the keys. (7)
23. a) Write a program to replace a substring with a new substring in the given string. (7)
b) Write a program that reads a file and writes out a new file with the lines in reversed order.(7)
24. a) Write a function that gets input from the user and handles the Value Error exception.
Describe how exceptions are handled in Python (8)
b) Create a class Student with attributes name and roll no. and a method dataprint() for
displaying the same. Create two instances of the class and call the method for each
instance. (6)