0% found this document useful (0 votes)
19 views5 pages

BTech Python Programming Question Bank

This document is a Python Programming Question Bank for B.Tech 1st Year students, covering fundamentals, functions, file handling, exceptions, strings, data structures, recursion, object-oriented programming, and GUI programming. Each unit includes key concepts, example code snippets, and explanations of various programming structures and principles. The content is structured into five units, providing a comprehensive overview of essential Python programming topics.

Uploaded by

velpulaakshaya6
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)
19 views5 pages

BTech Python Programming Question Bank

This document is a Python Programming Question Bank for B.Tech 1st Year students, covering fundamentals, functions, file handling, exceptions, strings, data structures, recursion, object-oriented programming, and GUI programming. Each unit includes key concepts, example code snippets, and explanations of various programming structures and principles. The content is structured into five units, providing a comprehensive overview of essential Python programming topics.

Uploaded by

velpulaakshaya6
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
You are on page 1/ 5

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()

You might also like