SECTION 'A'
(Objective Type Questions)
Marks: 08 (8 Questions × 1 Mark each)
Q1. Which of the following is a valid variable name in Python?
a) 2name
b) my-name
c) my_name
d) for
Answer = c) my_name
Q2. Which of the following is the correct syntax to print “Hello World” in Python?
a) print "Hello World"
b) echo("Hello World")
c) print("Hello World")
d) printf("Hello World")
Answer ✅ c) print("Hello World")
Q3. Which of the following is a mutable data type in Python?
a) Tuple
b) List
c) String
d) Set
Answer ✅ b) List
Q4. Which symbol is used to start a comment in Python?
a) //
b) <!--
c) #
d) /*
✅ c) # Comments in Python start with #.
Q5. What will be the output of this code?
a=5
b=2
print(a ** b)
a) 10
b) 25
c) 7
d) 2.5
Answer ✅ b) 25 a ** b means 5² = 25.
Q6. Which of the following operators is used for comparison?
a) =
b) ==
c) :=
d) <>
Answer ✅ b) == == compares two values, while = assigns a value.
Q7. Which keyword is used to define a function in Python?
a) define
b) function
c) def
d) fun
Answer ✅ c) def Functions in Python are defined using the def keyword
Q8. What will be the output of this code?
x = "Hello"
print(x[1])
a) H
b) e
c) l
d) o
Answer ✅ b) e "Hello"[1] gives the second character, which is 'e'.
SECTION 'B'
(Short Answer Type Questions)
Q1. Explain the difference between = and == operators in Python with examples.
Answer Difference between = and == operators
Operator. Meaning. Example Output
= Assignment operator (stores a value in a variable). x = 5 assigns 5 to x
== Comparison operator (checks equality). x == 5 True if x equals 5
Example:
x=5
print(x == 5) # True
Q2. What are data types in Python? Explain any three with examples.
Q2. Data types in Python (any three)
Answer. 1. int – stores integers
Example: a = 10
2. float – stores decimal numbers
Example: b = 12.5
3. str (string) – stores text
Example: name = "Alice"
Q3. What is the difference between a while loop and a for loop in Python?
Answer. Difference between while and for loops
Loop Syntax Example Use Case
while while i < 5: Used when number of iterations is unknown.
for for i in range(5): Used when number of iterations is known.
Q4. Explain the use of indentation and comments in Python.
Answer. Indentation and Comments
Indentation: Defines code blocks in Python instead of {}.
Example:
if True:
print("Indented block")
Comments: Start with #, used to explain code.
Example:
# This is a comment
Q5. What are the logical operators in Python? Explain with examples.
Answer. Logical operators in Python
Operator Meaning. Example Result
and. True if both true 5>2 and 2>1 True
or. True if one true 5>2 or 2<1 True
not. Reverses condition not(5>2) False
SECTION 'C'
(Long Answer / Programming Questions)
Marks: 30 (5 Questions × 6 Marks each)
Q1. Write a Python program to check whether a number entered by the user is even or odd.
Answer Even or Odd Number
num = int(input("Enter a number: "))
if num % 2 == 0:
print("Even Number")
else:
print("Odd Number")
✅ Checks remainder when divided by 2.
Q2. Write a Python program to print the multiplication table of 5 using a while loop.
Answer. Multiplication Table of 5 using While Loop
i=1
while i <= 10:
print("5 x", i, "=", 5*i)
i += 1
✅ Uses while loop with counter increment.
Q3. Write a Python program to find the largest among three numbers using an if-else statement.
Answer. Largest Among Three Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a > b and a > c:
print("Largest is:", a)
elif b > c:
print("Largest is:", b)
else:
print("Largest is:", c)
Q4. Write a Python program to print numbers from 1 to 10 using a for loop.
Answer Print Numbers 1 to 10 using For Loop
for i in range(1, 11):
print(i)
✅ range(1,11) prints from 1 to 10.
Q5. Write a Python function to find the factorial of a given number.
Answer Function to Find Factorial
def factorial(n):
fact = 1
for i in range(1, n+1):
fact *= i
return fact
num = int(input("Enter a number: "))
print("Factorial:", factorial(num))
✅ Uses for loop and function definition.
Q6. Write a Python program that takes two numbers as input from the user and prints their sum and product.
Answer
Sum and Product of Two Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
print("Sum:", a + b)
print("Product:", a * b)
✅ Performs arithmetic operations.
SECTION 'A'
(Objective Type Questions — 8 Marks)
(8 Questions × 1 Mark each)
Q1. Which of the following is a keyword in Python?
a) val b) loop c) elif d) main
✅ c) elif elif is a keyword used in conditional statements.
Q2. What is the output of the following code?
x = 10
y=3
print(x // y)
a) 3.33 b) 3 c) 4 d) 10/3
Answer. ✅ b) 3// is floor division; gives integer part only.
Q3. Which function is used to get input from the user in Python?
a) scanf() b) cin c) input() d) get()
Answer. ✅ c) input() Used to take input from user in Python.
Q4. What is the correct syntax to create a list in Python?
a) list = (1, 2, 3) b) list = [1, 2, 3] c) list = {1, 2, 3} d) list = <1, 2, 3>
Answer. ✅ b) list = [1, 2, 3] Lists use square brackets [].
Q5. Which operator is used to check membership in Python?
a) in b) is c) == d) equals
Answer. ✅ a) inChecks if a value exists in a sequence.
Q6. Which data type is immutable in Python?
a) List b) Dictionary c) Tuple d) Set
Answer. ✅ c) Tuple Tuples cannot be modified after creation.
Q7. Which statement is used to skip the current iteration in a loop?
a) stop b) continue c) pass d) skip
Answer. ✅ b) continue Skips current loop iteration and continues next.
Q8. What will be the output of this code?
print(2 ** 3 ** 2)
a) 64 b) 512 c) 8 d) Error
Answer. ✅ b) 512 Evaluated as 2 ** (3 ** 2) = 2 ** 9 = 512.
SECTION 'B'
(Short Answer Type Questions — 12 Marks)
Q1. Explain the difference between identity and membership operators with examples.
Identity vs Membership Operators
Type. Operator Example Explanation
Identity is, is not a is b. Checks if both refer to the same object in memory.
Membership in, not in 'a' in 'apple' Checks if a value exists inside a sequence.
Example:
x = [1, 2, 3]
y=x
print(x is y) # True (same object)
print(2 in x) # True (2 exists in list)
Q2. What is the difference between mutable and immutable data types? Give two examples of each.
Mutable vs Immutable Data Types
Type. Can Be Changed? Examples
Mutable ✅ Yes List, Dictionary, Set
Immutable ❌ No. Tuple, String, int
Example:
my_list = [1,2,3]
my_list[0] = 10 # Works
my_tuple = (1,2,3)
# my_tuple[0] = 10 → Error
Q3. Explain the use of break, continue, and pass statements in loops.
Answer break, continue, and pass
Statement Function. Example
break. Ends loop immediately if i == 3: break
continue Skips current iteration if i == 2: continue
pass. Placeholder; does nothing Used for empty blocks
Example:
for i in range(5):
if i == 2:
continue
print(i)
Q4. What is type casting? Explain implicit and explicit type conversion with examples.
Answer Type Casting
Type casting means converting one data type to another.
Implicit Casting: Python converts automatically
x=5
y = 2.5
print(x + y) # 7.5 → int converted to float
Explicit Casting: User converts manually
a = int("10")
print(a + 5) # 15
Q5. Write a short note on Python indentation and its importance.
Answer Indentation in Python
Indentation shows block structure (instead of {} like C/C++).
Usually 4 spaces per indent.
Missing indentation causes errors.
Example:
if True:
print("Indented block")
SECTION 'C'
(Long Answer Type / Programming Questions — 30 Marks)
(Attempt any 5 questions, 6 Marks each)
Q1. Write a Python program to check whether a given number is positive, negative, or zero.
Answer Positive, Negative, or Zero
num = int(input("Enter a number: "))
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")
✅ Uses if–elif–else for decision making.
Q2. Write a Python program using a for loop to print even numbers from 1 to 20.
Answer Even Numbers 1 to 20 (for loop)
for i in range(1, 21):
if i % 2 == 0:
print(i) ✅ Uses modulus % to check even numbers.
Q3. Write a Python program to calculate the factorial of a number using recursion.
Answer. Factorial using Recursion
def factorial(n):
if n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
num = int(input("Enter number: "))
print("Factorial:", factorial(num))
✅ Function calls itself repeatedly until base case.
Q4. Write a Python program to display the sum of all elements in a list.
Answer. Sum of List Elements
numbers = [10, 20, 30, 40, 50]
total = 0
for n in numbers:
total += n
print("Sum =", total)
✅ Adds elements one by one using a loop.
Q5. Write a Python program to find the largest element in a list without using the max() function.
Answer. Largest Element (Without max())
numbers = [8, 12, 5, 19, 3]
largest = numbers[0]
for n in numbers:
if n > largest:
largest = n
print("Largest =", largest)
✅ Compares each element manually.
Q6. Write a Python program that takes a string as input and counts the number of vowels in it.
Answer Count Vowels in a String
text = input("Enter a string: ")
vowels = "aeiouAEIOU"
count = 0
for ch in text:
if ch in vowels:
count += 1
print("Number of vowels:", count)
✅ Uses membership operator in to check vowels.