Python Q&A - Unit 1, 2 & 3
Short Answer Questions (SAQs)
Unit 1
1. Briefly explain about Python programming.
Python is a high-level, interpreted programming language known for its
simplicity and readability. It is widely used in web development, data science,
AI, and cybersecurity.
2. Explain the Structure of a Python program.
A Python program follows this structure:
• Import statements: Importing modules (e.g., import math)
• Comments: Used for documentation (e.g., # This is a comment)
• Functions: User-defined reusable code blocks (def
function_name():)
• Main Code: The actual execution logic
3. Write short notes on Input and Output Statements.
Input: Used to take user input.
name = input("Enter your name: ")
print("Hello,", name)
Output: Used to display results.
print("Welcome to Python")
4. Write short notes on Python numbers.
Python supports three types of numbers:
• Integers (int): Whole numbers (e.g., 10, -5)
• Floating Point (float): Decimal numbers (e.g., 3.14, -0.99)
• Complex Numbers (complex): Numbers with imaginary parts (e.g., 2 +
3j)
Long Answer Questions (LAQs)
Unit 1
1. What is Python Programming? Explain the features of
Python Programming.
Python is a powerful, easy-to-learn, and highly versatile programming
language.
Features of Python:
• Easy to Learn & Readable: English-like syntax.
• Dynamically Typed: No need to declare variable types.
• Interpreted: Executes code line-by-line.
• Extensive Libraries: Includes NumPy, Pandas, etc.
• Object-Oriented & Functional: Supports both paradigms.
2. Define Operators and explain any five Operators with syntax
and examples.
Operator Type Example
Arithmetic +, -, *, /, //, %
Comparison ==, !=, >, <
Logical and, or, not
Membership in, not in
Identity is, is not
Unit 2
1. Explain Conditional statements in Python.
if x > 5:
print("Greater")
elif x == 5:
print("Equal")
else:
print("Smaller")
2. Explain Looping statements in Python.
for i in range(5):
print(i)
3. Define Functions. Explain Built-in functions with syntax and
examples.
Python has built-in functions like print(), len(), type(), max(), min(),
etc.
4. What is a Function? Explain User-defined functions in
Python.
def add(a, b):
return a + b
result = add(5, 3)
print(result) # Output: 8