Python Programming Question Bank - B.
Tech 1st Year
UNIT I - Fundamentals of Python
1. Program Development Cycle:
Steps: Understand Problem, Design, Code, Test, Deploy, Maintain
2. Decision Structures:
if, if-else, if-elif-else, nested if (with examples)
3. Running Total Program:
total = 0
while True:
num = input("Enter number: ")
if num == 'done': break
total += int(num)
4. Types of Operators:
Arithmetic, Comparison, Logical, Assignment, Bitwise
5. Repetition Structures:
for loop (definite), while loop (indefinite)
Python Programming Question Bank - B.Tech 1st Year
UNIT II - Functions, File Handling, Exceptions
1. Functions:
def greet(name): print("Hello", name)
2. File Handling:
f = open("file.txt", "r"); f.read()
3. Exceptions:
try-except blocks (ZeroDivisionError, ValueError)
4. File Read Program:
with open("file.txt") as f: print(f.read())
5. Iteration Types:
for (definite), while (indefinite)
Python Programming Question Bank - B.Tech 1st Year
UNIT III - Strings, Data Structures, Recursion
1. String Methods:
upper(), lower(), replace(), slicing
2. Palindrome:
s == s[::-1]
3. Lists, Tuples, Dictionaries:
list = [1,2]; tuple = (1,2); dict = {"key": "value"}
4. Search Element:
if n in list: print("Found")
5. Recursion:
def fact(n): return 1 if n==0 else n*fact(n-1)
Python Programming Question Bank - B.Tech 1st Year
UNIT IV - Object-Oriented Programming
1. OOP Principles:
Encapsulation, Abstraction, Inheritance, Polymorphism
2. Classes & Objects:
class A: def __init__(): pass
3. Inheritance/Polymorphism:
class B(A): def speak(): pass
4. Multiple Inheritance:
class C(A, B): pass
5. Procedural vs OOP:
Function-based vs Class-based
Python Programming Question Bank - B.Tech 1st Year
UNIT V - GUI Programming (tkinter, turtle)
1. tkinter Features:
Widgets, mainloop()
2. Login Window:
Label, Entry, Button in tkinter
3. Widget Types:
Label, Entry, Button, Checkbutton
4. Turtle Graphics:
Draw star using loop and angle 144
5. Image Processing:
from PIL import Image
img = Image.open("file.jpg")
img.show()