Flowcharts
Post on 01-Feb-2016
13 Views
Preview:
DESCRIPTION
Transcript
START
STOP
sum1 = 0sum2 = 0
Yes
Yes
Yes
No
No
No
sum1 = a*6 + b*5 + c*4
sum2 = d*3 + e*2 + f*1
total = sum1 + sum2
total = total � 11
total = 0
INPUT a, b, c, d, e, f
is a = 0 andb = 0?
is total = 0?
is total < 0?
OUTPUT �data are OK�
OUTPUT �error�
8
© UCLES 2012 7010/13/O/N/12
For Examiner's
Use
9 Study this flowchart very carefully.
START
STOP
C = 1
H = 0
T1 = 0
T2 = 0
T3 = 0
is number > 999 ? T3 = T3 + 1
T2 = T2 + 1
T1 = T1 + 1
C = C + 1
is number > 99 ?
is number > H ?
is C <= 10 ?
No
No
No
INPUT number
OUTPUT T1,T2, T3, H
Yes
Yes
H = numberYes
Yes No
9
© UCLES 2012 7010/13/O/N/12 [Turn over
For Examiner's
Use
Complete the trace table for the following data: 1500, 1000, 100, 10, 999, 99, 2000, 5, -3, 0
C H T1 T2 T3 number OUTPUT
[6]
10
© UCLES 2014 7010/11/M/J/14
8 Study the following flowchart very carefully.
START
STOP
product = 1
value = number
product = value * product
value = value – 1
is value = 0?
INPUT number
OUTPUT number, product
Yes
No
11
© UCLES 2014 7010/11/M/J/14 [Turn over
Complete the trace table for the input value of 5:
number product value OUTPUT
[4]
8
7010/13/O/N/14© UCLES 2014
8 Data sent across the Internet are frequently encrypted. The following flowchart shows a basic encryption method (Note: the symbol in the flowchart means “is replaced by”).
START
STOPis character =
“.” ?
is character a
vowel ?
INPUT
character
Yes
Yes
No
a
e
i
o
u
o
u
a
e
i
is character =
b,c,d,f,g,h or j ?
Yes
No
b
c
d
f
g
h
j
s
t
v
w
x
y
z
is character =
k,l,m,n,p,q or r ?
Yes
No
k
l
m
n
p
q
r
b
c
d
f
g
h
j
is character =
s,t,v,w,x,y or z ?
Yes
No
No
s
t
v
w
x
y
z
k
l
m
n
p
q
r
9
7010/13/O/N/14© UCLES 2014 [Turn over
For example,
rai oa m b o th e l l o .
becomes:
joa eo d s e ly u c c e .
(a) Use the flowchart to encrypt the following message:
m e e t i n g a h e a d .w i l l g o
[2]
(b) Use the information in the flowchart to show which input message produced the following encrypted message:
t e d g i l a f x w i f .a k
[2]
(c) Many customers shop online. Apart from encryption, describe three other security features built into many online shopping
websites.
1 ................................................................................................................................................
...................................................................................................................................................
2 ................................................................................................................................................
...................................................................................................................................................
3 ................................................................................................................................................
...............................................................................................................................................[3]
16
7010/13/O/N/14© UCLES 2014
13 Study the following flowchart very carefully.
STOP
START
T1 = 0
T2 = 0
T3 = 0
INPUT A, B, C
is A = 0
and B = 0 and
C = 0 ?
T2 = T2 + 1
T3 = T3 + 1
T1 = T1 + 1is A > B ? is A > C ?
is B > C ?
OUTPUT T1,
T2, T3
Yes
Yes Yes
Yes
No
No
No
No
17
7010/13/O/N/14© UCLES 2014 [Turn over
(a) Complete the trace table for the flowchart using the following data:
3, 2, 1 4, 8, 7 6, 0, 3 5, 6, 9 4, 11, 3 0, 0, 0
T1 T2 T3 A B C OUTPUT
[5]
(b) This flowchart does not give correct answers for certain sets of test data.
Suggest a data set that would give an incorrect answer.
Give a reason for your choice.
data set .....................................................................................................................................
...................................................................................................................................................
reason .......................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[2]
8
2210/21/M/J/15© UCLES 2015
3 The flowchart below inputs the weight of a number of parcels in kilograms. Parcels weighing more than 25 kilograms are rejected. A value of –1 stops the input.
The following information is output: the total weight of the parcels accepted and number of parcels rejected.
START
INPUT
Weight
Is Weight
= –1?
OUTPUT Total,
Reject
Is Weight
> 25?
!"#$%&%'
()*)+"%&%'
!"#$%&% !"#$%,%-)./0"
()*)+"%&%()*)+"%,%1
Yes
Yes
No
No
END
9
2210/21/M/J/15© UCLES 2015 [Turn over
Complete the trace table for the input data:
1.8, 26.0, 7.0, 11.3, 10.0, 2.5, 25.2, 5.0, 19.8, 29.3, –1
Total Reject Weight OUTPUT
[5]
4 Five data types and five data samples are shown below.
Draw a line to link each data type to the correct data sample.
Data type Data sample
Integer 'a'
Real 2
Char 2.0
String True
Boolean "Twelve"
[4]
6
2210/22/M/J/15© UCLES 2015
3 (a) The flowchart below inputs six single digit numbers. The predefined function MOD gives the value of the remainder, for example, Y 10 MOD 3 gives the value Y = 1
START
INPUT
A, B, C, D, E, F
OUTPUT
'Reject'
OUTPUT
'Accept'Is Check =
F?
Check Total MOD 11
Yes
No
Total A*1 + B*2 + C*3 + D*4 + E*5
END
7
2210/22/M/J/15© UCLES 2015 [Turn over
Complete a trace table for each of the two sets of input data.
Set 1 5, 2, 4, 3, 1, 5
Set 2 3, 2, 1, 0, 7, 3
Trace table set 1 5, 2, 4, 3, 1, 5
A B C D E F Total Check Output
Trace table set 2 3, 2, 1, 0, 7, 3
A B C D E F Total Check Output
[4]
(b) State the purpose of the flowchart in part (a).
...................................................................................................................................................
...............................................................................................................................................[1]
(c) Identify a problem with this flowchart and explain how to correct it.
Problem ....................................................................................................................................
...................................................................................................................................................
Solution .....................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...............................................................................................................................................[3]
top related