AMRUTA INSTITUTE OF ENGINEERING AND MANAGEMENT SCIENCES
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
ACADEMIC YEAR:2024-25
Subject: Introduction to Python Programming
Subject Code:BPLCK205B
Module 1
1. Explain the math operators in Python from highest to lowest Precedence with an example for
each. Write the steps how Python is evaluating the expression (5 - 1) * ((7 + 1) / (3 - 1)) and
reduces it to a single value.
2. Explain Local and Global Scope in Python programs. What are local and global variables?
How can you force a variable in a function to refer to the global variable?
3. What are Comparison and Boolean operators? List all the Comparison and Boolean operators
in Python and explain the use of these operators with suitable examples.
4. What is Exception Handling? How exceptions are handled in Python? Write a Python
Program with exception handling code to solve divide-by-zero error situation.
5. What are the different flow control statements supports in python .Explain any 3 with
an suitable example program and flow chart.
6. What is a function? How to define a function in python? Write a program using function to
find out the given string is palindrome or not.
7. Demonstrate with example print(),input() and string replication
8. Write a python program to check whether given number is even or odd.
9. Explain with example code snippets, different syntax of range() function in python.
10. Demonstrate the use of break and continue keywords using a code snippet.
11. Develop a program to generate Fibonacci sequence of length (N). Read N from the console.
12. Write a function to calculate factorial of a number. Develop a program to compute binomial
coefficient (Given N and R).
Module 2
1. What is Dictionary in Python? How is it different from List data type? Explain how a for
loop can be used to traverse the keys of the Dictionary with an example.
2. Explain the methods of List data type in Python for the following operations with suitable
code snippets for each.
(i) Adding values to a list ii) Removing values from a list
(iii) Finding a value in a list iv) Sorting the values in a list
3. What is list? Explain the concept of slicing and indexing with proper examples.
4. What is the difference between copy.copy( ) and copy.deepcopy( ) functions applicable to a
List or Dictionary in Python? Give suitable examples for each.
5. Discuss the following Dictionary methods in Python with examples.
(i) get() (ii) items() (iii) keys() (iv) values()
6. What is dictionary? Illustrate with an example python program the usage of nested dictionary.
7. What is Dictionary? How it is different from List? Write a program to count the number of
occurrences of character in a string?
8. Create a function to print out a blank tic-tac-toe board
9. How is tuple different from a list and which function is used to convert list to tuple.
10. What is a List? Explain the methods that are used to delete items from the list.
Module 3
1. Explain the various string methods for the following operations with examples.
(i) Removing whitespace characters from the beginning, end or both sides of a string.
(ii) To right-justify, left-justify, and center a string.
2. Explain the file Reading/Writing process with suitable Python Program.
3. List out all the useful string methods which supports in python. Explain with an example for each
method.
4. How do we specify and handle Absolute Relative Path?
5. With example code explain join() and split() string methods.
6. If S=’Hello World’, explain and write the output of the following statements:
i) S[1:5] ii) S[:5] iii) S[3:-1] iv) S[:]
7. What is logging? how this would be used to debug the python program?
8. Explain with suitable Python program segments: (i) os.path.basename() (ii) os.path.join().
9. What is the use of ZIP? how to create a ZIP folder explain.
10. Explain Python string handling methods with examples: split(),endswith(), ljust(), center(),
lstrip()
11. Read a multi-digit number (as chars) from the console. Develop a program to print the frequency
of each digit with suitable message.
Module 4
1. Explain in briefly, What are the different methods of file operations supports in python shutil
module.
2. Explain the role of Assertions in Python with a suitable program.
3. Explain buttons in the Debug control window.
4. What is meant by compressing files? Explain reading, extracting, and creating ZIP files with code
snippet
5. Discuss the following four methods of OS module:
i)chdir() ii)walk() iii)listdir() iv)getcwd()
6. Explain permanent delete and safe delete with a suitable Python programming example to each.
7. Develop a Python program to traverse the current directory by listing subfolders and files.
8. Develop a program to backing Up a given Folder (Folder in a current working directory) into a
ZIP File by using relevant modules and suitable methods.
9. Develop a program to print 10 most frequently appearing words in a text file.
10. Develop a program to sort the contents of a text file and write the sorted contents into a separate text
file.
Module 5
1. Explain the following with syntax and suitable code snippet: i) Class definition ii) instantiation iii)
passing an instance (or objects) as an argument iv) instances as return values.
2. Define pure function and modifier. Explain the role of pure functions and modifiers in application
development with suitable python programs.
3. Explain the program development concept ‘prototype and patch’ with suitable example.
4. Define the terms with example: (i) class (ii) objects (iii) instance variables
5. create a Time class with hour, min and sec as attributes. Demonstrate how two Time objects would
be added.
6. Discuss __str__() and __init__() methods used in class definition.
7. What is class,object,attributes.Explain copy.copy() with an example.
8.Write a function called print_time that takes a time object and print it in the form of
hour:minute:second
9. Explain operator overloading and polymorphism with examples.
10. Define a function which takes TWO objects representing complex numbers and returns new
complex number with a addition of two complex numbers. Define a suitable class ‘Complex’ to
represent the complex number. Develop a program to read N (N >=2) complex numbers and to
compute the addition of N complex numbers.