You are on page 1of 2

Question Paper:Set C

Scheme – I
Programme Name: Computer Science and Engineering
Subject Code: 22616
Semester: VI Sem
Course Title: Programming with Python
Marks : 70 Time: 3 Hrs.
……………………………………………………………………………………………………
Instructions:
(1) All questions are compulsory.
(2) Illustrate your answers with neat sketches wherever necessary.
(3) Figures to the right indicate full marks.
(4) Assume suitable data if necessary.
(5) Preferably, write the answers in sequential order.

1.Attempt any FIVE of the following: 10

a) Write steps involved in creation of a user defined exception?


b) Define Data Hiding concept ? Write two advantages of Data Hiding.
c) Define class and object in python.
d) List membership operators in python.
e) What are mutable and immutable types?
f) List different Object Oriented features supported by Python.
g) State the use of read() and readline () functions in python file handling.
h) Write the syntax of fopen() with example.
i) What is packages?
j) How to create directory in python?

2. Attempt any THREE of the following: 12

a) Explain creating Dictionary and accessing Dictionary Elements with example.


b) Write a program to show user defined exception in Python.
c) Explain Numpy package in detail.
d) Write a Python Program to check if a string is palindrome or not.
e) Explain indexing and slicing in list with example.

3. Attempt any THREE of the following: 12

a) With neat example differentiate between readline() and readlines() functions in file-handling.
b) Write the output for the following if the variable fruit=’banana’:
>>>fruit[:3
>>>fruit[3:]
>>>fruit[3:3]
>>>fruit[:]
c) Explain seek ( ) and tell ( ) function for file pointer manipulation in python with example.
d) Explain use of format () method with example.
e) Write a program to create dictionary of students that includes their ROLL NO. and NAME.
i) Add three students in above dictionary
ii) Update name = ‘Shreyas’ of ROLL NO = 2
iii) Delete information of ROLL NO = 1

4. Attempt any THREE of the following: 12

a) Write a program to create class EMPLOYEE with ID and NAME and display its contents
b) Write a program for importing module for addition and substraction of two numbers.
c) Describe Multiline comment in python. Enlist and explain applications for python
programming.
d) Explain membership and Identity operators in Python.
e) Write a Python program to calculate sum of digit of given number using function.

5. Attempt any TWO of the following: 12

a) Write the output of the following: i) >>> a = [2, 5, 1, 3, 6, 9, 7 ] >>> a [ 2 : 6] = [ 2, 4, 9, 0] >>>


print (a) ii) >>> b = [ “Hello” , “Good” ] >>> b. append ( “python” ) >>> print (b) iii) >>> t1 =
[ 3, 5, 6, 7 ] >>> print (t 1 [2]) >>> print (t 1 [–1]) >>> print (t 1 [2 :]) >>> print (t 1 [:])
b) Design a class student with data members : name, roll no., department, mobile no. Create suitable
methods for reading and printing student information.
c) Explain and write default constructor concept in Python.
d) Write a Python Program to accept values from user in a list and find the largest number and
smallest number in a list.

6. Attempt any TWO of the following: 12

a) Write a program to implement the concept of inheritance in python.


b) Explain method overloading and overriding in python.
c) What is recursive function ?write a python program to calculate factorial of a number using recursive
fuction?
d) Explain use of Pass and Else keyword with for loops in python.
T = (‘spam’, ‘Spam’, ‘SPAM!’, ‘SaPm’) print (T[2]) print (T[-2]) print (T[2:]) print (List (T))

You might also like