Topic :Paper 2 Programming Practice Questions
Variables and Constants:
1. Variables & Constants (Python)
📝 Question 1
Write a program that:
Stores your name in a variable
Stores your age in another variable
Prints:
"My name is ___ and I am ___ years old"
Answer:
Name=”Xyx”
Age=23
print(“My name is”, Name, “ and I am “, Age, “years old”)
Ask user to input radius
Display the area
📝 Question 3 (Exam-style)
A program stores the price of an item and a discount rate.
Price = 200
Discount = 10%
Calculate and print the final price.
🔹 2. Selection (IF Statements)
📝 Question 4
Write a program that:
Inputs a number
Checks if it is positive, negative, or zero
📝 Question 5 (Grade boundary style)
Input a student's marks and print:
"A" if ≥ 80
"B" if ≥ 60
"C" if ≥ 40
"Fail" otherwise
🔹 3. Loops (Iteration)
📝 Question 7 (FOR loop)
Write a program to:
Print numbers from 1 to 10 using a loop
📝 Question 8 (WHILE loop)
Write a program that:
Keeps asking for a password until the correct one is entered
📝 Question 9 (Exam-style logic)
Write a program to:
Input 5 numbers
Find and print the total sum
📝 Question 10 (Higher level)
Write a program that:
Inputs a number
Prints its multiplication table (up to 10)
🔹 4. Mixed Concept Questions (Very Exam-Like)
📝 Question 11
Write a program that:
Inputs 10 numbers
Counts how many are even
📝 Question 12
Write a program to:
Input a username and password
Allow only 3 attempts
Display "Access Granted" or "Access Denied"
List Creation & Input
📝 Question 1 (Basic)
Write a program to:
Create an empty list
Input 5 numbers from the user
Store them in the list
Print the list
📝 Question 2 (Exam-style)
Write a program to:
Create a list of 10 integers
Input values from the user
Display all values on one line
📝 Question 3
Write a program to:
Store 5 names in a list
Display each name on a new line
📝 Question 5 (Index-based)
Write a program to:
Traverse a list using index
Print index and value