Para educadores: diapositivas de la lección, apuntes de repaso listos para usar sobre Standard Methods Of A Solution (Computer Science, CIE) — úsalos en tu lección, o presenta el tema como una actividad interactiva de clase que tus aprendices juegan como un juego en vivo.
Often used with `REPEAT...UNTIL` or `WHILE` loops to control repetition.
Maximum, Minimum & Average
Maximum and minimum find the largest and smallest values in a dataset.
In pseudocode, set `Highest` and `Lowest` to the first value, then loop through the rest: `IF Scores[Count] > Highest THEN Highest ← Scores[Count] ENDIF` (and `<` for `Lowest`).
Average (mean) is calculated by summing all values and dividing by the count.
Sum via loop: `Total ← Total + Scores[Count]`; then `Average ← Total / NumberOfScores`, where `NumberOfScores` is the declared size of the array.
These methods are commonly used for grades, scores, or any numeric data.
Diapositivas
Sign up free to view the lesson slides
Step through every slide for this topic — plus flashcards and revision notes — with a free account.
Vista previa gratis — 8 de 53 preguntas. Regístrate para verlas todas.
1.What is a linear search?
Easy
AAn algorithm that starts at the first value and checks every value one at a time
BAn algorithm that divides the dataset in half repeatedly to find a value
CAn algorithm that sorts data by comparing adjacent pairs and swapping them
DAn algorithm that uses a hash table to locate data quickly
2.Which of the following is true about a bubble sort?
Easy
AIt compares adjacent values and swaps them if they are in the wrong order
BIt selects the smallest value and moves it to the beginning
CIt requires the dataset to be already sorted to work
DIt only works on numeric data
3.What does the 'found' variable represent in a linear search algorithm?
Easy
AWhether the target value has been found in the dataset
BThe index of the current element being checked
CThe total number of comparisons made
DThe value of the target being searched for
4.A linear search is performed on the list [5, 2, 8, 1, 9] to find the value 8. How many comparisons are made before the value is found?
Easy
A3
B2
C5
D4
5.What is the purpose of the 'swaps' variable in a bubble sort algorithm?
Easy
ATo indicate whether any swaps were made during a pass
BTo count the number of passes completed
CTo store the temporary value during a swap
DTo determine the length of the array
6.After one pass of a bubble sort on the list [5, 2, 4, 1, 6, 3], what is the order of the list?
Medium
A[2, 4, 1, 5, 3, 6]
B[2, 5, 4, 1, 6, 3]
C[2, 1, 4, 3, 5, 6]
D[1, 2, 3, 4, 5, 6]
7.Which of the following is a valid advantage of a linear search?
Easy
AIt can be performed on unsorted data
BIt is the fastest search algorithm for large datasets
CIt uses divide and conquer to reduce search time
DIt requires the data to be sorted first
8.In the context of standard methods of a solution, what is 'totalling'?
Easy
AKeeping a running total of values entered into the algorithm
BCounting the number of times a loop iterates
CFinding the largest value in a list
DSorting a list into ascending order
Más preguntas
9.A program uses a count variable that starts at 50 and decrements by 1 each loop until it reaches 0. How many times will the loop body execute?
Easy
A50
B49
C51
D0
10.Given the pseudocode: Total ← 0; FOR Count ← 1 TO 5; INPUT ItemValue; Total ← Total + ItemValue; NEXT Count; OUTPUT Total. What does this algorithm do?
Medium
ACalculates the sum of five input values
BCalculates the average of five input values
CCounts how many input values are positive
DFinds the maximum of five input values
11.A list of words: Milk, Eggs, Bananas, Cheese, Potatoes, Grapes. After the first pass of a bubble sort (alphabetical order A-Z), what is the list?
Medium
AEggs, Bananas, Cheese, Milk, Grapes, Potatoes
BBananas, Cheese, Eggs, Grapes, Milk, Potatoes
CEggs, Milk, Bananas, Cheese, Potatoes, Grapes
DMilk, Eggs, Bananas, Cheese, Potatoes, Grapes
12.In a bubble sort algorithm, after each pass, what can be said about the last element of the array?
Medium
AIt is in its final sorted position
BIt is the smallest element in the array
CIt is the largest element in the array
DIt is unchanged from the previous pass
13.What is the purpose of a linear search algorithm?
Easy
ATo find a specific value in a dataset
BTo sort a dataset into order
CTo count the number of values in a dataset
DTo calculate the average of a dataset
14.A linear search is performed on the list [7, 3, 9, 2, 5] to find the value 2. How many comparisons are made before the value is found?
Easy
A4
B5
C3
D2
15.After one pass of a bubble sort on the list [9, 4, 7, 2, 5], what is the order of the list?
Medium
A[4, 7, 2, 5, 9]
B[4, 9, 7, 2, 5]
C[9, 4, 7, 2, 5]
D[4, 2, 5, 7, 9]
16.A bubble sort algorithm uses a variable 'swaps' set to TRUE initially. After each pass, if no swaps were made, the algorithm stops. What is the minimum number of passes required to sort a list of 6 items that is already in ascending order?
Medium
A1
B6
C5
D0
17.Which of the following is a valid disadvantage of a bubble sort?
Easy
AIt is inefficient for large datasets
BIt cannot sort data that is already in order
CIt requires the data to be sorted first
DIt only works with numerical data
18.A program uses a count variable that starts at 100 and decrements by 1 each loop until it reaches 0. How many times will the loop body execute?
Easy
A100
B101
C99
19.A linear search is performed on a list of 1000 unsorted numbers. What is the maximum number of comparisons needed to determine that a target value is not in the list?
Medium
A1000
B999
C1001
D500
20.A program calculates the average of scores stored in an array. The pseudocode is: Total ← 0; FOR i ← 0 TO LENGTH(Scores)-1; Total ← Total + Scores[i]; NEXT i; Average ← Total / LENGTH(Scores). If the array contains [10, 20, 30, 40], what is the value of Average?
Medium
A25
B100
C40
D20
21.A linear search is performed on the list [3, 7, 1, 9, 4] to find the value 5. How many comparisons are made before the algorithm concludes that the target is not present?
Medium
A4
B5
C6
D3
22.After one complete pass of a bubble sort on the list [8, 3, 6, 2, 7], what is the order of the list?
Medium
A3, 6, 2, 7, 8
B3, 8, 6, 2, 7
C8, 3, 6, 2, 7
D2, 3, 6, 7, 8
23.Which of the following best describes the purpose of a 'swaps' variable in a bubble sort algorithm?
Easy
AIt counts the number of passes completed
BIt indicates whether any swaps were made during a pass
CIt stores the value being swapped
DIt determines the length of the list
24.A program uses a count variable that starts at 100 and decrements by 1 each loop until it reaches 0. How many times does the loop body execute?
Easy
A100
B99
C101
D0
25.A bubble sort algorithm uses a variable 'swaps' set to TRUE initially. After each pass, if no swaps were made, the algorithm stops. What is the minimum number of passes required to sort a list of 5 elements that is already in ascending order?
Medium
A0
B1
C4
D5
26.A program calculates the average of scores stored in an array. The pseudocode is: Total ← 0; FOR i ← 0 TO LENGTH(Scores)-1; Total ← Total + Scores[i]; NEXT i; Average ← Total / LENGTH(Scores). What is the purpose of the variable Total?
Easy
ATo store the sum of all scores
BTo count the number of scores
CTo find the maximum score
DTo store each individual score
27.A program uses a file to store a list of words: Milk, Eggs, Bananas, Cheese, Potatoes, Grapes. After the first pass of a bubble sort (alphabetical order A-Z), what is the order of the list?
Medium
AEggs, Bananas, Cheese, Milk, Grapes, Potatoes
BBananas, Cheese, Eggs, Grapes, Milk, Potatoes
CMilk, Eggs, Bananas, Cheese, Potatoes, Grapes
DEggs, Bananas, Milk, Cheese, Grapes, Potatoes
28.What is the purpose of a 'swaps' variable in a bubble sort algorithm?
Easy
ATo count the number of swaps made during a pass
BTo indicate whether any swaps were made during a pass
CTo store the value being swapped
DTo determine the number of passes required
29.A linear search is performed on an array of 1000 unsorted integers. The target value is present exactly once. What is the average number of comparisons required to find the target?
Medium
A500
B1000
C500.5
D1000.5
30.A program uses the following pseudocode to calculate the average of a list of scores stored in an array Scores (index starting from 0):
Total ← 0
FOR Count ← 0 TO LENGTH(Scores) - 1
Total ← Total + Scores[Count]
NEXT Count
Average ← Total / LENGTH(Scores)
If Scores = [10, 20, 30, 40], what is the value of Average?
Easy
A25
B100
C40
D10
31.Consider the following pseudocode for a linear search on an array data[1:5] = [5,2,8,1,9] with target = 11. How many comparisons are made before the algorithm concludes that the target is not found?
Medium
A5
B6
C4
D10
32.Which of the following best describes totalling in an algorithm?
Easy
AAdding up a sequence of values to produce a sum
BCounting the number of times an event occurs
CFinding the largest value in a list
DSorting a list into ascending order
33.A program uses the following pseudocode to find the minimum value in an array Scores = [25, 11, 84, 91, 27]:
Lowest ← Scores[0]
FOR Count ← 1 TO LENGTH(Scores) - 1
IF Scores[Count] < Lowest THEN
Lowest ← Scores[Count]
ENDIF
NEXT Count
What is the value of Lowest after execution?
Easy
A11
B25
C27
D91
34.A bubble sort is applied to the list [9, 8, 7, 6, 5]. How many passes are required to fully sort the list in ascending order?
Medium
A4
B5
C3
D6
35.Which of the following is a valid advantage of a linear search over a binary search?
Easy
AIt can be used on unsorted data
BIt is faster on large datasets
CIt requires fewer comparisons on average
DIt only works on sorted data
36.In the context of standard methods of a solution, what is counting?
Easy
AIncrementing or decrementing a variable by a fixed value each iteration
BAdding up all values in a list
CComparing two values to find the larger one
DSwapping adjacent values in a list
37.A program stores daily temperatures for a week in an array temps = [12, 15, 10, 18, 14, 20, 16]. It calculates the average temperature. Which pseudocode correctly computes the average?
Medium
ATotal ← 0; FOR i ← 0 TO 6; Total ← Total + temps[i]; NEXT i; Average ← Total / 7
BTotal ← 0; FOR i ← 0 TO 7; Total ← Total + temps[i]; NEXT i; Average ← Total / 7
CTotal ← 0; FOR i ← 1 TO 7; Total ← Total + temps[i]; NEXT i; Average ← Total / 7
DTotal ← 0; FOR i ← 0 TO 6; Total ← Total + temps[i]; NEXT i; Average ← Total / 6
38.In a linear search, what does the variable 'found' represent?
Easy
AWhether the target value has been located
BThe number of comparisons made
CThe index of the current element
DWhether the array is sorted
39.Consider the pseudocode:
Total ← 0
FOR Count ← 1 TO LENGTH(Scores)
INPUT Score
Total ← Total + Score
NEXT Count
OUTPUT Total / LENGTH(Scores)
What does this algorithm output?
Easy
AThe average of the input scores
BThe sum of the input scores
CThe number of scores entered
DThe maximum score
40.In a bubble sort algorithm, what does the variable 'swaps' indicate?
Easy
AWhether any swaps were made during a pass
BThe number of comparisons made
CThe number of elements that are already sorted
DThe total number of swaps made overall
41.A linear search can be performed on a dataset that is not in order.
Easy
True or false?
42.A bubble sort algorithm always completes after a single pass through the data.
Easy
True or false?
43.What is the purpose of the 'found' variable in a linear search algorithm?
Easy
ATo count the number of elements checked
BTo store the target value
CTo indicate whether the target has been located
DTo store the index of the current element
44.In a bubble sort, what does a 'pass' refer to?
Easy
AOne full run of comparisons from beginning to end of the dataset
BSwapping a single pair of adjacent elements
CComparing the first two elements only
DMoving the smallest element to the beginning
45.Totalling in an algorithm means keeping a running total of values entered.
Easy
True or false?
46.Which of the following best describes counting in an algorithm?
Easy
AAdding up a series of numbers
BIncrementing or decrementing a variable by a fixed value each iteration
CFinding the largest value in a list
DSwapping elements to sort data
47.The average (mean) of a set of values is calculated by dividing the total by the number of values.
Easy
True or false?
48.In a bubble sort, what condition causes the algorithm to stop?
Medium
AWhen all elements have been compared once
BWhen no swaps are made during a complete pass
CWhen the largest element reaches the end
DWhen the smallest element reaches the beginning
49.Which of the following is an advantage of a linear search?
Easy
AIt is very fast on large datasets
BIt can be used on unsorted data
CIt always finds the target in the first comparison
DIt requires the data to be sorted first
50.Arrange the steps of a bubble sort in the correct order.
Medium
Compare the next two values
If any swaps were made, repeat from the start
If they are in the wrong order, swap them
Compare the first two values in the dataset
If no swaps were made, stop – the list is sorted
Repeat comparing and swapping until you reach the end of the dataset
51.Complete the sentence.
Easy
In a linear search, the algorithm checks each value one at a time starting from the ____ value.
52.A program uses the following pseudocode to find the average of a list of numbers stored in an array 'Scores' (index starting from 0):
Total ← 0
FOR Count ← 0 TO LENGTH(Scores) - 1
Total ← Total + Scores[Count]
NEXT Count
Average ← Total / LENGTH(Scores)
If Scores = [12, 7, 19, 4], what is the value of Average?
Medium
53.A program uses the following pseudocode to find the average of a list of numbers stored in an array 'Scores' (index starting from 0):
Total ← 0
FOR Count ← 0 TO LENGTH(Scores) - 1
Total ← Total + Scores[Count]
NEXT Count
Average ← Total / LENGTH(Scores)
If Scores = [12, 7, 19, 4], what is the value of Average?
Medium
A21
B5.25
C105
D10.5
Unlock all 53 questions & more
Crea una cuenta gratis para ver todas las preguntas, las diapositivas, las tarjetas y los apuntes de repaso de este tema.