DP Computer Science Questionbank
4.3 Introduction to programming
Path: |
Description
[N/A]Directly related questions
-
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.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.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.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.9c:
Identify three characteristics of a collection.
-
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.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.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.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
. -
21N.1.HL.TZ0.4:
Assume X = 5, Y = 3 and A = TRUE.
Determine the value of the following expression:
Show all your working.
-
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. -
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[]
-
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.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.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