Chereads / LIFE OF HABECK / Chapter 4 - final 1 py

Chapter 4 - final 1 py

Q1. Attempt any FIVE of the following.

(10 Marks)

a) Name different modes of Python

b) List identity operators

c) Describe Dictionary

d) State use of namespace in Python

e) List different Object Oriented features supported by Python.

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

g) Describe Python Interpreter

Q.2) Attempt any THREE of the following.

(12 Marks)

a) Explain two Membership and two logical operators in python with appropriate examples.

b) Describe any four methods of lists in Python

c) Comparing between local and global variable

d) Write a python program to print Fibonacci series up to n terms

Q.3) Attempt any THREE of the following.

(12 Marks)

a) Write a program to input any two tuples and interchange the tuple variable.

b) Explain different loops available in python with suitable examples.

c) Describe various modes of file object? Explain any two in detail

d) Illustrate the use of method overriding? Explain with example

Q.4) Attempt any THREE of the following.

(12 Marks)

a) Use of any four methods of tuple in python?

b) Write a python program to read contents of first.txt file and write same content in second.txt

file

c) Show how try…except blocks is used for exception handling in Python with example

d) Write the output for the following if the variable fruit='banana':

>>>fruit[:3]

>>>fruit[3:]

>>>fruit[3:3]

>>>fruit[:]

Q.5) Attempt any TWO of the following.

(12 Marks)

a) Determine various data types available in Python with example

b) Write a python program to calculate factorial of given number using function

c) Show the output for the following:

1. >>> a=[1,2,3]

>>>b=[4,5,6]

>>> c=a+b

2. >>>[1,2,3]*3

3. >>>t=['a','b','c','d','e','f']

>>>t[1:3]=['x','y']

>>>print t

Q.6) Attempt any TWO of the following.

(12 Marks)

a) Describe Set in python with suitable examples.

b) Illustrate class inheritance in Python with an example

c) Design a class Employee with data members: name, department and salary. Create suitable

methods for reading and printing employee information