1.
Practical Question: Employee Salary Calculator (Using Dictionaries & Functions)
Scenario
A company wants a program to calculate employee salaries after tax deductions.
Task Requirements
1. Create a dictionary with employee names as keys and gross salaries as values.
2. Define a function calculate_net_salary(salary) that deducts 10% tax.
3. Loop through the dictionary and calculate net salaries.
4. Display each employee’s name and net salary.
Test Input
Code
Employees: {'John': 5000, 'Mary': 7000}
Expected Output
Code
John → Net Salary: 4500.0
Mary → Net Salary: 6300.0
2. Practical Question: Even and Odd Number Separator (Using Lists & Loops)
Scenario
A teacher wants a program to separate even and odd numbers from a list.
Task Requirements
1. Ask the user to enter 5 numbers.
2. Store them in a list.
3. Use a loop to separate even and odd numbers into two sets.
4. Display both sets.
Test Input
Code
Enter numbers: 10 15 22 33 40
Expected Output
Code
Even Numbers: {10, 22, 40}
Odd Numbers: {15, 33}
3. Practical Question: Student Gradebook (Using Nested Dictionaries)
Scenario
A school wants to store marks for multiple students in multiple subjects.
Task Requirements
1. Create a nested dictionary: {"Alice": {"Math":85,"English":78},
"Bob":{"Math":60,"English":55}}.
2. Loop through the dictionary to calculate each student’s average.
3. Display name, marks, and average.
Test Input
Code
Students: {"Alice": {"Math":85,"English":78}, "Bob":{"Math":60,"English":55}}
Expected Output
Code
Alice → Marks: {'Math': 85, 'English': 78}, Average: 81.5
Bob → Marks: {'Math': 60, 'English': 55}, Average: 57.5
4. Practical Question: Factorial Calculator (Using Functions & Loops)
Scenario
A math student wants a program to calculate factorials.
Task Requirements
1. Define a function factorial(n) that uses a loop to calculate factorial.
2. Ask the user for a number.
3. Display the factorial.
Test Input
Code
Enter number: 5
Expected Output
Code
Factorial of 5 = 120
\
5. Practical Question: Word Length Counter (Using Strings & Dictionaries)
Scenario
A publishing company wants to analyze word lengths in a sentence.
Task Requirements
1. Ask the user for a sentence.
2. Split the sentence into words.
3. Store each word and its length in a dictionary.
4. Display the dictionary.
Test Input
Code
Enter sentence: Python is powerful
Expected Output
Code
{'Python': 6, 'is': 2, 'powerful': 8}
6. Practical Question: Multiplication Table (Using Nested Loops)
Scenario
A school wants multiplication tables for numbers in a given range.
Task Requirements
1. Ask the user for a start and end number.
2. Use nested loops to generate tables up to 10.
Test Input
Code
Enter start: 2
Enter end: 3
Expected Output
Code
Table for 2
2x1=2
...
2 x 10 = 20
Table for 3
3x1=3
...
3 x 10 = 30
7. Practical Question: Unique Grades Finder (Using Sets)
Scenario
A teacher wants to know all unique grades awarded in a class.
Task Requirements
1. Ask the user for 5 student grades.
2. Store them in a set.
3. Display the unique grades.
Test Input
Code
Enter grades: A B A C B
Expected Output
Code
Unique Grades: {'A', 'B', 'C'}
8. Practical Question: ATM Withdrawal Simulation (Using Control Flow)
Scenario
An ATM should allow withdrawals only if the balance is sufficient.
Task Requirements
1. Ask the user for account balance and withdrawal amount.
2. If withdrawal ≤ balance → allow transaction.
3. Else → display “Insufficient funds”.
Test Input
Code
Balance: 1000
Withdraw: 600
Expected Output
Code
Transaction successful. New balance: 400
9. Practical Question: Celsius to Fahrenheit Converter (Using Functions & Math)
Scenario
A weather station wants to convert temperatures.
Task Requirements
1. Define a function c_to_f(c) that converts Celsius to Fahrenheit.
2. Ask the user for a Celsius value.
3. Display the Fahrenheit value.
Test Input
Code
Enter Celsius: 25
Expected Output
Code
Fahrenheit: 77.0
10. Practical Question: Word Frequency Counter (Using Dictionaries)
Scenario
A newspaper wants to count word frequency in an article.
Task Requirements
1. Ask the user for a sentence.
2. Split into words.
3. Store word counts in a dictionary.
4. Display the dictionary.
Test Input
Code
Enter sentence: the cat sat on the mat
Expected Output
Code
{'the': 2, 'cat': 1, 'sat': 1, 'on': 1, 'mat': 1}
11. Practical Question: Shopping Cart System (Using Dictionaries & Sets)
Scenario
A supermarket wants a program to manage a shopping cart. The program should store items,
their prices, and categories, then calculate the total bill.
Task Requirements
1. Create a dictionary where keys are item names and values are prices.
2. Create a set to store unique categories of items.
3. Ask the user to add 3 items (name, price, category).
4. Display the dictionary and set.
5. Calculate the total bill.
6. Apply a 10% discount if the total exceeds 100.
Test Input
Code
Enter item name: Apples
Enter price: 50
Enter category: Fruits
Enter item name: Milk
Enter price: 60
Enter category: Dairy
Enter item name: Bread
Enter price: 40
Enter category: Bakery
Expected Output
Code
Items: {'Apples': 50, 'Milk': 60, 'Bread': 40}
Categories: {'Fruits', 'Dairy', 'Bakery'}
Total before discount: 150
Discount applied: 10%
Final Total: 135.0
12. Practical Question: Prime Number Checker (Using Loops & Control Flow)
Scenario
A math teacher wants a program that checks if a number is prime and displays the result.
Task Requirements
1. Ask the user to enter a number.
2. Use a loop to check if the number is prime.
3. Display whether the number is prime or not.
Test Input
Code
Enter number: 13
Expected Output
Code
13 is a prime number.
13. Practical Question: Temperature Converter (Using Functions & Math)
Scenario
A weather station wants a program to convert temperatures from Celsius to Fahrenheit.
Task Requirements
1. Define a function c_to_f(celsius) that converts Celsius to Fahrenheit using: F = C * (9/5) +
32
2. Ask the user for a temperature in Celsius.
3. Call the function and display the result.
Test Input
Code
Enter temperature in Celsius: 25
Expected Output
Code
Temperature in Fahrenheit: 77.0
14. Practical Question: Word Frequency Counter (Using Dictionaries & Strings)
Scenario
A publishing company wants a program that counts the frequency of words in a sentence.
Task Requirements
1. Ask the user to enter a sentence.
2. Split the sentence into words.
3. Store each word and its frequency in a dictionary.
4. Display the dictionary.
Test Input
Code
Enter sentence: the cat sat on the mat
Expected Output
Code
Word Frequency: {'the': 2, 'cat': 1, 'sat': 1, 'on': 1, 'mat': 1}
15. Practical Question: Multiplication Table Generator (Using Nested Loops)
Scenario
A school wants a program that generates multiplication tables for numbers in a given range.
Task Requirements
1. Ask the user for a start and end number.
2. Use nested loops to generate multiplication tables from start to end (up to 10).
3. Display the tables.
Test Input
Code
Enter start number: 2
Enter end number: 3
Expected Output
Code
Multiplication Table for 2
2x1=2
2x2=4
...
2 x 10 = 20
Multiplication Table for 3
3x1=3
3x2=6
...
3 x 10 = 30