CS Test 1 - Memo Problem - Solving and Design
CS Test 1 - Memo Problem - Solving and Design
8 February 2024
Length: 60 Minutes Total Allocated Marks: 50
a. This pseudocode lacks features that would make it easier to read and understand.
− 4.5 REAL
132 INTEGER
2. A student is developing a program to count how many times each character of the alphabet
(A to Z) occurs in a given string. Upper case and lower case characters will be counted as the
same. The string may contain non-alphabetic characters, which should be ignored.
The student decides to apply a process to increase the level of detail given in step 4.
State the name of the process and use this process to write step 4 in more detail. Use
structured English for your answer.
Structured English :
[4]
Complete the table by placing ticks (‘3’) in the relevant boxes. [4]
ON x {
15: Call ProcA
20: y := 0
25: y := 99
NONE: Call ProcError
}
Identify the type of control structure and describe the function of the code.
State two other type and explain when each should be used.
Explanation:
• executes the statements within the loop at least once.
• If the condition is FALSE the statements within the loop are executed again.
• If the condition evaluates to TRUE, execution will go to the next statement after the loop.
• The number of iterations is not known / dependent on a condition [2]
Explanation:
• Evaluates the condition before the statements within the loop are executed.
• If the condition is TRUE the statements within the loop are executed.
• If the condition evaluates to FALSE, execution will go to the next statement after the
loop.
• The number of iterations is not known / dependent on a condition [2]
TotalValue ← 0
ZeroCount ← 0
1 Both initialisations
2 Loop 100 times
3 Adding individual element to TotalValue in a loop
4 Check if element value is zero in a loop
5 If so increment ZeroCount in a loop
6 Average is calculated after the loop
7 Both OUTPUT statements, including message and variables
ScanArray() will modify the first two parameters so that the new values are available to the
calling program or module.
9. Chris is asked to work on a program that has been coded in a language he is not familiar with.
He has identified that the program contains the constructs: sequence, iteration and selection.
Identify three other features of the program that he should expect to recognise.
10. Programming languages usually contain a range of built-in functions, such as a random
number generator.