WorksheetsAP CSP Algorithms
Total questions: 23
Worksheet time: 12mins
What will the following algorithm display?
a ← 13
b ← 17
a ← a + 1
c ← a/7
DISPLAY(c)
DISPLAY(a)
DISPLAY(b)
2, 14, 17
13, 17, 5
2, 12, 2
14, 17, 2
What will the following algorithm display?
a ← 13
a ← 17
a ← a+1
DISPLAY(a)
13
17
18
19
What will the following algorithm display?
a ← 11
a ← a + 35
a ← a + 6
a ← a MOD 2
a ← a x b
DISPLAY (a)
0
42
84
126
Extra Credit: Before deciding on a Hedgehog, Sega originally planned to make Sonic a...
rabbit
goose
cat
dinosaur
What will the following display?
a ← "Milk"
a ← "Cookies Soda"
a ← "Chips"
b ← a + "put them in a bag so they stay crisp"
Milk
Milk Cookies Soda
Put them in a bag so they crisp
Milk Cookies Soda Chips put them in a bag so they stay crisp
What is the value displayed after the program is run?
a ← 8
b ← 3
c ← 2
a ← b * c
c ← c+4
display "a"
display (c)
a 8
a 6
8 6
16 4
What is the value displayed after the program is run?
a ← 8
b ← 3
c ← 2
a ← b*c
c ← c+4
DISPLAY("a")
DISPLAY("c")
a 8
a c
8 6
16 4
What will the following algorithm display?
a ← 26 MOD 2
26
13
0
1
What will the following algorithm display?
a ← 5 MOD 2
DISPLAY (a)
26
13
0
1
What will the following algorithm display?
a ← 8 MOD 26
display(a)
26
13
8
1
Extra Credit: Before deciding on the name "Sonic", the original name of the character was
Speedy
Mach
Mr. Needlemouse
Gus
What will the following algorithm display?
a ← 13 MOD 26
display(a)
26
13
8
0
What will the following algorithm display?
a ←26 MOD 13
display(a)
26
13
8
0
What will the following algorithm display?
a ←26 MOD 3
b ←7 MOD a
display (b)
26
13
0
1
What will the following algorithm display?
a ←2 MOD 3
b ←7 MOD a
display (b)
26
13
0
1
What will the following segment display?
a ← 13
b ← 5
temp ← a
a ← b
b ← temp
display (a)
display (b)
13 5
5 13
a b
13 13
What is the percentage that this algorithm displays true?
Display(RANDOM(1, 10) = 6)
9
10
60
100
What is the percentage that this algorithm displays true?
DISPLAY(random(5,9) = 6)
10
20
60
100
Extra Credit: Sonic's footwear was inspired by...
Michael Jordan
Michael Jackson
Mickey Mouse
Wreck-it-Ralph
What is the percentage that this algorithm displays true?
DISPLAY (RANDOM(5,9) = 4)
0
20
60
100
What is the percentage that this algorithm displays true?
DISPLAY(RANDOM(5,9) ≤ 9)
0
20
60
100
What is the percentage that this algorithm displays true?
DISPLAY(RANDOM(5,9)>9)
0
20
60
100
What is the percentage that this algorithm displays true?
DISPLAY(RANDOM(1, 10) ≤6
9
10
60
100
