PPS - Oct - Nov - 2022
PPS - Oct - Nov - 2022
https://www.studymedia.in/fe/notes
Total No. of Questions : 9] SEAT No. :
PA-4300 [Total No. of Pages : 3
[5924]-9
F.E.
PROGRAMMING AND PROBLEM SOLVING
( 2019 Pattern) (Semester-II) (110005)
Q1) [10]
a) Which of the following keyword is used in user defined function header
in Python?
i) define ii) def
iii) function iv) fun
b) Which one of the following is the correct way of calling a function?
i) f_name() ii) call f_name()
iii) return f_name() iv) function f_name()
c) Which function is used to convert a numeric value to a character.
i) ord() ii) chr()
iii) input() iv) output()
d) What is the correct file extension for python files?
i) .pt ii) .pyt
iii) .py iv) .cpp
e) Which method can be used to return a string in upper case letters?
i) toupper() ii) upper()
iii) uppercase() iv) touppercase()
f) Which method is automatically executed when an object of a class is
created?
i) _init_() ii) _call_()
iii) _repr_() iv) _del_()
P.T.O.
Q2) a) Define a function. Explain function definition and function call with an
example. [6]
b) What do you mean by local and global variables? Explain it with example.[5]
c) Write a program to swap two numbers using a function. [4]
OR
Q3) a) Explain the following types of function arguments with examples: [6]
i) Required arguments
ii) Keyword arguments
b) What is a lambda function? Explain it with a suitable example. [5]
c) What are the good Python programming practices? [4]
Q4) a) Explain any three string operations with suitable example. [6]
b) Explain slicing operation on string with suitable example. [5]
c) Write a program to count the number of characters and words in the given
string. s= “Programming and Problem Solving” [4]
OR
[5924]-9 2
Q8) a) What is a file? Differentiate between text and binary file. [6]
b) What is a dictionary? Explain how to create and access dictionary
elements. [5]
c) Explain relative and absolute path of a file. [4]
OR
Q9) a) Explain any three methods for reading and writing files. [6]
b) Explain different directory methods with suitable examples. [5]
c) Write a program to copy the contents of one file to another file. [4]
[5924]-9 3