
AP CSP: Semester 1 Final Exam
Quiz by Praise
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
After the following code runs, what is the value of z?
False
True
120s - Q2
What is displayed as a result of running this program?
3 9
2 1 4 5
39
12
21 45
30s - Q3
The following program asks the user for a multiple of 4 until they correctly input a multiple of 4. What code should be added to lines 3-4 so that there is not an infinite loop?
if num % 4 == 0:
continue
if num % 4 == 0:
exit
if num % 4 == 0:
break
This program will produce an infinite loop regardless of what code is added.
300s - Q4
Which of the following is NOT a reason why programmers use comments?
Comments make it easier for programmers to identify what specific blocks of code do.
Comments enable programmers to write a program in plain English instead of a programming language.
Comments makes it easier for multiple people to work on a single program.
Comments enable programmers to plan out their code before actually writing it.
300s - Q5
What will print to the console when the following program runs?
False
0
True
Undefined
120s - Q6
What would be the radius, in pixels, of the circle output from the following code?
75 pixels
25 pixels
12.5 pixels
50 pixels
120s - Q7
If the user enters the number ‘5’, what is printed to the console when this program runs?
50
5555555555
10
5
300s - Q8
Given the following segment of code, what will the output be?
DISPLAY(3 * 2 + 4 MOD 5)
3
2
4.8
10
300s - Q9
Given the following, what will the output be?
DISPLAY(4 + 6 / 5)
2.0
5
5.2
2
120s - Q10
A student is trying to prompt a user to enter number and then add them to a variable called sumEven, but only if the user enters an even number. For example, if the user enters 4, 5, 6 then sumEven will equal 10.
Which of the following operators will be most helpful to help accomplish this task?
/
-
MOD
*
300s - Q11
Given the following code
a ← 8
b ← 3
ans ← (a + 3 * b) MOD (c + 4)
Which of the following values for c would result in ans being set to 1
0
4
12
All of these
120s - Q12
How many possible values does a boolean have?
1
3
Infinite
2
60s - Q13
Which of the following Boolean expressions is equivalent to the expression:
a AND (b OR c)
(a AND b) OR (a AND c)
(a AND b) AND (a AND c)
(a AND b) OR c
(b AND c) OR a
300s - Q14
What is displayed as a result of executing the following program?
1
4
5 4 3 2 1
0
5
300s - Q15
After the following code runs, what is the value of number?
16
8
4
2
32
300s
