ICS3U1 - Pseudocode Questions
ICS3U1 - Pseudocode Questions
1. Create a program that prompts the user for two numbers and then displays the sum,
product, and quotient of the two numbers
● INPUT num1
● INPUT num2
● sum = num1 + num2
● product = num1 * num2
● quotient = num1 / num2
● DISPLAY sum
● DISPLAY product
● DISPLAY quotient
2. Create a program that prompts for length, width, and height then calculates the
volume of a rectangular prism
● INPUT length
● INPUT width
● INPUT height
● volume = length * width * height
● DISPLAY volume
3. Create a program that prompts the user for the number of burgers ($5.99), fries
($3.50), and drinks ($1.99) they would like to purchase. Calculate the final total,
including the 14% tax at the end
● INPUT burgers
● INPUT fries
● INPUT drinks
● total = (burgers * 5.99) + (fries * 3.50) + (drinks * 1.99)
● total = total * 1.14
● DISPLAY total
4. Using the interest rate formula given below, create a program that calculates how
much interest someone would earn on their investment. Prompt the user to enter the
principal amount (how much they invested), the number of years they are investing
for, and the interest rate in decimal form. Display the amount the user would have at
the end of the investment period
● INPUT principal
● INPUT numofyears
● INPUT interestRate
● total = principal * (1 + (interestRate * numofyears))
● DISPLAY tota
Level 2
Level 3
1. Write a pseudocode for a program that will display a countdown from 1,000,000 to 1.
● INITIALIZE count = 1,000,000
● DISPLAY count
● count = count - 1
● LOOP back to Line 1 until count = 0
2. Write a pseudocode for a program that will display all even numbers between 50 and
100 inclusive.
● INITIALIZE count = 50
● if count % 2 = 0, DISPLAY count
● count = count + 1
● LOOP back to Line 2 until count = 101
3. Create a program that will prompt the user for two numbers. The program will then
display all the numbers in between including endpoints.
● INPUT num1
● INPUT num2
● INITIALIZE count = 0
● IF num1 + count <= num2, print num1 + count
● ELSE, break out of loop
● count = count + 1
● LOOP to line 4
1. Create a program that will prompt the teacher the number of students in the class. The
program will then prompt for marks for each student. The program will display the highest
mark, lowest mark, class average, number of students that failed, number of students that got
over an 80.
● INPUT students
● INITIALIZE marks = []
● INPUT mark, append into marks
● LOOP back to Line 3 until the iteration of the loop has reached int value of students
● INITIALIZE highest = -10000
● IF mark > highest, highest = mark
● LOOP back to line 6, loop through all values in the list “marks”
● INITIALIZE lowest = 10000
● IF mark < lowest, lowest = mark
● LOOP to line 9, loop through all values in the list “marks”
● INITIALIZE average = 0
● average += mark
● LOOP back to line 12, which loops through all values in the list “marks”
● average = average/students
● INITIALIZE failed = 0
● IF mark < 50, failed += 1
● LOOP back to line 16, which loops through all values in the list “marks”
● INITIALIZE eighty = 0
● IF mark > 80, eighty += 1
● LOOP back to line 19, which loops through all values in the list “marks”
● DISPLAY highest, lowest, average, failed, eighty
2. Create a program that prompts a MLB baseball player the number of hits that he got in
each game he played in the season (162 games). The program should display his average score
and the game where he had his highest score and lowest hits.
● INITIALIZE most = {}
● INITIALIZE least = {}
● INITIALIZE average []
● INITIALIZE highest = -10000
● INITIALIZE lowest = 10000
● INPUT numhits
● APPEND numhits into average
● IF numhits > highest, numhits = highest, most = {(iteration of loop + 1): numhits}
● IF numhits < lowest, numhits = lowest, least = {(iteration of loop + 1): numhits}
● LOOP back to line 2 (162 times)
● average = average/162
● DISPLAY average, most(first value will be the game, second will be the score), least
3. Create a program that will prompt the user for different temperatures. The program should
ask if the user wants to continue entering or not. The program should display the number of
temperatures entered, average temp, coolest temp, warmest temp.
● INITIALIZE numOfTemps = 0
● INITIALIZE temps = []
● INITIALIZE warmest = -10000, coolest = 10000, average = 0
● INPUT boolean = yes/no
● IF boolean = yes, INPUT temperature
○ numOfTemps += 1
○ average += temperature
○ IF temperature > warmest, warmest = temperature
○ IF temperature < coolest, coolest = temperature
● ELSE, break out of loop
● LOOP back to line 4
● average = average/numOfTemps
● DISPLAY numOfTemps, average, warmest, coolest
4. Create a program that will prompt the user for numbers. The program will stop prompting
once a negative number has been entered. The program will display the total entries, lowest
entry, highest entry, average, number of entries that are even and odd. (excluding the
negative number)
● INITIALIZE totalEntries = 0
● INITIALIZE lowest = 1000000, highest = -1000000, average = 0, even = 0, odd = 0
● INPUT number
● IF number >= 0,
○ totalEntries += 1
○ average += temperature
○ IF number > highest, highest = number
○ IF number < coolest, lowest = number
○ IF number % 2 = 0, even += 1
○ ELSE, odd += 1
● ELSE, break out of loop
● LOOP back to line 4
● average = average/totalEntries
● DISPLAY totalEntries, lowest, highest, average, even, odd
1. Create a program that will prompt the user for a positive number. The program will display
if the number is PRIME or not.
● count = 2
● INPUT number
● IF number = 2, DISPLAY “PRIME”
● IF count < number,
○ IF number / count = type(int), DISPLAY “NOT PRIME”
■ Break out of whole loop
○ count += 1
○ IF count = number, DISPLAY “PRIME”