You are on page 1of 4

OAK INTERNATIONAL SCHOOL, BENIN

Fourth Marking Period Examination 2022/2023


Course: AP CSP
Name: …………………… Grade: 11 Date: …………. Duration: 2 HRS

SECTION A
MULTIPLE CHOICE QUESTIONS
1. What will the following algorithm display? C. 84
a ← 13 D. 126
b ← 17
a←a+1 4. The output of the following algorithm is
c←a/7 a ← “Milk”
DISPLAY(c) a ← a + “Cookies Soda”
DISPLAY(a) a ← a + “Chips”
DISPLAY(b) a ← a + “put them in a bag so you know they
stay crisp”
A. 2 14 17 DISPLAY(b)
B. 13 17 5
C. 2 12 2 A. Milk
D. 14 17 2 B. Milk Cookies Soda
C. Put them in a bag and they stay crisp
2. What will the following algorithm display? D. Milk Cookies Soda Chips put them in a bag
a ← 13
a ← 17 5. Which of the following is the output of the
c←a+1 following algorithm?
DISPLAY(a) a ← 26 MOD 2
A. 13 DISPLAY(a)
B. 17
C. 18 A. 26
B. 13
D. 19
C. 0
3. What is the output of the following algorithm? D. 1
a ← 11
a ← a + 35 6. What will the following code segment display?
b ← a MOD 2 a ← 13
b←a×b b←5
DISPLAY(b) temp ← a
a←b
A. 0 b ← temp
B. 42 DISPLAY(a)
DISPLAY(b)

A. 13 5
B. 5 13
C. a b
D. 13 13

7. The following grid contains a robot represented


as a triangle. The robot is initially facing right.

Which of the following code segments can be


used to move the robot to the black square along
the path indicated by the arrows?

8. How are list elements accessed individually?


A. The list name with an integer index in
brackets
B. The list name is with the value the code
needs to access
C. The “access” command with the list name
and length
D. A FOR EACH loop with the list to find an
individual value

9. What do logical conditions evaluate to?


A. A constant
B. A string
C. A real number
D. A Boolean
10. What does iteration with computer science loops
mean? 14. Consider the code below:
A. Repeating a block of code until a condition name ← “ “
is met REPEAT UNTIL (name = “done”)
B. Executing code once {
C. Duplication a section of code multiple times DISPLAY (“Student name is:
in a program “, name)
D. Identifying error conditions in a program }

11. Three numbers need to be put into order from Which line of the code can be replaced inside
smallest to greatest. Which of the following the braces {} to fix the following loop so it will
algorithms can be used to accomplish this? not be an infinite loop?
A. If the first number is greater than the middle
one, swap them. Then, if the middle number A. name ← INPUT ()
is greater than the last one, swap them. B. If name <> “done”
Then, if the first number is greater than the C. count = count + 1
last, swap them. D. name ← studentRoster
B. If the first number is greater than the middle
one, swap them. Then, if the middle number 15. The figure below shows a circuit composed of
is greater than the last, swap them. two logic gates. The output of the circuit is
C. If the first number is greater than the last, true
swap them. Then, if the first number is
greater than the middle number, swap them.
D. If the first number is greater than the middle,
swap them. Then, if the middle number is
greater than the last, swap them. Then, if the
first number is greater than the middle, swap
them.

12. What is the value of y after the following


statements?
x ← 10
x←x+4
y ← x MOD 3

A. 0 Which of the following is a true statement about


B. 2 input A?
C. 3 A. Input A must be true
D. 4 B. Input A must be false
C. Input A can either be true or false
13. How are algorithms and programs related? D. There is no possible value of input A that
A. They have a hierarchical relationship. will cause the circuit to have the output
B. Programs implement algorithms true
C. Algorithms implement programs
D. They can both be run on a computer
16. Consider the code segment below: If the variables onTime and absent both
have the value false, what is displayed as a
result of running the code segment?
A. Is anyone there?
B. Better late than never.
C. Hello. Is anyone there?
D. Hello. Better late than
never.

SECTION B
LAB SESSION
QUESTION 1:
Alison created a list of her favourite fruits in order of preference. The name of the list is favFruits and it
contained the following elements:
favFruits = [“plum”, “strawberry”, “apricot”, “watermelon”, “orange”,
“apple”, “mango”]

She later found out that she had mistakenly swapped the positions of her most preferred fruit “mango” and her
least preferred fruit “plum”.

You are required to:


a) write an algorithm to help Alison swap the positions of the first and last elements of the list and display
the correct list showing the correct order of preference.
b) implement the algorithm using Python

QUESTION 2:
Precious is designing a blog for her project. On the blog site, she wants to implement a restricted area where
only girls in grade 11 can access. To access this page, the user needs to answer the following questions?
1) What is your name?
2) What is your gender?
3) What grade are you in?
a) Write an algorithm that will display: You are welcome, Janet! Click here to access
the requested page if Janet meets all the required criteria to access the page OR Sorry
Faith, only grade 11 girls can access the requested page for Fait who is a
girl but not in grade 11 OR Sorry Michael, the requested page is only for
girls.
b) Implement the algorithm using Python Good Luck!

You might also like