0% found this document useful (0 votes)
18 views

Pseudocode Practice

The document provides practice questions for IBDP Computer Science SL/HL Paper 1, focusing on algorithms such as searching and sorting arrays. It includes pseudocode tasks for checking the existence of elements in arrays, sorting arrays using selection sort, counting passed students, and finding the highest and lowest scores. Additionally, it combines sorting and searching to check for specific scores in an array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Pseudocode Practice

The document provides practice questions for IBDP Computer Science SL/HL Paper 1, focusing on algorithms such as searching and sorting arrays. It includes pseudocode tasks for checking the existence of elements in arrays, sorting arrays using selection sort, counting passed students, and finding the highest and lowest scores. Additionally, it combines sorting and searching to check for specific scores in an array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

IBDP Computer Science SL/HL - Paper 1 practice

Solve the following questions:

1. Searching for an Element in an Array

Write a pseudocode to check if a specific number exists in an array of student IDs.

Input:

● Array STUDENT_IDS = [101, 203, 315, 432, 509]


● A student ID to search for.

Output:

● Print "Student ID X is found" if the ID is in the array.


● Print "Student ID X is not found" if the ID is not in the array.

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."

2. Sorting an Array (Selection Sort)

Write a pseudocode to sort the STUDENT_IDS array in ascending order using selection
sort.

Input:

● Array STUDENT_IDS = [203, 432, 315, 509, 101]


Output:

● Sorted array: [101, 203, 315, 432, 509]

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.

3. Counting Passed Students

Write a pseudocode to count how many students have passed a test. Passing scores
are stored in the SCORES array.

Input:

● Array SCORES = [45, 78, 62, 55, 90]


● Pass mark: 50

Output:

● The number of students who have passed.

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:

Write a pseudocode to find the highest score in the SCORES array.

Input:

● Array SCORES = [45, 78, 62, 55, 90]

Output:

● The highest score: 90

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.

5. Finding the Lowest Score

Problem:

Write a pseudocode to find the lowest score in the SCORES array.

Input:

● Array SCORES = [45, 78, 62, 55, 90]

Output:

● The lowest score: 45


Hint:

Look for the smallest number in the list.


Start by assuming the first number is the smallest.
Check each number. If you find a smaller one, remember it as the smallest.
At the end, say which number is the smallest.

6. Combining Sorting and Searching

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:

● Array SCORES = [45, 78, 62, 55, 90]


● A score to search for (e.g., 55).

Output:

● Print "Score X is found" or "Score X is not found".

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.

*********************

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy