PPS Pyq 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Total No. of Questions : 9] SEAT No.

8
23
P6995 [Total No. of Pages : 4

ic-
[5868]-107

tat
6s
F.E. (Semester - I & II)

0:1
110005 : PROGRAMMING AND PROBLEM SOLVING

02 91
8:4
(2019 Pattern) (Common)

0
20
8/0 13
Time : 2½ Hours] [Max. Marks : 70
0
8/2
Instructions to the candidates:
.23 GP

1) Question one is compulsory.


E

2) Solve Q2 or Q3, Q4 or Q5, Q6 or Q7, Q8 or Q9.


80

8
C

23
3) Neat diagrams must be wherever necessary.

ic-
4) Assume suitable data wherever necessary.
16

tat
8.2

6s
.24

0:1
Q1) i) Which one of the following is the correct way of calling a function?
91
49

8:4
a) f_name() b) call f_name()
30
20

c) return f_name() d) function f_name()


01
02
8/2

ii) What is the correct file extension for Python files?


GP
8/0

a) .pt b) .pyt
CE
80

8
23
c) .py d) .cpp
.23

ic-
16

iii) Which function is used to convert a numeric value to a character.


tat
8.2

6s

a) ord() b) chr()
.24

0:1
91

c) input() d) output()
49

8:4
30
20

iv) Which is the default access mode in the open () function for files in
01

Python?
02
8/2
GP

a) w b) r
8/0

c) a d) w+
CE
80

v) Which method can be used to return a string in upper case letters?


.23
16

a) toupper() b) upper()
8.2

c) uppercase() d) touppercase()
.24
49

P.T.O.
vi) Which method is automatically executed when an object of a class is

8
created?

23
ic-
a) _init_() b) _call_()

tat
c) _repr_() d) _del_()

6s
0:1
vii) You can use Python for

02 91
8:4
a) Application programming b) Web programming

0
20
c) 8/0 13
Artificial intelligence d) All of these
0
8/2
viii)Which of the following keyword is used in user defined function header
.23 GP

in Python?
E
80

8
a) define b) def
C

23
ic-
c) function d) fun
16

tat
ix) What does open() function return?
8.2

6s
.24

a) function b) variable
0:1
91
49

8:4
c) file object d) none of these
30
20

x) Which of the following is the correct way of closing a file?


01
02

a) close(file) b) close(“file”)
8/2
GP
8/0

c) file.closed() d) file.close()
CE
80

8
23
.23

Q2) a) Define a function. Explain function definition and function call with
ic-
16

tat
suitable example. [6]
8.2

6s

b) What is a lambda function? Explain with a suitable example. [5]


.24

0:1
91
49

c) What are the good Python programming practices?


8:4

[4]
30
20

OR
01
02

Q3) a) Explain the following types of function arguments with examples:[6]


8/2
GP

i) Required arguments
8/0
CE

ii) Keyword arguments


80
.23

b) What do you mean by local and global variables? Explain it with


16

example. [5]
8.2

c) Write a program to swap two numbers using a function. [4]


.24
49

[5868]-107 2
Q4) a) Explain the following string operations with suitable example. [6]

8
23
i) Concatenation

ic-
tat
ii) Appending

6s
iii) String repetition

0:1
02 91
8:4
b) Explain indexing and slicing operation on string with suitable example.

0
20
8/0 13 [5]

c) Write a program to count the number of characters and words in the


0
8/2
.23 GP

given string. [4]


E

s = “Welcome to the world of python programming”


80

8
C

23
OR

ic-
16

tat
Q5) a) Explain following string methods with example. [6]
8.2

6s
.24

0:1
i) strip()
91
49

8:4
ii) index()
30
20

iii) isdigit()
01
02
8/2
GP

b) What is a string? Explain with example iterating strings. [5]


8/0

c) Explain ord() and chr() functions with suitable examples.


CE

[4]
80

8
23
.23

ic-
16

tat
Q6) a) Explain any three programming paradigms. [6]
8.2

6s

b) Define a class in Python. Explain_init_() method with suitable example.


.24

0:1
91

[5]
49

8:4
30
20

c) Explain the concept of a class and an object in OOP. [4]


01
02

OR
8/2
GP

Q7) a) Explain the following features of Object Oriented Programming. [6]


8/0
CE
80

i) Data encapsulation
.23

ii) Data abstration


16
8.2

iii) Polymorphism
.24
49

[5868]-107 3
b) Explain class variables and object variable with suitable example. [5]

8
23
c) Write a program to create a class ‘Employee’ with two attributes.

ic-
Display the details of two employees. [4]

tat
6s
0:1
02 91
Q8) a) What is a file? Explain different access modes for opening files. [6]

8:4
0
20
b) What is a dictionary? How to create, access and modify dictionary
elements.
8/0 13 [5]
0
8/2
.23 GP

c) Explain relative and absolute path of a file. [4]

OR
E
80

8
C

23
Q9) a) Explain any three methods for reading and writing files. [6]

ic-
16

tat
b) Explain different directory methods with suitable examples. [5]
8.2

6s
.24

0:1
c) Write a program to read first 10 characters from the file and display it.
91
49

[4]
8:4
30
20
01
02


8/2
GP
8/0
CE
80

8
23
.23

ic-
16

tat
8.2

6s
.24

0:1
91
49

8:4
30
20
01
02
8/2
GP
8/0
CE
80
.23
16
8.2
.24
49

[5868]-107 4

You might also like