0% found this document useful (0 votes)
127 views17 pages

Flowchart Topical

Qjwieibdjdiwiqkdiuxiw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views17 pages

Flowchart Topical

Qjwieibdjdiwiqkdiuxiw
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Flowchart topical


Sunday, September 3, 2023 2:23 PM

Q. This section of program code may be used as a validation


check.
1 PRINT "Input a value between 0 and 100 inclusive"
2 INPUT Value
3 WHILE Value < 0 OR Value > 100
4 PRINT "Invalid value, try again"
5 INPUT Value
6 ENDWHILE
7 PRINT "Accepted: ", Value
d) Draw a flowchart to represent this section of program code. [5]
(Q4d/21/M/J/19)
Ans.
d) 1 mark – Input prompt and input value
1 mark – Correct decision box labelled sufficiently (Yes/No) –
allow 2 decision boxes
1 mark – Remaining outputs correct
1 mark – All connecting lines and arrows to be complete and
correct
1 mark – Standard flowchart symbols used

Q. The flowchart represents an algorithm.


The predefined function DIV gives the value of the result of
integer division, for example, y ← 9 DIV 4 gives y a value of 2
An input value of –1 ends the algorithm.

2210 Page 1
a) Complete the trace table for the input data:
50, 33, 18, 15, 30, –1, 45, 12, 90, 6 [4]

b) Describe the purpose of this algorithm. [2] (Q5/21/M/J/20)


Ans.
a) One mark for each correct column (max four)

2210 Page 2
b) Any two correct statements e.g.
• The program outputs a value
• That is divisible by 6 // 2 and 3

Q. This flowchart inputs the points won and the points lost when
playing a game. The difference between the points won and
lost is calculated and depending on the result the player can:
move up to the next level, stay at the same level, or move
down to the previous level. The flowchart finishes when the
input for points won is –1.

a) Complete a trace table for this set of input data:


5000, 4474, 6055, 2000, 7900, 9800, 3000, 2150, –1, 6700, 7615
[3]

2210 Page 3
b) The flowchart needs to be changed. When the difference is
more than 5000 the output message is ‘Fantastic leap up two
levels’. Describe the changes that will need to be made to the
flowchart. [3] (Q4/22/M/J/20)
Ans.
a) One mark for correct input (PointsWon and PointsLost)
One mark for correct calculations (Difference)
One mark for correct output

b) Any three from:


• Add extra decision box …
• … before checking for difference greater than or equal to 1000
// change Is difference >= 1000 to >= 1000 and <= 5000
• Check for difference greater than 5000
• Add extra Output ‘Fantastic leap up two levels’…
• … before flowline returns to input

Q. Draw a flowchart symbol to represent each of the following:


[2] (Q6/22/O/N/20)

Ans.

Q. This flowchart represents an algorithm that allows the input of


two numbers and performs a calculation.
The predefined function MOD finds the remainder from
integer division for example X 8 MOD 5gives X a value of 3.

2210 Page 4
a) Complete a trace table for this set of input data:
11, 4, 6, 2, 3, 9, 3, 2, 2, 6, 0, 0, 1, 1 [4]
Y Z A Output

b) Explain the purpose of this algorithm. [2] (Q4/23/O/N/20)


Ans.
a) One mark for each correct column

b) Any two from:


Checking if the remainder, when the larger number is divided by
the smaller number, is zero
To see if the larger number is a multiple of the smaller number

2210 Page 5
To see if the larger number is a multiple of the smaller number
To see if the smaller number is a factor of the larger number

Q. Draw the most appropriate flowchart symbol for each


pseudocode statement. [3] (Q3a/22/M/J/21)

Ans.

Q. The flowchart represents an algorithm.The algorithm will


terminate if –1 is entered.

2210 Page 6
a) Complete the trace table for the input data:
50, 75, 99, 28, 82, 150, –1, 672, 80 [4]
b) Describe the purpose of the algorithm. [2] (Q5/21/M/J/21)
Ans.
a) One mark for each correct column (Max 4)

b) One mark per bullet point (Max 2)


• To output the type of test data
• … by performing a range check //… by checking if numbers are
within the range 50 and 100 (inclusive) (or not).

Q. The flowchart represents an algorithm.The algorithm will


terminate if –1 is entered at the List input.

2210 Page 7
Complete the trace table for the algorithm using this input
data : 2, 77, 2, 16, 1, 35, 2, –7, 5, 18, 1, 11, 1, 12, 2, 20, –1, 18
[5] (Q5/22/O/N/21)

2210 Page 8
Ans. One mark for each correct column

2210 Page 9
Q. 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.
a) Complete this flowchart. [6] (Q4a/21/M/J/22)

Ans.
a) One mark per mark point, max six

2210 Page 10
a) One mark per mark point, max six
• MP1 input box
• MP2 correct check of score
• MP3 assign Score to Pass correctly
• MP4 assign Score to Fail correctly
• MP5 increment both arrays correctly
• MP6 correct check of number of scores

Q. This algorithm checks the temperature of hot food being


served to customers.

2210 Page 11
a) Complete the trace table for the algorithm using this input
data:
75, 78, 84, 87, 91, 80, 75, 70, 65, 62, –1, 20 [7]

b) State how the final output from the algorithm could be


improved. [1]
c) Identify the process in the algorithm that is not required. [1]
(Q5/22/M/J/22)
Ans.
a) One mark for each correct column

2210 Page 12
b) Include a message to explain the value output / e. g. “The
percentage of meals not served” // outputting Hot, Cold and
Serve
c) updating the Serve variable // Serve <-- Serve + 1

Q. This flowchart represents an algorithm to divide three-digit


numbers into hundreds, tens and units.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

Complete the trace table for the algorithm using this input
data:97, 876, 4320, 606, 9875, 42, 124

2210 Page 13
[5] (Q6/22/O/N/22)
Ans. One mark per mark point, max five
• MP1 correct Counter and Number columns
• MP2 correct Hundreds column
• MP3 correct Temp and Tens columns
• MP4 correct Units column
• MP5 correct OUTPUT column

Q. This algorithm makes sure that there are enough


wheelbarrows in stock.

2210 Page 14
a) Complete the trace table for this algorithm using this input
data:
"Y”, “Y”, “Y”, “Y”, “Y”, “Y”, “N” [4]

b) Explain how you could extend the algorithm to allow for the
sale of more than one wheelbarrow at a time. [3]
(Q4/23/O/N/22)
Ans.
a) One mark for each column, max four

2210 Page 15
b) One mark per mark point, max three
• input a number / quantity
• … check that the number is less than (or equal to) the number
in stock
• … after checking for N
• update Stock by that number / Stock Stock – Number
• update Total by that number / Total <-- Total + Number

Q. (a) Draw a flowchart for an algorithm to:


• 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. [6]
b) Explain the changes you will make to your algorithm to also
count the negative numbers. [2] (Q5/2210/02B/SP/23)
Ans.

a)

b) Any two from:


• Use another counter/variable and initialise to zero before
looping
• Increment this counter/variable when the number is less than
zero/count all numbers and subtract the positive numbers
• Output this counter/variable at the end // Output both
counters at the end

2210 Page 16
2210 Page 17

You might also like