AP CSP Unit 4

Quiz
•
Computers
•
10th - 12th Grade
•
Medium
Joanna Stevens
Used 269+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What number will be output by the console.log command on line 7?
10
100
20
200
Answer explanation
The variable bop is initialized on line 2. On line 3, the variable bop is assigned the value 10. On line 5, the variable bop is assigned the value 100. Since the most recent value bop has been assigned is 100, that is the value that will be printed by the command on line 7.
2.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What number will be output by the console.log command on line 5?
10
11
12
13
16
Answer explanation
Walking through the program line by line:
On line 1, the variable oop is initialized and the value 10 is stored in it
On line 2, the variable oop is assigned its current value (10) plus 1.
On line 3, the variable oop is assigned its current value (11) plus 2.
On line 4, the variable oop is assigned its current value (13) plus 3.
On line 5, the current value assigned to oop, 16, is output.
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What number will be output by the console.log command on line 5?
10
25
30
35
Answer explanation
Walking through the program line by line:
On line 1, the variable kit is initialized and assigned the value 20.
On line 2, the variable roo is initialized and assigned the value 10.
On line 3, the variable kit is assigned to its current value (20) plus 5.
On line 4, the variable roo is assigned to the current value of kit (25) plus the current value of roo (10).
On line 5, the current value assigned to roo, 35, is output.
4.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What text will be output by the program?
less than 10
less than 20
less than 30
30 or more
Answer explanation
Walking through the program line by line:
On line 1, the variable score is initialized and assigned the value 0.
On line 2, the variable score is assigned its current value (0) plus 10. On line 3, the variable score is assigned its current value (10) plus 10. On line 4, the variable score is assigned its current value (20) plus 10.
On line 5, the boolean expression score < 10 evaluates to false since the current value of score is 30, which causes the command on line 6 to not execute.
On line 7, the boolean expression score < 20 evaluates to false since the current value of score is 30, which causes the command on line 8 to not execute.
On line 9, the boolean expression score < 30 evaluates to false since the current value of score is 30, which causes the command on line 10 to not execute.
Since all of the if-else-if statements have evaluated to false, the command inside the else statement will run and the console prints 30 or more.
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What text will be output by the program?
Output A
Output B
Output C
Output D
Output E
Answer explanation
6.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
What will be the order of letters printed to the console when this program is run?
a b c
a b c b c b c
a b c b c
a b c a
Answer explanation
Line 1 will print out a, line 2 calls the function letters which will print b then c. Line 3 calls the function letters agan which will print b then c.
7.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
"You win!" never displays. What change would fix this issue?
Line 1 - change variable name to totalScore
Line 3 - remove var
Line 4 - change conditional to score >= 5
Line 5 - change to a getText command
Answer explanation
While it looks like there's only one variable being used, it actually has two variables, one local, and one global, and they're both named score. Every time button2 is clicked the local variable score is recreated and then deleted once the onEvent is done running. This means that the value of the local variable will never be greater than 5 and therefore the setText command inside the conditional statement will never execute.
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
Python Recap

Quiz
•
7th Grade - University
16 questions
Python Basics

Quiz
•
KG - University
13 questions
Python Iteration

Quiz
•
10th Grade
15 questions
Scope of Variables in Python

Quiz
•
1st Grade - Professio...
19 questions
Programming Techniques Survey

Quiz
•
8th - 12th Grade
20 questions
Toán tử trong C ++

Quiz
•
10th - 12th Grade
17 questions
Python - Quiz

Quiz
•
9th - 11th Grade
14 questions
year 8 lesson 2 quiz - python

Quiz
•
8th - 10th Grade
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
1.2 OSI & TCP IP Models Quiz

Quiz
•
10th Grade
20 questions
Digital Citizenship

Quiz
•
8th - 12th Grade
35 questions
Computer Baseline Examination 2025-26

Quiz
•
9th - 12th Grade
13 questions
Problem Solving Process

Quiz
•
9th - 12th Grade
20 questions
Hardware vs. Software Quiz

Quiz
•
7th - 10th Grade
10 questions
Understanding Algorithms with Pseudocode and Flowcharts

Interactive video
•
9th - 12th Grade
19 questions
AP CSP Unit 1 Review (code.org)

Quiz
•
10th - 12th Grade