[No.
of Printed Pages - 4]
CSIT659 Enrol. No. . ............ .
[BMCF]
END SEMESTER EXAMINATI ON: JAN. 2022
PYTHON: BASICS AND APPLICATI ON
Time: 3 Hrs. Maximum Marks : 50
Note: Attempt questions from all sections as directed.
SECTION - A (20 Marks)
Attempt any four questions out of fiv~.
Each question carries 05 marks.
1. Describe is and is not operators and type() function.
Also, discuss ~hy Python is called as dynamic and
strongly typed language.
2. Discuss the following methods associated with the
file object
(a) read() (b) readline()
( c) readlines() (d) tell()
(e) write()
P.T.O.
(1-172)
·.~~ ..,
"'
CSIT6S9 2
~
,:,
...
O=-- -~
-""' CSIT6S9
I 3
3. (a) What is List Compre hension ? Give an Exampl e.
(2) ._.
r
c~· :,
-"'
8. Define a string. How it can be traverse d through using
looping stateme nts? Write a python program to display
(b) What is Diction ary Compre hension ? Give an presenc e ~f given substrin g in main string.
.
example. (3) C¥~~ ~
Write Pythonic code to overloa d "+", "-" and "*"
'-· -· ~ SECTI ON - C (14 Marks)
4. (Compu lsory)
operators by providin g the method s
0: :,
- add-, -sub-
and mul . C ::, 9. Object- oriente [Link] amming , or OOP for short, is a
C program ming paradig m which provide s a means of
~
5. Write a program to find the sum of all Odd and Even structu ring program s so that propert ies and behavio rs
numbers up to a number specifie d by the user.
C ~
are bundled into individ ual objects . You have already
C ~:, encoun tered several objects . Strings , lists, tuples,
0 :) diction aries anrl: even number s in Python are all
SECTION - B (16 Marks )
objects .
Attempt any two questio ns out of three. C ~
Each question [Link] 08 marks.
:> An object could also represe nt a person with a
~ ;) propert ies such as age and address , and with behavio rs
6. Describ e in detail about lambda functio ns or
like walking , talking, breathin g, and running . Anothe r
anonymous function. Describe in detail about the rules C ~
object may represe nt an email with propert ies like
to be followed while using lambda function. Genera te ~
C recipien t list, subj~ct , and body, and behavio rs lik~
a program that uses lambda function to multiply two
C ~ adding attachm ents and sending .
numbers.
Put another way, object-o riented program ming is an
7. What is membership and identity operato rs. Write a C approac h for modelin g concret e, real-wo rld things,
program to perform addition, subtraction, multiplication,
·(I such as a player in a game, as well as relation s
integer division, floor division and modulo division on ,' I
cc;.-::: > betwee n things, like compan ies and employ ees,
two integer and float.
~~~ P.T.O.
(1-172)
~---
~·
?" - -
••.!,
l
,.,_)
t,
.. (1-172)
-----------------~- ~
~
CSIT659 4
c_
students and teachers, etc. OOP mo del s rea l-w
orl d
entities as software objects, wh ich hav e som C-
e dat a
ass oci ate d wit h the m and can p'e rfo rm cer
tai n C-
functions. c...
(a) How class can be instantiated in pyt hon ? Wr ~
ite a
.
python pro gra ~ to exp res s ins tan ces as retu
rn c_
value to define· a. class RECTANGLE wit h me mb
. . er c_
width, height, and member function: to· find are
a
and perimeter of a rectangle. Exp lain init and
str ~
method with an example pyt hon pro gra m.
(7) c::_
I
(b) Explain with examples :- c:::
~
(i) Inheritance
~
(ii) Dunder method
~
(iii) Polymorphism
(7)
~
~
~
~
~
~
<T-1 '7 ,,."'_ .. ~