APPLICATIONS DEVELOPMENT USING PYTHON
Important Questions with Answers (Full Version – [Link]. 5th Sem, ANU)
UNIT – I: INTRODUCTION TO PYTHON
2 Marks – Short Answers
1. Features of Python:
Python is simple, interpreted, dynamically typed, portable, and supports object-oriented programming.
It is used in AI, Web Development, Data Science, etc.
2. Dynamic Typing:
Variables in Python can change type during runtime, which makes Python flexible.
3. Data Types:
int, float, str, bool, list, tuple, set, dict — used to store various types of data.
4. Indentation:
Indentation replaces braces {} to define code blocks in Python.
5. break and continue:
'break' exits the loop; 'continue' skips the current iteration and moves to the next.
10 Marks – Long Answers
1. Explain decision-making and looping statements with examples.
Python supports if, if-else, nested if, while, and for loops for control flow.
Example:
for i in range(1,6):
print(i)
2. Explain Python data types and operators with examples.
Data types include int, float, str, bool, etc. Operators include arithmetic (+, -, *), comparison, logical, and assignment.
3. Program: Factorial of a number
def fact(n):
return 1 if n==0 else n*fact(n-1)
n=int(input("Enter number:"))
print("Factorial:", fact(n))
UNIT – II: FUNCTIONS AND MODULES
2 Marks – Short Answers
1. Function:
A reusable block of code defined using 'def'. Helps avoid repetition.
2. Recursion:
A function that calls itself until a base condition is met.
3. Lambda Function:
A small, anonymous function written in one line. Example: lambda x:x*x
4. Module:
A Python file containing reusable functions or variables that can be imported.
10 Marks – Long Answers
1. Explain function arguments with examples.
Functions can have positional, keyword, default, and variable-length arguments.
Example:
def add(a,b=5): return a+b
2. Explain recursion with factorial example.
def fact(n): return 1 if n==0 else n*fact(n-1)