Write the pseudocode statement that would output the average calculated in line 13 of the algorithm rounded to one decimal place.
17 questions · 83 marks · ≈ 1 hours
Write the pseudocode statement that would output the average calculated in line 13 of the algorithm rounded to one decimal place.
Describe what the algorithm represented by the flowchart in Fig. 1 is doing.

Fig.1
The pseudocode algorithm shown has been written by a teacher to enter marks for the students in her class and then to apply some simple processing.
Count ← 0
REPEAT
INPUT Score[Count]
IF Score[Count] >= 70
THEN
Grade[Count] ← "A"
ELSE
IF Score[Count] >= 60
THEN
Grade[Count] ← "B"
ELSE
IF Score[Count] >= 50
THEN
Grade[Count] ← "C"
ELSE
IF Score[Count] >= 40
THEN
Grade[Count] ← "D"
ELSE
IF Score[Count] >= 30
THEN
Grade[Count] ← "E"
ELSE
Grade[Count] ← "F"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Count ← Count + 1
UNTIL Count = 30
Describe what happens in this algorithm.
B ← FALSE
INPUT Num
FOR Counter ← 1 TO 12
IF A[Counter] = Num
THEN
B ← TRUE
ENDIF
NEXT Counter
Identify the purpose of the algorithm.
The flowchart shows an algorithm that should allow 60 test results to be entered into the variable Score.
Each test result is checked to see if it is 50 or more. If it is, the test result is assigned to the Pass array. Otherwise, it is assigned to the Fail array.
Complete this flowchart

Write a pseudocode routine that will check that each test result entered into the algorithm is between 0 and 100 inclusive.
The pseudocode represents an algorithm.
The pre-defined function DIV gives the value of the result of integer division. For example, Y = 9 DIV 4 gives the value Y = 2
The pre-defined function MOD gives the value of the remainder of integer division. For example, R = 9 MOD 4 gives the value R = 1
First ← 0
Last ← 0
INPUT Limit
FOR Counter ← 1 TO Limit
INPUT Value
IF Value >= 100
THEN
IF Value < 1000
THEN
First ← Value DIV 100
Last ← Value MOD 10
IF First = Last
THEN
OUTPUT Value
ENDIF
ENDIF
ENDIF
NEXT Counter
Describe the purpose of the algorithm.
This algorithm checks the temperature of hot food being served to customers.

State how the final output from the algorithm could be improved.
Identify the process in the algorithm that is not required.
This flowchart represents an algorithm.
![Flowchart starts with F=0, C=1. If X[C] < X[C+1], swap elements X[C] and X[C+1], set F=1. Increment C. If C=5 and F=0, then STOP, otherwise repeat.](https://raw.githubusercontent.com/SyllabAI/syllabai-resources/3b2ce8da700b80f51700fb34fc721c90d6654d6b/SME-ExamQuestion/cie-igcse-computer-science-23/7-algorithm-design-and-problem-solving/algorithms/assets/002-flowchart-starts-with-f-0-c-1-if-x-c-x-c-1-swap-.png)
Describe what the algorithm represented by the flowchart is doing.
The variables P and Q are used to store data in a program. P stores a string. Q stores a character.
Give the value of Position after the algorithm has been executed with the data in the below question.
Write pseudocode statements to declare the variables P and Q, store "The world" in P and store 'W' in Q
This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered and totalled.
The total and average of the entered values are output at the end of the algorithm.
Identify the line numbers of four errors in the pseudocode and suggest corrections
Describe the purpose of the algorithm.

The variables X, Y and Z are used to store data in a program:
The function LENGTH(X) finds the length of a string X.
The function SUBSTRING(X,Y,Z) finds a substring of X starting at position Y and Z characters long. The first character in X is in position 1.
Write pseudocode statements to:
Programming is fun" in X fun from the string and output it.The one-dimensional (1D) array StudentName[] contains the names of students in a class. The two-dimensional (2D) array StudentMark[] contains the mark for each subject, for each student. The position of each student’s data in the two arrays is the same, for example, the student in position 10 in StudentName[] and StudentMark[] is the same.
The variable ClassSize contains the number of students in the class. The variable SubjectNo contains the number of subjects studied. All students study the same number of subjects.
The arrays and variables have already been set up and the data stored.
Students are awarded a grade based on their average mark.
| Average mark | Grade awarded |
|---|---|
| greater than or equal to 70 | distinction |
| greater than or equal to 55 and less than 70 | merit |
| greater than or equal to 40 and less than 55 | pass |
| less than 40 | fail |
Write a program that meets the following requirements:
calculates the combined total mark for each student for all their subjects
calculates the average mark for each student for all their subjects, rounded to the nearest whole number
outputs for each student:
calculates, stores and outputs the number of distinctions, merits, passes and fails for the whole class.
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to initialise the data in the array.
Draw a flowchart for an algorithm to:
Extract:
allow numbers to be input ignore any numbers that are negative count how many numbers are positive output the count of positive numbers when zero is input and end the algorithm.
Explain the changes you will make to your algorithm to also count the negative numbers.
Rewrite this pseudocode algorithm using a WHILE … DO … ENDWHILE loop.
B ← FALSE
INPUT Num
FOR Counter ← 1 TO 12
IF A[Counter] = Num
THEN
B ← TRUE
ENDIF
NEXT Counter
The names of patients are stored in the one-dimensional (1D) array Patient[] of type string. A separate two-dimensional (2D) array Readings[] stores the latest data recorded about each patient. The array already contains the readings taken by a nurse for each patient:
Temperature readings should be in the range 31.6 to 37.2 inclusive. Pulse readings should be in the range 55.0 to 100.0 inclusive.
The hospital number given to the patient is used for the index on both arrays, this is a value between 1 and 1000 inclusive.
When the data for a patient is checked a warning is given if any of the readings are out of range. If both readings are out of range, then a severe warning is given.
Write a procedure, using pseudocode or program code, that meets the following requirements:
takes the hospital number as a parameter
checks if the number is valid
outputs an error message and exits the procedure if the number is not valid
if the hospital number is valid:
You must use pseudocode or program code and add comments to explain how your code works.
You do not need to initialise the data in the arrays.
An algorithm has been written in pseudocode to allow some numbers to be input. All the positive numbers that are input are totalled and this total is output at the end. An input of 0 stops the algorithm.
Describe how you could change the corrected algorithm to record and output how many positive numbers have been included in the final total.
You do not need to rewrite the algorithm.