Course Code: 20ESIT202
Course Name: Python Programming
Unit - I
Unit - I / Part - A / 2 Marks
Mark
Split- K-L
S.No Questions up evel CO
1. List out the features of the Python programming language. 2 K1 CO1
2. Differentiate between the Python programming in interactive mode 2 K1 CO1
and Python programming in script mode.
3. How to assign values to Variables in Python? 2 K1 CO1
4. What are the rules of Python Identifiers? 2 K1 CO1
5. List out standard data types in Python? 2 K1 CO1
6. How to access the elements of a string in python? 2 K1 CO1
7. What are the values of Boolean data type in Python? 2 K1 CO1
8. How to receive floating point values from users in Python? 2 K1 CO1
9. List out some reserved words in Python. 2 K1 CO1
10. Specify the importance of the indentation in Python. 2 K1 CO1
11. Define Membership operators in Python. 2 K1 CO1
12. Define Identity operators in Python. 2 K1 CO1
13. Name the logical operators in Python. 2 K1 CO1
14. What is a Boolean expression in Python? 2 K1 CO1
Solve the following expressions, 2 K1 CO1
a. 100 / 10 * 10
b. 100/(10*10)
15.
c. 2 ** 3 ** 2
16 What is the output of the following statements? 2 K1 CO1
Unit - I / Part - B / 13 Marks
Marks
K–
S.No Questions Split-u Level
CO
1. Explain in detail the standard data types in Python with 13 K2 CO1
examples?
Explain Conditional if, alternative if, and chained conditional 13 K2 CO1
2. statements with syntax, flowchart and example Python
Programs.
Write a Python program to find whether the given number is 13 K2 CO1
3. positive or negative or zero by using Nested-if condition with its
flow chart explanation.
4. Write a Python program to construct a calculator by using 13 K3 CO1
Chained-if-elif-else condition with its flow chart explanation.
Explain for loop and while loop in Python with its syntax,
flowchart and example Programs.
K2 CO1
5. 13
Explain break, continue and pass statements in Python with its
syntax, flowchart and example Programs.
6 K2 CO1
6. 7
Write a Python program to construct a calculator by using 13 K3 CO1
Chained-if-elif-else condition with its flow chart explanation.
7.
Unit - I / Part - C / 15 Marks
Marks
K–
S.No Questions Split-u
CO
Level
p
1. Explain the precedence and associativity between Python 15 K2 CO1
Operators with example statements.
Write Python programs to 15 K3 CO1
. Circulate the values of n variables
a. Square root (Newton's method)
b. Sum an Array of Numbers
2
Unit - II
Unit - II / Part - A / 2 Marks
Mark
K–
S.No Questions Split-u CO
Level
p
1 What is string slicing? Give an example. 2 K2 CO2
2 Define list with an example 2 K1 CO2
3 Write few methods associated with list. 2 K1 CO2
4 Explain immutability in Python and list few classes which 2 K1 CO2
are immutable.
5 Define string. How to create and print strings? 2 K1 CO2
6 Give an example for string concatenation 2 K1 CO2
7 How to do the string replication 2 K1 CO2
8 Explain string module with an example. 2 K1 CO2
9 What are the String Method used in python 2 K1 CO2
10 List out the string functions available in python 2 K1 CO2
11 Define Python list. 2 K1 CO2
12 What are the list operations? 2 K1 CO2
13 What are the different ways to create a list? 2 K1 CO2
14 Illustrate negative indexing in a list with an example.. 2 K2 CO2
15 Describe list slicing with examples. 2 K1 CO2
16 List out the methods that are available with list object in 2 K1 CO2
python programming
17 Show the membership operators used in the list 2 K1 CO2
18 Define Python tuple. 2 K1 CO2
19 What are the advantages of tuple over list? 2 K1 CO2
20 Classify the Python accessing Elements in a tuple. 2 K1 CO2
21 Point out the methods used in tuples 2 K1 CO2
22 How a tuple is iterated? Explain with an example 2 K2 CO2
23 Explain how tuples are used as return values? 2 K1 CO2
24 Define a dictionary with an example. 2 K2 CO2
Unit - II / Part - B/ 13 Marks
Marks
K–
S.No Questions Split
CO
Level
Up
Demonstrate the working of +, * and slice operators in python 7 K2 CO2
lists and tuples
1 6
2 Explain in detail about string functions and methods. 13 K1 CO2
3 Explain in detail about list operations and methods. 13 K1 CO2
4 Write a python program for the implementation of merge sort 13 K3 CO2
5 Explain in detail about list loop ,aliasing and cloning a list with 13 K2 CO2
example.
6 Explain in detail about tuple,tuple assignment and tuple as 13 K2 CO2
return value.
7 Explain in detail about set operations and methods. 13 K2 CO2
Unit - II / Part - C / 15 Marks
Marks
K–
S.No Questions Split Level
CO
Up
1 Explain the different operations and methods in dictionaries. 15 K2 CO2
Write Python programs to search a value using 7 K2 CO2
(a) Linear search 8
(b) Binary search
2
Write python code to perform 15 K2 CO2
3 (a) Selection sort
(b) Insertion sort
Unit - III
Unit - III/ Part - A / 2 Marks
Mark
K–
S.No Questions Split-u CO
Level
p
Define dictionary. 2 K2 CO2
List the dictionary operations. 2 K1 CO2
How to create and delete a dictionary? 2 K1 CO2
How can you insert values into a dictionary? 2 K1 CO2
What is the use of fromkeys( ) in dictionary? 2 K1 CO2
Examine different set functions 2 K1 CO2
Write a program to perform union, intersection and difference 2 K1 CO2
operation using set
7
What is set? 2 K1 CO2
How to add and remove data in set? 2 K1 CO2
10 Are dictionary and set different. Justify your answer 2 K1 CO2
11 Define function and state its use. 2 K1 CO3
12 What does recursive function implies? 2 K1 CO3
13 Analyze the different kinds of arguments. 2 K1 CO3
14 Evaluate the importance of fruitful functions. 2 K2 CO3
15 Using the concept of functions, calculate the area of a circle. 2 K1 CO3
16 What do you mean by fruitful function? 2 K1 CO3
17 Outline the scope of variables. 2 K1 CO3
18 Write a function without argument and with return type 2 K1 CO3
19 Differentiate local and global variables. 2 K1 CO3
20 Write a program to find the sum of the digits of a number 2 K1 CO3
21 Define package 2 K1 CO3
22 What are packages in Python? 2 K1 CO3
What is the difference between modify and copy operations 2 K1 CO3
23 performed in dictionary?
24 What is module and package in Python? 2 K1 CO3
25 List some build in Modules in Python 2 K1 CO3
26 Give differences between Modules and Packages in Python 2 K1 CO3
Unit - III/ Part - B/ 13 Marks
Marks
K–
S.No Questions Split
CO
Level
Up
Discover an algorithm and write a python program to sort the 7 K2 CO3
numbers in ascending order using insertion sort.
1 6
Write a Python program to store ‘n’ numbers in a list and sort the 13 K1 CO3
2 list using selection sort.
3 Describe the methods and operations of Dictionaries. 13 K1 CO3
Write the syntax and explain the concept of (i) Recursive function 13 K3 CO3
with an example. (7)
4 (ii) to search an element using linear search (6)
List the different types of arguments / parameters used in function 13 K2 CO3
5 with suitable examples.(13)
(i) Describe python modules(6) 13 K2 CO3
6 (ii) Describe python packages(7)
a) Define function? Write its syntax (3) 13 K2 CO3
b) What are formal and actual arguments ((4)
7 c) Write functions to do all arithmetic operations ( 6)
i) What are modules in Python? Explain. (6 ) 13 K1 CO3
8 ii) Explain in details about namespaces and scoping. (7)
i) Write a recursive algorithm to find factorial of a given 13 K1 CO3
number
9 ii) what is list comprehension explain with example
What is recursive function. What are its advantages and dis 13 K2 CO3
10 advantages. Compare it with iterative function
Unit - III / Part - C / 15 Marks
Marks
K–
S.No Questions Split
CO
Level
Up
1. Evaluate the different operations like union, intersection and 15 K3 CO3
differences of list using Set and functions.
2. Create a user defined fruitful function to test a given year is a leap 15 K3 CO3
year.
3 Write a function to determine whether a given natural number is a 15 K2 CO3
perfect number. A natural number is said to be a perfect number if
it is the sum of its divisors.
4 What are modules in Python? How will you import them? Explain 15 K1 CO3
the concept by creating and importing the module.
5 Define Dictionary in Python. Do the following operations on Python 15 K1 CO3
(i)Initialize Dictionary with Key value pair
(ii) Add a key to Dictionary
(iii) Concatenate two dictionaries to create a new one
(iv) check whether a given key already exists in a dictionary
(v) check whether a given key already exists in a dictionary
(vi) merge two Python dictionaries.
(vii) remove duplicates from the dictionary
6 (i) Explain modules in python (8) 15 K1 CO3
(ii) Explain packages in python (7)
7 (i) Explain Global and Local scope (7) 15 K2 CO3
(ii) Implement a Fibonacci series in Python using recursive
function (8)
8 Explain various set operations with illustrative examples 15 K2 CO3
Unit - IV
Unit - III/ Part - A / 2 Marks
Mark
K–
S.No Questions Split-u CO
Level
p
1. What is a File? List the types of files with example 2 K1 CO4
2. What are the types of files in python? 2 K1 CO4
3. What is the format operator for files in python? 2 K1 CO4
4. What is __FILE__ in python? 2 K1 CO4
5. List the methods used for reading a file in python 2 K1 CO4
6. List the methods used in python for writing in a file 2 K1 CO4
7. Enumerate the modes of opening a file in python 2 K1 CO4
8. Write down the steps involved in reading from a text file and 2 K1 CO4
writing in another file
9. What are command line arguments? give an example 2 K1 CO4
10. argc and argv - How they are associated with command line 2 K2 CO4
arguments
11. Define exception. Give an example 2 K1 CO4
12. How does python handle exceptions? 2 K1 CO4
13. try: 2 K2 CO4
print(“Hi”)
finally:
print(“Hello”)
Write the output of the above program
14. Write the output of the below program - justify your answer 2 K2 CO4
try:
print(x)
except:
print(“Error Occurred”)
15. What is the use of finally block 2 K1 CO4
16 List the characteristics of OOP 2 K1 CO4
17 Define Class and Object 2 K1 CO4
18 Give the syntax for creating a class in python 2 K1 CO4
19 What is a constructor? Give examples 2 K1 CO4
20 Differentiate Private and Public data members 2 K2 CO4
21 How data abstraction is achieved in python 2 K2 CO4
22 Give output of the following with justification 2 K2 CO4
x = 100
if not type(x) is int:
raise TypeError(“Data to be of int type”)
else:
print(“Data is “,x)
23 What error is raised in the following code? 2 K2 CO4
x =1000000
import math
math.exp(x)
24 Differentiate between private methods and public methods 2 K2 CO4
25 Differentiate between Constructor and Destructor 2 K2 CO4
Unit - III/ Part - B/ 13 Marks
Marks
K–
S.No Questions Split Level
CO
Up
1. Explain in brief the file handling methods available in python 13 K1 CO4
with appropriate example
2. What are the modes of opening a file in python 13 K1 CO4
3. Illustrate the exception handling methods available in python 13 K2 CO4
4. Illustrate how exceptions are handled during file processing in 13 K2 CO4
python
Unit - III/ Part - B/ 13 Marks
Marks
K–
S.No Questions Split
CO
Level
Up
5. Difference between error and exceptions. Briefly explain 13 K1 CO4
exception handling using try except and finally blocks
6. Explain in detail about Classes and Objects in python 13 K1 CO4
7. Illustrate the characteristics of OOP and how it is achieved in 13 K2 CO4
Python
8. What is a constructor? Explain about two types of constructor 13 K1 CO4
in python with appropriate example
9. What are the access modifiers available in python? How 13 K1 CO4
encapsulation is achieved using them
10. Briefly explain about private and public methods in python 13 K1 CO4
Unit - III / Part - C / 15 Marks
Marks
K–
S.No Questions Split Level
CO
Up
Write the following content in a file named as “sample.txt” 15 K2 CO4
using python file processing
“ Python has a simple syntax similar to the English language.
Python has syntax that allows developers to write programs
with fewer lines than some other programming languages.
Python runs on an interpreter system, meaning that code can be
executed as soon as it is written. This means that prototyping
can be very quick.”
Write a python program to count the number of words in
1. sample.txt
Get PAN number from user, Validate the input using python, 15 K2 CO4
PAN number must be in format “XXXXX1234X” where first five
places are characters, followed by 4 numbers and ends with a
character. If the input is not valid throw user defined exception
2 “INVALID PAN INPUT”
Write a python program to get voter detail like in the given form 15 K2 CO4
as dictionary
{name: a ,
phone: 1234567890,
age: 24}
If age is less than 18, raise a user defined exception “ NOT
3 ELIGIBLE FOR VOTER ID”
Write a program to build a simple Student Management System 15 K2 CO4
using Python which can perform the following operations: Use
classes and objects in your program
● Accept
● Display
● Search
● Delete
4 ● Update
Course Outcomes
CO Outcomes K level
Summarize the syntax and semantics, string operations of python
CO1 K2
programming language
Demonstrate python programs using control flow statements and
CO2 K3
data structures
CO3 Illustrate the concepts of functions ,modules and packages in python K3
Understand the concepts of object oriented programming, files and
CO4 K2
exception handling
CO5 Analyze standard libraries in python K4
Appraise various problem solving concepts in python to develop real
CO6 K4
time applications