Pseudocode Practice
Pseudocode Practice
Input:
Output:
Hint:
Imagine you have a list of rooms that paid their bills.
Someone asks, "Did room 216 pay?"
You check the list one by one.
If you see "216" in the list, you say, "Yes, they paid!"
If you look through the whole list and don’t find it, you say, "No, they didn’t pay."
Write a pseudocode to sort the STUDENT_IDS array in ascending order using selection
sort.
Input:
Hint:
You have a messy pile of blocks with numbers on them.
Start with the first block and find the smallest one.
Swap the smallest block with the first one.
Move to the next block and repeat until all blocks are in order.
Write a pseudocode to count how many students have passed a test. Passing scores
are stored in the SCORES array.
Input:
Output:
Hint:
Count how many rooms are in the list.
Start at zero.
For each room, add 1 to the count.
When you’re done, tell how many rooms there are.
4. Finding the Highest Score
Problem:
Input:
Output:
Hint:
Look for the biggest number in the list.
Start by assuming the first number is the biggest.
Check each number. If you find a bigger one, remember it as the biggest.
At the end, say which number is the biggest.
Problem:
Input:
Output:
Problem:
First, sort the SCORES array in ascending order using selection sort. Then, write a
pseudocode function to check if a specific score exists in the array.
Input:
Output:
Hint:
Find all the even numbers in the list (numbers that can be divided by 2 with no
remainder).
Look at each room number.
If the room number is even, write it down.
At the end, you have a list of all the even-numbered rooms.
*********************