PPS Question Bank 3 To 6
PPS Question Bank 3 To 6
PPS Question Bank 3 To 6
Subject Code:110005
UNIT 3
1. What is function? Explain code reuse. Explain with example Docstring. [6]
2. Explain Lambda function with example. [6]
3. Write python program using function
a) to find greatest of three numbers by passing numbers as argument.
b) to find whether number is odd or even.
c) to print table of a number using function. (Accept the number from user.)
d) to find whether number is positive or negative.
e) to find whether number is divisible by 7.
f) To find a factorial of a number.
g) To find whether entered number is prime or not prime.
h) To print n elements from Fibonacci series. [6]
4. Differentiate between Local & Global variable. Write a python program to demon-
strate difference between local and global variable.
[6]
5. Explain keyword arguments in python. Write a python program to demonstrate key-
word arguments.
[6]
6. Explain the difference between required argument and Default Argument with example.
7. What is the use of global statement in python?
8. What are modules? How do you use them in your program?
9. What is lambda function/Anonymous function? Write a program What is function? How
to define and call a function. Give syntax and example.
10. What is function? Explain need for functions.
11. Write a python program Write a short note on packages in python.
12. Write a short note on good practices in python.
13. Write a lambda function
a) for checking palindrome of string.
b) to find the area and circumference of a circle by accepting required data from user
using lambda function.
c) to find smaller of two numbers using lambda function.
Rev.: 01 Date: 14-06-2021 Page 1
UNIT 4
1. Explain chr() and ord() functions with example
2. Write a program to reverse a String.
3. Explain built-in String functions with example.(Prepare all functions)
[5]
4. Explain following String functions with example:
1. capitalize() 2.isupper() 3.find() 4.index() 5.swap -
case()
5. Explain concatenate, multiply and append operators of the string.
6. Write a note on slice operation.
7. Write a note on comparing strings.
8. Explain how to iterate strings with example.
9. Explain different string formatting operators with example.
10. Explain following string methods with example. i) Rindex ii) Z fill iii) Split
[6]
11. Write a python program to display tables from 1 to 10 using formatting character.
[6]
12. Write a python program to check if the entered string is the substring of other string.
13. What will be the output of following statement S = “All The Best”.
i) Print (s[1:9])
ii) Print (s[ :6])
iii) Print (s[4: ])
iv) Print (s[1: –1])
v) Print (“The” not in str) [5]
14. Explain following string methods with example : [6]
i) Join ii) Enumerate iii) strip
15. Write python, program to find whether a given character is present in a string or
not. In case it is present print the index at which it is present. Do not use built in
string method. [6]
16. Write a python program to check whether a given string starts with specified character. [5]
17. Justify the statement “ Strings are immutable”.
UNIT 6
1. Write a python program that reads data from one file and write into another file and
line by line. [6]
2. What is directory? List any four directory methods and explain any two of them.
3. Why do we need files? Explain relative and absolute path in files. [5]
4. Write a python program that counts the number of tabs/words, given character and
new line characters in a file.
[6]
5. Write a python program to display current directory, create directory and remove
created directory.
[6]
6. Differentiate between text and binary files. Explain any 4 access modes used in
python. [5]
7. Explain different modes of opening text files.
8. Explain different modes of opening binary files.
9. Write a program to create sample dictionary and add items to it. [6]