DP Computer Science Questionbank
Topic 4: Computational thinking, problem-solving and programming
Description
[N/A]Directly related questions
-
21M.1.SL.TZ0.8:
List the output from the given algorithm for the following input.
2, 6, 8, 9, 12, 15, 18, 20
loop for Count from 0 to 7
input NUMBER
if NUMBER div 2 = NUMBER / 2 then
if NUMBER div 3 = NUMBER / 3 then
output NUMBER
end if
end if
end loop -
21M.1.SL.TZ0.13a:
Construct a pseudocode algorithm that will store the surnames in one array and first names in another.
-
21M.1.SL.TZ0.13d:
Outline one benefit of using sub-programmes to implement your algorithms from parts (a) and (b).
-
21M.1.SL.TZ0.7:
Distinguish between a variable and a constant.
-
21M.1.HL.TZ0.14b:
State the name of the method that could be used to restrict the values that are input.
-
21M.1.HL.TZ0.14c:
A further change has been requested for the algorithm to enable it to calculate the average of all the numbers entered. The average will be output when the algorithm terminates.
Based on the flowchart, construct this algorithm using pseudocode. You must include the required changes:
- correction of logic error
- only allow input of integers between 0 and 1000
- calculation of average of all numbers entered
- output of final average.
-
21M.1.SL.TZ0.13b:
Construct a pseudocode algorithm that will sort the surnames into alphabetical order using the bubble sort method. The order of the first names must also be changed so that they keep the same index as their corresponding surname.
-
21M.1.SL.TZ0.13c:
Describe the process a binary search would follow to find a record in the surname array.
-
21M.1.SL.TZ0.14a:
Copy and complete the table that traces the algorithm in the flowchart using an input value of 19.
-
21M.1.HL.TZ0.14a.i:
Identify the logic error in the algorithm.
-
21M.1.HL.TZ0.14a.ii:
Outline how the error in the algorithm identified in part (i) can be corrected.
-
21M.1.SL.TZ0.14b:
State the purpose of the algorithm.
-
21M.1.SL.TZ0.14c:
Construct the algorithm from the flowchart using pseudocode. Add additional pseudocode to ensure that input is validated to only allow positive integers to be entered.
-
21M.1.SL.TZ0.14d:
Efficiency is an important consideration when designing algorithms to ensure they don’t waste computer resources such as memory or processing time.
Suggest two design considerations that could be made to an algorithm that would make it more efficient.
-
17N.1.SL.TZ0.1:
Identify two essential features of a computer language.
-
17N.1.SL.TZ0.7c:
Construct the algorithm which performs the same task using a single
while
loop, instead of nestedfor
loops. -
17N.1.SL.TZ0.2:
Two fundamental operations of a computer are add and retrieve. State another two fundamental operations.
-
18N.1.SL.TZ0.7:
Construct a trace table for the following algorithm
A = 3
B = 7
loop while B >= A
A = A + 1
output(B − A)
B = B − 1
end loop -
18N.1.SL.TZ0.9c:
Identify three characteristics of a collection.
-
18N.1.SL.TZ0.10a:
State the value of variable
BorisBMI
. -
18N.1.SL.TZ0.9a:
Outline the need for higher level languages.
-
18N.1.SL.TZ0.9b:
Explain two benefits of using sub-procedures within a computer program.
-
18N.1.SL.TZ0.9d:
Collection
NUMBERS
already exists and stores real numbers.Construct in pseudocode an algorithm, using the access methods of a collection, which will iterate through the collection
NUMBERS
and count how many elements stored in the collection are in the interval [−1,1].The final answer should be output.
-
18N.1.SL.TZ0.10d.i:
Identify one reason why a binary search algorithm cannot be used to find the name of person whose height is given.
-
18N.1.SL.TZ0.10e:
Construct an algorithm which will output the names of all the people whose BMI is greater than this group’s average BMI.
You should call method
calcBMI()
in your answer. -
18N.1.SL.TZ0.10b:
Use pseudocode to construct an algorithm which accepts a person’s BMI and outputs the weight category the person belongs to.
-
18N.1.SL.TZ0.10c:
State the name of the person whose height is held in
HEIGHT[3]
. -
18N.1.SL.TZ0.10d.ii:
Describe how the name of person whose height is given could be output.
-
18N.1.HL.TZ0.10e:
Construct a system flowchart to represent the process described above.
-
19N.1.SL.TZ0.1b:
Distinguish between fundamental and compound operations of a computer.
-
19N.1.SL.TZ0.1a:
Identify one fundamental operation of a computer.
-
19N.1.SL.TZ0.6:
Explain why abstraction is required in the design of algorithms.
-
19N.1.SL.TZ0.7:
Construct a trace table for the following algorithm.
K = 1
N = 1
M = 2
loop while K < 5
output(N,M)
K = K + 1
N = N + 2
M = M * 2
end loop -
19N.1.SL.TZ0.10a:
Consider the following algorithm.
N = 372
X = N DIV 100
Y = X + 10 * (N MOD 100 DIV 10)
Z = Y + (N MOD 10) * 100
Determine the values of variables X, Y, andZ
after execution of this algorithm. Show your working. -
19N.1.SL.TZ0.10b:
Construct this algorithm. You may assume that the array
THREE
is initialized with a sufficient number of elements. -
19N.1.SL.TZ0.10c:
Describe how a selection sort algorithm could be used to sort the array
THREE
in ascending order. -
19M.2.SL.TZ0.4d:
Using the formula, rules and initial data given above, construct the pseudocode that would calculate the year that the area of sea ice will be less than 10 000 km2.
-
19M.2.SL.TZ0.4b:
Using the rules and initial values above, construct the pseudocode that would enable the area of the sea ice and the sea level rise to be calculated if there was an increase of 0.04 °C in the ocean surface temperature.
-
19M.2.SL.TZ0.4c.i:
Using the information above state the area of the sea ice.
-
19M.2.SL.TZ0.4c.ii:
Using the information above state the change in sea level.
- 19M.2.SL.TZ0.12c.i: State the name of this sorting algorithm.
-
19M.2.SL.TZ0.12c.ii:
Outline two improvements to this code that would make the algorithm more efficient.
-
19M.2.SL.TZ0.12d:
Construct the code fragment that will copy the names of the 8 fastest swimmers in ascending order of time from the array
tempSwimmer
to the arrayswimmers
in the racefinals
. -
18N.2.SL.TZ0.10e.i:
Outline one advantage of using a binary search.
-
18N.2.SL.TZ0.10e.ii:
Outline one disadvantage of using a binary search.
-
21N.1.HL.TZ0.3a:
Outline what is meant by a sorting algorithm.
-
21N.1.HL.TZ0.3b:
Outline one difference between a bubble sort algorithm and a selection sort algorithm.
-
21N.1.HL.TZ0.7a:
Outline why a sub-program is considered an example of abstraction.
-
21N.1.HL.TZ0.4:
Assume X = 5, Y = 3 and A = TRUE.
Determine the value of the following expression:
Show all your working.
-
21N.1.HL.TZ0.7b:
Evaluate the use of designing and developing different parts of software products concurrently.
-
20N.1.SL.TZ0.5:
Describe the steps involved in using the bubble sort algorithm to sort an array.
-
20N.1.SL.TZ0.7d:
The inventory of office supplies used in the school is stored on the computer as a single file.
Each of the office supplies in the inventory (such as paper, ink, toner, printers, pens, staplers, pencils and scissors) has a unique ID number, name, maximum quantity, minimum quantity and remaining quantity.
Outline the steps in an algorithm that would output a list of supplies with the quantity to be ordered.
-
20N.1.SL.TZ0.9b:
Construct an algorithm in pseudocode for the method
isIn(X, COL)
. -
20N.1.SL.TZ0.9c:
Construct an algorithm in pseudocode that will output the number of students who have chosen both tennis and football. The method
isIn()
should be used in your answer. -
20N.1.SL.TZ0.9d:
The school coordinator would like to check whether there are students who have not yet chosen any one of the three sports.
Construct an algorithm in pseudocode that will output the names of students who have not yet chosen any one of the three sports. An appropriate message should be displayed if every student has chosen a sport. -
20N.1.SL.TZ0.9a:
State the reason for not using a binary search.
-
20N.1.HL.TZ0.13b.ii:
Outline why it is more efficient that the loop in the given algorithm fragment executes
(K mod 4)
times instead ofK
times. You may give an appropriate example in your answer. -
20N.1.HL.TZ0.13c:
Construct the algorithm in pseudocode for the method
rotate(N,A)
described above. -
20N.1.HL.TZ0.13d:
To avoid inefficient use of memory, a new algorithm for the method
rotate(N,A)
is constructed.The
N × N
two-dimensional arrayA
should be rotated clockwise by 90°, without the use of any additional arrays.One way of rotating the two-dimensional array
A
clockwise by 90° is to transposeA
, and then reverse each row ofA
.The transpose of
A
is formed by turning all the rows ofA
into columns. For example, the value in the first row and third column (A[1][3]
) is swapped with the value in the third row and first column (A[3][1]
).
Construct the new algorithm in pseudocode for the methodrotate(N,A)
described above. -
18M.1.SL.TZ0.11d:
After 5 years the company decided to replace the LAN with a wireless local area network (WLAN).
Outline two advantages, to this company, of installing a WLAN.
- 18M.1.SL.TZ0.11a: Define the term concurrent processing.
- 18M.1.SL.TZ0.11b: Identify two tasks that will be carried out concurrently.
-
18M.1.SL.TZ0.12a:
The collection
DATA
contains the following data:2, 4, 1, −2, −4, 1, 0
Consider the following pseudocode:
COUNTER = 0
SUM = 0
DATA.resetNext()
loop for X from 0 to 6
if DATA.getNext() > 0
ARRAY[X] = DATA.getNext()
COUNTER = COUNTER + 1
SUM = SUM + ARRAY[X]
end if
end loop
output SUM/COUNTERTrace the pseudocode using the table below:
-
18M.1.SL.TZ0.12b:
Assuming that the first item read from the collection is from Monday 1st January 2018, construct pseudocode that will read
PASSENGERS
into an array,P_ARRAY
. -
18M.1.SL.TZ0.12c:
Using
P_ARRAY
, construct pseudocode to output the day of the week with the highest average number of passengers. Use the sub procedureconvert()
which converts the numbers 0 to 6 into days of the week, for exampleconvert(1)
will return “Tuesday”.Note: you should not assume that data for an exact number of weeks is stored.
-
18M.1.SL.TZ0.8:
Consider the following algorithm.
Determine the outputs that will be produced by this algorithm.
-
18M.1.SL.TZ0.9:
For an identified application, explain why a binary search would be preferred to a linear search.
-
18M.1.SL.TZ0.10a:
Outline the pseudocode that the processing must follow when the system sends out the text reminders.
-
18M.1.SL.TZ0.11c:
Identify two tasks that will be carried out sequentially.
-
18M.1.HL.TZ0.15c:
The transport authority wishes to know how many passengers, on average, travel on each day of the week.
Using the procedure
total
construct the pseudocode to output the day of the week with the highest average number of passengers, and the value of this average.You should make use of the sub procedure
convert()
which converts the numbers 0 to 6 into days of the week, for exampleconvert(1)
will return “Tuesday”. -
18M.1.HL.TZ0.14c:
The home owner has also installed a control system that waters the flowerbeds in the garden. This system aims to maintain the water content of the flowerbeds between a minimum and a maximum value. However, the system is only activated when the light intensity is below a certain level.
Outline the algorithm involved in controlling the watering system described above.
-
18M.2.SL.TZ0.4b.ii:
Describe two items that would have a calculated value of more than $90.
-
18M.2.SL.TZ0.4c:
Calculate the selling price of a top brand guitar with a volume of 96 dm3 that was damaged. You should show your working.
-
18M.2.SL.TZ0.4b.i:
Using the above rules, construct the pseudocode that will help Ralph in deciding whether to buy an item.
-
19M.1.SL.TZ0.9:
Compilers translate source code into object code. Identify two other operations performed by a compiler.
-
19M.1.SL.TZ0.16a:
Identify two variables that have been used in the algorithm.
-
19M.1.SL.TZ0.16b:
Copy and complete the table below to trace the algorithm using the data set:
20, 6, 38, 50, 40
-
19M.1.SL.TZ0.16c.i:
With reference to the algorithm in the flow chart, construct this algorithm in pseudocode so that it performs the same function.
-
19M.1.SL.TZ0.16c.ii:
State the type of sort in the algorithm constructed in c(i).
-
19M.1.SL.TZ0.16d:
Construct an algorithm fragment to output the data in the array
VALUES[].
-
19M.1.SL.TZ0.16e:
The sorting algorithm could be part of a sub-program within a larger program.
Explain the benefits of using sub-programs when constructing a larger program. -
19M.1.HL.TZ0.15a:
Copy and complete the table below to trace the algorithm using the data set:
20, 6, 38, 50, 40 -
19M.1.HL.TZ0.15c:
Construct an algorithm fragment to output the data in the array
VALUES[]
-
19M.1.HL.TZ0.15b.i:
With reference to the algorithm in the flow chart, construct this algorithm in pseudocode so that it performs the same function.
-
19M.1.HL.TZ0.15b.ii:
State the type of sort in the algorithm constructed in b(i).
-
22M.1.SL.TZ0.5:
Outline the need for a translation process from high level language to machine code.
-
22M.1.SL.TZ0.13b:
Construct an algorithm using pseudocode to take the marks that have been stored in
MARK[]
, convert them into the appropriate grade and store the calculated grades inGRADE[]
. -
22M.1.SL.TZ0.13d:
Construct an algorithm using pseudocode to output the names and grades of all students who achieve a grade of Merit or Distinction.
-
22M.1.SL.TZ0.13c:
Outline how the name, mark and grade in the three arrays correspond to the same student.
-
22M.1.SL.TZ0.13e:
Explain how you would change your algorithm in part (d) to allow a user to choose a grade and output the names and marks of the students who have achieved this grade.
-
22M.1.SL.TZ0.14b:
State the constant used in Algorithm 1.
-
22M.1.SL.TZ0.13a:
Identify two components in a conditional statement.
-
22M.1.SL.TZ0.14a:
Copy and complete the trace table for Algorithm 1 using
TO_FIND = 39
.The first value of the first row has been done for you.
-
22M.1.SL.TZ0.14e:
Evaluate the use of a sequential search and a binary search including the advantages and disadvantages of each.
-
22M.1.SL.TZ0.14d:
Outline why
MID_VAL
could not be a constant. -
22M.1.SL.TZ0.14c:
Copy and complete the trace table for Algorithm 2 using
TO_FIND = 50
.The first two values of the first row have been done for you.
-
22M.1.HL.TZ0.14a.ii:
Construct a similar sub-program to the one in part (i) to calculate and return the area of the shape.
You must use an appropriate name for the sub-program and appropriate names for the parameters.
-
22M.1.HL.TZ0.14a.iii:
Construct pseudocode based on the flowchart to collect input from the user, call the sub-programs created in parts (i) and (ii), and output the results.
-
22M.1.HL.TZ0.14b:
Without using pseudocode, explain how your algorithms could be altered to also find the area and circumference of a circle.
Note:
Area of circle = 2
Circumference of circle = 2
-
22M.1.HL.TZ0.14a.i:
Construct pseudocode for the body of the following sub-program to calculate and return the perimeter of the shape.
SUB_PERIMETER(NUM_SIDES, LENGTH_SIDE)
// Pseudocode to be added
end SUB_PERIMETER -
22M.1.HL.TZ0.15a:
Copy and complete the trace table for the algorithm using the RPN collection data:
5 2 + 25 16 − * 3 /
Sub sections and their related questions
4.1 General principles
- 18M.1.SL.TZ0.11a: Define the term concurrent processing.
- 18M.1.SL.TZ0.11b: Identify two tasks that will be carried out concurrently.
-
18M.1.SL.TZ0.11c:
Identify two tasks that will be carried out sequentially.
-
18M.1.SL.TZ0.11d:
After 5 years the company decided to replace the LAN with a wireless local area network (WLAN).
Outline two advantages, to this company, of installing a WLAN.
-
21M.1.SL.TZ0.13a:
Construct a pseudocode algorithm that will store the surnames in one array and first names in another.
-
21M.1.SL.TZ0.13d:
Outline one benefit of using sub-programmes to implement your algorithms from parts (a) and (b).
-
19N.1.SL.TZ0.6:
Explain why abstraction is required in the design of algorithms.
-
21N.1.HL.TZ0.7a:
Outline why a sub-program is considered an example of abstraction.
-
21N.1.HL.TZ0.7b:
Evaluate the use of designing and developing different parts of software products concurrently.
-
22M.1.SL.TZ0.13a:
Identify two components in a conditional statement.
4.2 Connecting computational thinking and program design
-
18M.1.SL.TZ0.8:
Consider the following algorithm.
Determine the outputs that will be produced by this algorithm.
-
18M.1.SL.TZ0.9:
For an identified application, explain why a binary search would be preferred to a linear search.
-
18M.1.SL.TZ0.10a:
Outline the pseudocode that the processing must follow when the system sends out the text reminders.
-
18M.1.SL.TZ0.12a:
The collection
DATA
contains the following data:2, 4, 1, −2, −4, 1, 0
Consider the following pseudocode:
COUNTER = 0
SUM = 0
DATA.resetNext()
loop for X from 0 to 6
if DATA.getNext() > 0
ARRAY[X] = DATA.getNext()
COUNTER = COUNTER + 1
SUM = SUM + ARRAY[X]
end if
end loop
output SUM/COUNTERTrace the pseudocode using the table below:
-
18M.1.HL.TZ0.14c:
The home owner has also installed a control system that waters the flowerbeds in the garden. This system aims to maintain the water content of the flowerbeds between a minimum and a maximum value. However, the system is only activated when the light intensity is below a certain level.
Outline the algorithm involved in controlling the watering system described above.
-
18M.2.SL.TZ0.4b.i:
Using the above rules, construct the pseudocode that will help Ralph in deciding whether to buy an item.
-
18M.2.SL.TZ0.4b.ii:
Describe two items that would have a calculated value of more than $90.
-
18M.2.SL.TZ0.4c:
Calculate the selling price of a top brand guitar with a volume of 96 dm3 that was damaged. You should show your working.
-
19M.1.SL.TZ0.16b:
Copy and complete the table below to trace the algorithm using the data set:
20, 6, 38, 50, 40
-
19M.1.SL.TZ0.16c.i:
With reference to the algorithm in the flow chart, construct this algorithm in pseudocode so that it performs the same function.
-
19M.1.SL.TZ0.16c.ii:
State the type of sort in the algorithm constructed in c(i).
-
19M.1.SL.TZ0.16d:
Construct an algorithm fragment to output the data in the array
VALUES[].
-
19M.1.HL.TZ0.15a:
Copy and complete the table below to trace the algorithm using the data set:
20, 6, 38, 50, 40 -
19M.1.HL.TZ0.15b.i:
With reference to the algorithm in the flow chart, construct this algorithm in pseudocode so that it performs the same function.
-
19M.1.HL.TZ0.15b.ii:
State the type of sort in the algorithm constructed in b(i).
-
19M.1.HL.TZ0.15c:
Construct an algorithm fragment to output the data in the array
VALUES[]
-
21M.1.SL.TZ0.8:
List the output from the given algorithm for the following input.
2, 6, 8, 9, 12, 15, 18, 20
loop for Count from 0 to 7
input NUMBER
if NUMBER div 2 = NUMBER / 2 then
if NUMBER div 3 = NUMBER / 3 then
output NUMBER
end if
end if
end loop -
21M.1.SL.TZ0.13b:
Construct a pseudocode algorithm that will sort the surnames into alphabetical order using the bubble sort method. The order of the first names must also be changed so that they keep the same index as their corresponding surname.
-
21M.1.SL.TZ0.13c:
Describe the process a binary search would follow to find a record in the surname array.
-
21M.1.SL.TZ0.14a:
Copy and complete the table that traces the algorithm in the flowchart using an input value of 19.
-
21M.1.SL.TZ0.14b:
State the purpose of the algorithm.
-
21M.1.SL.TZ0.14d:
Efficiency is an important consideration when designing algorithms to ensure they don’t waste computer resources such as memory or processing time.
Suggest two design considerations that could be made to an algorithm that would make it more efficient.
-
21M.1.HL.TZ0.14a.i:
Identify the logic error in the algorithm.
-
21M.1.HL.TZ0.14a.ii:
Outline how the error in the algorithm identified in part (i) can be corrected.
-
21M.1.HL.TZ0.14b:
State the name of the method that could be used to restrict the values that are input.
-
21M.1.HL.TZ0.14c:
A further change has been requested for the algorithm to enable it to calculate the average of all the numbers entered. The average will be output when the algorithm terminates.
Based on the flowchart, construct this algorithm using pseudocode. You must include the required changes:
- correction of logic error
- only allow input of integers between 0 and 1000
- calculation of average of all numbers entered
- output of final average.
-
18N.1.SL.TZ0.7:
Construct a trace table for the following algorithm
A = 3
B = 7
loop while B >= A
A = A + 1
output(B − A)
B = B − 1
end loop -
18N.1.SL.TZ0.10a:
State the value of variable
BorisBMI
. -
18N.1.SL.TZ0.10b:
Use pseudocode to construct an algorithm which accepts a person’s BMI and outputs the weight category the person belongs to.
-
18N.1.SL.TZ0.10c:
State the name of the person whose height is held in
HEIGHT[3]
. -
18N.1.SL.TZ0.10d.i:
Identify one reason why a binary search algorithm cannot be used to find the name of person whose height is given.
-
18N.1.SL.TZ0.10d.ii:
Describe how the name of person whose height is given could be output.
-
18N.1.HL.TZ0.10e:
Construct a system flowchart to represent the process described above.
-
19N.1.SL.TZ0.7:
Construct a trace table for the following algorithm.
K = 1
N = 1
M = 2
loop while K < 5
output(N,M)
K = K + 1
N = N + 2
M = M * 2
end loop -
19N.1.SL.TZ0.10a:
Consider the following algorithm.
N = 372
X = N DIV 100
Y = X + 10 * (N MOD 100 DIV 10)
Z = Y + (N MOD 10) * 100
Determine the values of variables X, Y, andZ
after execution of this algorithm. Show your working. -
19M.2.SL.TZ0.4b:
Using the rules and initial values above, construct the pseudocode that would enable the area of the sea ice and the sea level rise to be calculated if there was an increase of 0.04 °C in the ocean surface temperature.
-
19M.2.SL.TZ0.4c.i:
Using the information above state the area of the sea ice.
-
19M.2.SL.TZ0.4c.ii:
Using the information above state the change in sea level.
-
19M.2.SL.TZ0.4d:
Using the formula, rules and initial data given above, construct the pseudocode that would calculate the year that the area of sea ice will be less than 10 000 km2.
- 19M.2.SL.TZ0.12c.i: State the name of this sorting algorithm.
-
19M.2.SL.TZ0.12c.ii:
Outline two improvements to this code that would make the algorithm more efficient.
-
18N.2.SL.TZ0.10e.i:
Outline one advantage of using a binary search.
-
18N.2.SL.TZ0.10e.ii:
Outline one disadvantage of using a binary search.
-
20N.1.SL.TZ0.5:
Describe the steps involved in using the bubble sort algorithm to sort an array.
-
20N.1.SL.TZ0.7d:
The inventory of office supplies used in the school is stored on the computer as a single file.
Each of the office supplies in the inventory (such as paper, ink, toner, printers, pens, staplers, pencils and scissors) has a unique ID number, name, maximum quantity, minimum quantity and remaining quantity.
Outline the steps in an algorithm that would output a list of supplies with the quantity to be ordered.
-
20N.1.SL.TZ0.9a:
State the reason for not using a binary search.
-
20N.1.HL.TZ0.13b.ii:
Outline why it is more efficient that the loop in the given algorithm fragment executes
(K mod 4)
times instead ofK
times. You may give an appropriate example in your answer. -
20N.1.HL.TZ0.13c:
Construct the algorithm in pseudocode for the method
rotate(N,A)
described above. -
20N.1.HL.TZ0.13d:
To avoid inefficient use of memory, a new algorithm for the method
rotate(N,A)
is constructed.The
N × N
two-dimensional arrayA
should be rotated clockwise by 90°, without the use of any additional arrays.One way of rotating the two-dimensional array
A
clockwise by 90° is to transposeA
, and then reverse each row ofA
.The transpose of
A
is formed by turning all the rows ofA
into columns. For example, the value in the first row and third column (A[1][3]
) is swapped with the value in the third row and first column (A[3][1]
).
Construct the new algorithm in pseudocode for the methodrotate(N,A)
described above. -
21N.1.HL.TZ0.3a:
Outline what is meant by a sorting algorithm.
-
21N.1.HL.TZ0.3b:
Outline one difference between a bubble sort algorithm and a selection sort algorithm.
-
22M.1.SL.TZ0.13b:
Construct an algorithm using pseudocode to take the marks that have been stored in
MARK[]
, convert them into the appropriate grade and store the calculated grades inGRADE[]
. -
22M.1.SL.TZ0.13c:
Outline how the name, mark and grade in the three arrays correspond to the same student.
-
22M.1.SL.TZ0.13d:
Construct an algorithm using pseudocode to output the names and grades of all students who achieve a grade of Merit or Distinction.
-
22M.1.SL.TZ0.13e:
Explain how you would change your algorithm in part (d) to allow a user to choose a grade and output the names and marks of the students who have achieved this grade.
-
22M.1.SL.TZ0.14a:
Copy and complete the trace table for Algorithm 1 using
TO_FIND = 39
.The first value of the first row has been done for you.
-
22M.1.SL.TZ0.14c:
Copy and complete the trace table for Algorithm 2 using
TO_FIND = 50
.The first two values of the first row have been done for you.
-
22M.1.SL.TZ0.14e:
Evaluate the use of a sequential search and a binary search including the advantages and disadvantages of each.
-
22M.1.HL.TZ0.14b:
Without using pseudocode, explain how your algorithms could be altered to also find the area and circumference of a circle.
Note:
Area of circle = 2
Circumference of circle = 2
-
22M.1.HL.TZ0.15a:
Copy and complete the trace table for the algorithm using the RPN collection data:
5 2 + 25 16 − * 3 /
4.3 Introduction to programming
-
18M.1.SL.TZ0.12b:
Assuming that the first item read from the collection is from Monday 1st January 2018, construct pseudocode that will read
PASSENGERS
into an array,P_ARRAY
. -
18M.1.SL.TZ0.12c:
Using
P_ARRAY
, construct pseudocode to output the day of the week with the highest average number of passengers. Use the sub procedureconvert()
which converts the numbers 0 to 6 into days of the week, for exampleconvert(1)
will return “Tuesday”.Note: you should not assume that data for an exact number of weeks is stored.
-
18M.1.HL.TZ0.15c:
The transport authority wishes to know how many passengers, on average, travel on each day of the week.
Using the procedure
total
construct the pseudocode to output the day of the week with the highest average number of passengers, and the value of this average.You should make use of the sub procedure
convert()
which converts the numbers 0 to 6 into days of the week, for exampleconvert(1)
will return “Tuesday”. -
19M.1.SL.TZ0.9:
Compilers translate source code into object code. Identify two other operations performed by a compiler.
-
19M.1.SL.TZ0.16a:
Identify two variables that have been used in the algorithm.
-
19M.1.SL.TZ0.16e:
The sorting algorithm could be part of a sub-program within a larger program.
Explain the benefits of using sub-programs when constructing a larger program. -
19M.1.HL.TZ0.15c:
Construct an algorithm fragment to output the data in the array
VALUES[]
-
21M.1.SL.TZ0.7:
Distinguish between a variable and a constant.
-
21M.1.SL.TZ0.13a:
Construct a pseudocode algorithm that will store the surnames in one array and first names in another.
-
21M.1.SL.TZ0.13b:
Construct a pseudocode algorithm that will sort the surnames into alphabetical order using the bubble sort method. The order of the first names must also be changed so that they keep the same index as their corresponding surname.
-
21M.1.SL.TZ0.13d:
Outline one benefit of using sub-programmes to implement your algorithms from parts (a) and (b).
-
21M.1.SL.TZ0.14c:
Construct the algorithm from the flowchart using pseudocode. Add additional pseudocode to ensure that input is validated to only allow positive integers to be entered.
-
17N.1.SL.TZ0.1:
Identify two essential features of a computer language.
-
17N.1.SL.TZ0.2:
Two fundamental operations of a computer are add and retrieve. State another two fundamental operations.
-
17N.1.SL.TZ0.7c:
Construct the algorithm which performs the same task using a single
while
loop, instead of nestedfor
loops. -
18N.1.SL.TZ0.9a:
Outline the need for higher level languages.
-
18N.1.SL.TZ0.9b:
Explain two benefits of using sub-procedures within a computer program.
-
18N.1.SL.TZ0.9c:
Identify three characteristics of a collection.
-
18N.1.SL.TZ0.9d:
Collection
NUMBERS
already exists and stores real numbers.Construct in pseudocode an algorithm, using the access methods of a collection, which will iterate through the collection
NUMBERS
and count how many elements stored in the collection are in the interval [−1,1].The final answer should be output.
-
18N.1.SL.TZ0.10e:
Construct an algorithm which will output the names of all the people whose BMI is greater than this group’s average BMI.
You should call method
calcBMI()
in your answer. -
19N.1.SL.TZ0.1a:
Identify one fundamental operation of a computer.
-
19N.1.SL.TZ0.1b:
Distinguish between fundamental and compound operations of a computer.
-
19N.1.SL.TZ0.10b:
Construct this algorithm. You may assume that the array
THREE
is initialized with a sufficient number of elements. -
19N.1.SL.TZ0.10c:
Describe how a selection sort algorithm could be used to sort the array
THREE
in ascending order. -
19M.2.SL.TZ0.12d:
Construct the code fragment that will copy the names of the 8 fastest swimmers in ascending order of time from the array
tempSwimmer
to the arrayswimmers
in the racefinals
. -
20N.1.SL.TZ0.9b:
Construct an algorithm in pseudocode for the method
isIn(X, COL)
. -
20N.1.SL.TZ0.9c:
Construct an algorithm in pseudocode that will output the number of students who have chosen both tennis and football. The method
isIn()
should be used in your answer. -
20N.1.SL.TZ0.9d:
The school coordinator would like to check whether there are students who have not yet chosen any one of the three sports.
Construct an algorithm in pseudocode that will output the names of students who have not yet chosen any one of the three sports. An appropriate message should be displayed if every student has chosen a sport. -
21N.1.HL.TZ0.4:
Assume X = 5, Y = 3 and A = TRUE.
Determine the value of the following expression:
Show all your working.
-
22M.1.SL.TZ0.5:
Outline the need for a translation process from high level language to machine code.
-
22M.1.SL.TZ0.14b:
State the constant used in Algorithm 1.
-
22M.1.SL.TZ0.14d:
Outline why
MID_VAL
could not be a constant. -
22M.1.HL.TZ0.14a.i:
Construct pseudocode for the body of the following sub-program to calculate and return the perimeter of the shape.
SUB_PERIMETER(NUM_SIDES, LENGTH_SIDE)
// Pseudocode to be added
end SUB_PERIMETER -
22M.1.HL.TZ0.14a.ii:
Construct a similar sub-program to the one in part (i) to calculate and return the area of the shape.
You must use an appropriate name for the sub-program and appropriate names for the parameters.
-
22M.1.HL.TZ0.14a.iii:
Construct pseudocode based on the flowchart to collect input from the user, call the sub-programs created in parts (i) and (ii), and output the results.