Practice problems
Problem โ Examples โ Hints โ Write pseudocode โ Run โ Trace โ Test โ Explanation. Pick a topic and a difficulty, and go!
Easy
Add two numbers
TAKE two numbers A and B, add them and DISPLAY the sum.
#Variables
Easy
Age calculator
TAKE the BIRTH_YEAR and the CURRENT_YEAR and DISPLAY how old the person will be this year.
#Variables
Easy
Area of a rectangle
TAKE the WIDTH and HEIGHT of a rectangle and DISPLAY its area.
#Variables
Easy
ATM withdrawal
TAKE the BALANCE and the AMOUNT to withdraw.
#Computational thinking
Medium
Average of a list
Given SET SCORES = [70, 85, 90, 55], DISPLAY the average score.
#Lists
Expert
Balanced brackets
TAKE a TEXT made of ( and ) characters.
#Data structures
Easy
Bill calculator
TAKE the PRICE of an item and the QUANTITY bought.
#Variables
Hard
Bubble sort
Sort SET NUMS = [5, 1, 4, 2, 8] into ascending order using bubble sort (don't use SORT!),…
#Sorting
Easy
Count from 1 to N
TAKE N and DISPLAY every number from 1 to N, one per line.
#Loops
Medium
Count the digits
TAKE a positive whole number N and DISPLAY how many digits it has.
#Loops
Medium
Count the vowels
TAKE a WORD and DISPLAY how many vowels (a, e, i, o, u) it contains.
#Strings
Easy
Even or odd
TAKE a whole number N and DISPLAY "Even" or "Odd".
#Conditions
Medium
Factorial
TAKE N and DISPLAY N! (1 ร 2 ร โฆ ร N).
#Loops
Medium
Fix the countdown
This program should count down from N to 1, but it never stops! Find the bug and fix…
#Debugging
Easy
Grade calculator
TAKE MARKS (0โ100).
#Conditions
Medium
Largest of three numbers
TAKE three numbers A, B and C and DISPLAY the largest.
#Conditions
Hard
Leap year
TAKE a YEAR.
#Conditions
Easy
Linear search
Given SET LIST = [4, 8, 15, 16, 23, 42], TAKE a TARGET and DISPLAY its index, or…
#Searching
Easy
Making tea
Write the steps to make a cup of tea as pseudocode, using DISPLAY for each step.
#Computational thinking
Easy
Maximum with a function
Write FUNCTION MAX2(A, B) that RETURNs the larger value.
#Functions
Easy
Multiplication table
TAKE N and DISPLAY its table from 1 to 5 in the form N x I = ANSWER.
#Loops
Easy
Positive, negative or zero
TAKE a number N and DISPLAY "Positive", "Negative" or "Zero".
#Conditions
Hard
Recursive sum
Write a recursive FUNCTION SUM_TO(N) that returns 1 + 2 + โฆ + N.
#Recursion
Hard
Reverse a number
TAKE a positive whole number N and DISPLAY its digits reversed (1234 โ 4321).
#Loops
Easy
Sum of 1 to N
TAKE N and DISPLAY the sum 1 + 2 + โฆ + N.
#Loops
Medium
Swap two values
TAKE A and B, swap their values, then DISPLAY A and B.
#Variables
๐
No problems match โ try another filter.