What number will be output by the console.log command on line 7?

AP CSP 12-12 - THURSDAY

Flashcard
•
Computers
•
9th - 12th Grade
•
Hard
Quizizz Content
FREE Resource
Student preview

40 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Back
100
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.
FLASHCARD QUESTION
Front
What number will be output by the console.log command on line 5? Options: 10, 11, 12, 13, 16
Back
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.
FLASHCARD QUESTION
Front
What number will be output by the console.log command on line 5? Options: 10, 25, 30, 35
Back
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.
FLASHCARD QUESTION
Front
What text will be output by the program? Options: less than 10, less than 20, less than 30, 30 or more
Back
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.
FLASHCARD QUESTION
Front
What text will be output by the program? Options: Output A, Output B, Output C, Output D, Output E
Back
Output D
Answer explanation
6.
FLASHCARD QUESTION
Front
What will be the order of letters printed to the console when this program is run? Options: a b c, a b c b c b c, a b c b c, a b c a
Back
a b c b c
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.
FLASHCARD QUESTION
Front
"You win!" never displays. What change would fix this issue? Options: 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
Back
Line 3 - remove var
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 Quizizz
39 questions
IBC Photoshop Certification Practice 2024

Flashcard
•
9th Grade
24 questions
Unit 4 Review (AP CSP) Code.org

Flashcard
•
9th - 12th Grade
33 questions
Code.org (Units 1, 3 and 4 Vocab)

Flashcard
•
9th - 12th Grade
41 questions
(CCR)Photoshop Certification Final Review 2

Flashcard
•
9th - 12th Grade
28 questions
AP CSP Flashcardizz 9-19 - Practice Test

Flashcard
•
9th - 12th Grade
29 questions
Copyright, Public Domain, Creative Commons - Excel

Flashcard
•
10th Grade
27 questions
Computer Hardware

Flashcard
•
10th - 11th Grade
40 questions
Python

Flashcard
•
8th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade
Discover more resources for Computers
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade
10 questions
Right Triangles: Pythagorean Theorem and Trig

Quiz
•
11th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade
24 questions
LSO - Virus, Bacteria, Classification - sol review 2025

Quiz
•
9th Grade
65 questions
MegaQuiz v2 2025

Quiz
•
9th - 12th Grade