Choose 1 answer:
APCSP Cumulative Test 2

Quiz
•
Computers
•
9th - 12th Grade
•
Medium

Kerry Duncan
Used 42+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
REPEAT 2 TIMES
{
walkForward()
turnRight()
walkForward()
turnRight()
}
REPEAT 2 TIMES
{
walkForward()
turnRight()
walkForward()
turnLeft()
turnLeft()
}
REPEAT 2 TIMES
{
walkForward()
turnRight()
walkForward()
turnLeft()
}
REPEAT 2 TIMES
{
walkForward()
turnLeft()
walkForward()
turnRight()
}
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
An algorithm will be used to calculate the difference between the smallest and largest values in a list. For the list of [10, 3, 5, 6], it should calculate a difference of 7.
There are two proposals for the algorithm:
Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal.
Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal.
Which of these statements are true about these algorithms?
I. Algorithm 1 does not work on lists where the smallest value is at the start of the list or the largest value is at the end of the list.
II. Algorithm 2 does not work on lists that contain all negative numbers or all numbers over 1000.
Choose 1 answer:
Choose 1 answer:
I
II
I and II
Neither I or II
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
"Aba speak" is a game invented by school children to disguise what they're speaking.
When speaking, they transform each word following this algorithm:
For each letter in word:
If letter is vowel:
Add "b" after
Add that letter after "b"
Following that algorithm, how would they transform the word "avocado"?
Choose 1 answer:
Choose 1 answer:
abvobcabdob
avabocabadabo
abavobocabadobo
abavbvobocbcabadbdobo
abavobacabadoba
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Determine what is printed by the following code.
values ⬅ [5, 6, 7, 0, 3, 3]
baz ⬅ 0
FOR EACH value IN values
{
if( value ≥ 7 )
{
baz ⬅ baz + 1
}
}
DISPLAY( baz )
1
0
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Determine what is printed by the following code.
list ⬅ [11, 2, 8, 6, 4, 2, 5, 6, 9, 12]
fizz ⬅ 0
thud ⬅ 0
FOR EACH item IN list
{
if( item MOD 3 = 2 )
{
thud ⬅ thud + 1
}
fizz ⬅ fizz + 1
}
DISPLAY( thud / fizz )
0
1
0.5
5/10
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A programmer for a weather website needs to display the proportion of days with freezing temperatures in a given month.
Their algorithm will operate on a list of temperatures for each day in the month. It must keep track of how many temperatures are below or equal to 32. Once it's done processing the list, it must display the ratio of freezing days over total days.
Which of these correctly expresses that algorithm in pseudocode?
numFreezing ← 0
numDays ← 0
FOR EACH temp IN temps {
IF (temp ≤ 32) {
numFreezing ← numFreezing + 1
}
numDays ← numDays + 1
DISPLAY(numFreezing/numDays)
}
numFreezing ← 0
numDays ← 0
FOR EACH temp IN temps {
IF (temp ≤ 32) {
numFreezing ← numFreezing + 1
}
numDays ← numDays + 1
}
DISPLAY(numFreezing/numDays)
numFreezing ← 0
numDays ← 0
FOR EACH temp IN temps {
IF (temp < 32) {
numFreezing ← numFreezing + 1
}
numDays ← numDays + 1
}
DISPLAY(numFreezing/numDays)
numFreezing ← 0
numDays ← 0
FOR EACH temp IN temps {
IF (temp ≤ 32) {
numFreezing ← numFreezing + 1
numDays ← numDays + 1
}
}
DISPLAY(numFreezing/numDays)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A programmer is deciding between using a linear or binary search to find a target value in a sorted list. Which of the following is true?
In all cases, a binary search of a sorted list requires fewer comparisons than a linear search.
Generally, the advantage of using a binary search over a linear search increases as the size of the list increases.
A linear search will generally run faster than a binary search because a linear search requires fewer lines of code to implement.
Using a linear search is preferable to using a binary search if there is a chance that the target may not be found in the list.
Create a free account and access millions of resources
Similar Resources on Quizizz
20 questions
Big Idea 2: Data Questions

Quiz
•
9th - 12th Grade
15 questions
AP CSP - Unit 6: Lesson 6: Assessment Day

Quiz
•
12th Grade
10 questions
7.5 Standard Methods of Solution Cambridge IGCSE 0478

Quiz
•
10th Grade - University
20 questions
Unit 6 ArrayLists and String Methods

Quiz
•
9th - 12th Grade
20 questions
iGCSE Computer Science: Problem Solving

Quiz
•
9th - 12th Grade
14 questions
U10 - Algorithms Quiz

Quiz
•
11th Grade
20 questions
Higher SDD Revision

Quiz
•
11th - 12th Grade
15 questions
CP M4 Repetition & Loops

Quiz
•
9th - 12th Grade
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
20 questions
Math Review - Grade 6

Quiz
•
6th Grade
20 questions
math review

Quiz
•
4th Grade
5 questions
capitalization in sentences

Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance

Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions

Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines

Quiz
•
Professional Development
12 questions
Dividing Fractions

Quiz
•
6th Grade
Discover more resources for Computers
25 questions
Spanish preterite verbs (irregular/changed)

Quiz
•
9th - 10th Grade
10 questions
Identify Slope and y-intercept (from equation)

Quiz
•
8th - 9th Grade
10 questions
Juneteenth: History and Significance

Interactive video
•
7th - 12th Grade
8 questions
"Keeping the City of Venice Afloat" - STAAR Bootcamp, Day 1

Quiz
•
9th - 12th Grade
26 questions
June 19th

Quiz
•
4th - 9th Grade
20 questions
Distance, Midpoint, and Slope

Quiz
•
10th Grade
20 questions
Figurative Language Review

Quiz
•
10th Grade
27 questions
STAAR English 1 Review

Quiz
•
9th Grade