Semester : S1 and S2
Year : 2019
Term : DECEMBER
Branch : MECHANICAL ENGINEERING
Scheme : 2015 Full Time
Course Code : BE 101-05
Page:2
14
15
16
17
18
19
20
21
22
a)
a)
b)
b)
a)
a)
b)
A192010
>>> rl.a=44
>>> rl.b=22
<<< 12 - 11
<<< 1 15 2
Write a function to check the existence of a file.
PART تا
Answer any four full questions, each carries8 marks.
What is an operating system? Explain any three types of OS?
What are the key features of an interpreter?
Give an algorithm and flowchart to generate prime numbers in a given range.
Write a Python program to find the largest and second largest of n numbers.
Assume n>=3 and all the numbers are distinct. No sorting algorithm should be
used.
Define a Python function digit() to extract the digits of a number. Use the
function to accept a number from the user and display it only if all its digits are
even.
Write a Python program to print the following pattern.
54321
4321
321
21
1
With an example explain while... else construct in Python.
PART C
Answer any two full questions, each carries14 marks.
Write a Python program to read a matrix and find the sum of each row and each
column.
Write a Python program to input a list of മ numbers. Calculate the cube of each
number and store it in a file.
What is a dictionary? Explain any five dictionary operations with examples.
Write a Python program to create a text file. Read the contents of the file, encrypt
every character in the file with a distance of 3 and write it to a new file.
Eg. yak encrypted as bdn
Write a Python program to read a list of positive integers and separate the prime
and composite numbers into two separate lists.
Define a class in Python to store the details of book (title, author, cost), with the
following methods:
i) get_details()- to assign values to class attributes
ii) print_details()- to display the attribute values
Create an object of the class and invoke the methods.
Page 2 of 2
Pages: 2
(3)
(5)
(3)
(8)
(8)
(8)
(5)
(3)
(7)
(7)
(7)
(7)
(7)
(7)