0% found this document useful (0 votes)
2 views2 pages

Python Question Bank 2026

The document is a question bank for the Maharaja Institute of Technology Mysore, covering various modules in Python programming. It includes topics such as Python basics, data structures, string handling, file I/O, debugging, and object-oriented programming. Each module contains specific questions and programming examples to illustrate key concepts and functionalities in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python Question Bank 2026

The document is a question bank for the Maharaja Institute of Technology Mysore, covering various modules in Python programming. It includes topics such as Python basics, data structures, string handling, file I/O, debugging, and object-oriented programming. Each module contains specific questions and programming examples to illustrate key concepts and functionalities in Python.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MAHARAJA INSTITUTE OF TECHNOLOGY MYSORE

BELAWADI, NAGUVANAHALLI POST, SRIRANGAPATNA TALUK, MANDYA-


571 477

Question Bank

Module 1 (Python Basics, Flow Control, Functions, Scope, Exception Handling)

1. With Python programming examples, explain the syntax of break and continue
statements.
2. What is a flow-control statement? With a flow chart, discuss if and if-else statements.
3. Explain the scope rules of variables in Python. Differentiate between local and global scope
with examples.
4. Explain different types of operators in Python with examples.
5. What is an arithmetic expression? . Apply the python syntax to get the output of this
statement? ‘hello world’ + 100 + ’how are you’ explain the reason if the statement produces
an error.
6. Explain input and output functions in Python with examples.
7. Explain string concatenation and string replication with an example.
8. Define exception handling. How exception are handled in python? Write a Program to solve
divide by zero error

Module 2 (Lists, Dictionaries, Data Structures)

1. Explain with programming examples: negative indexing, slicing, methods like append(),
remove(), pop(), insert(), sort() on lists.
2. Explain the methods get() and setdefault() in dictionaries with examples.
3. Explain various string operations in Python with examples.
4. Differentiate between list and tuple with examples.
5. Illustrate List Methods with an example and pretty printing with example.
6. Explain isX() methods with example
7. Interept the significance of mutable and immutable data stuctures in python.
8. Explain how a Tic-Tac-Toe game is implemented using a board program.

Module 3 (Strings, File I/O, OS modules)

1. Explain string-handling methods such as .join(), .split(), .isalpha(), .isalnum(),


.isspace() with examples.
2. Explain, with suitable Python program segments, [Link]() and
[Link]().
3. Iilustrate string slicing operations with an example.
4. Explain Python string handling methods with examples: split(),endswith(), ljust(),
center(), lstrip(), startswith().
5. Illsutrate rjust(),ljust(),center methods with example.
6. Describe upper(),lower(),isupper(),islower() methods with examples
7. Explain reading and saving python program variables using shelve module with suitable
Python program

Module 4: Organizing Files & Debugging

1. Explain the functions in the shutil module for copying, moving and deleting
files/folders. Give Python examples.
2. What are the benefits of compressing folders/files? Demonstrate how to create a .zip file
from a given directory, and how to read/extract a .zip file in Python.
3. Explain the process of walking through a directory tree (all sub-folders and files) in
Python. Write a program to count all files of a certain type (e.g., “.txt”) in the directory
tree.
4. Discuss raising exceptions and using assertions in Python.
5. What is logging? Explain the logging levels with suitable examples.
6. How to delete files and folders permanently explain safe deletes with send2trash
7. Define assertion. Analyze how assertions are used in traffic light simulation.

Module 5:Classes, Objects & Object-Oriented Programming

1. What is a class in Python? How do you define a class and instantiate its objects? Explain
with an example (e.g., a simple Employee class).
2. 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.
3. explain the terms: object, class, attribute, method with an example.
4. Define copying. Illustrate the shallow copy and deep copy method with suitable code
5. What is a “pure function” and what is a “modifier” in the context of object-oriented
Python? Illustrate with a class Time and a function that either modifies the object or
returns a new object.
6. Explain the special methods __init__ and __str__ in Python classes. Write a class
Complex to represent complex numbers, and show how __str__ can be used to print
objects nicely.
7. Develop a program to create a Time class with hour, min and sec as attributes.
Demonstrate how two Time objects would be added.

You might also like