
AP CSP Unit 5
Authored by Coral Riley
Computers
8th - 12th Grade
Used 77+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Consider the JavaScript code segment below. Which statement should be used in place of <missing code> such that the alarm is set to 9:00 am on weekends, and 6:30 am on weekdays.
var day = prompt("What day is it tomorrow?");
if ( <missing code> ){
setAlarm = "9:00am";
}
else {
setAlarm = "6:30am";
}
day == "Saturday"
day == "Sunday"
(day == "Saturday") || (day == "Sunday")
(day == "Saturday") && (day == "Sunday")
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
After running the following code segment, what is contained in the array data?
[3, 1, 8, 4, 4]
[2, 3, 4, 5, 6]
[2, 3, 4, 5, 4]
[3, 1, 8, 4 null]
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Choose the best description of what the mystery procedure below does.
PROCEDURE mystery (list, n)
{
i = 1
REPEAT LENGTH(list) TIMES
{
IF ( list[i] = n )
{
DISPLAY (i)
}
i = i+1
}
}
Mystery displays the number at index n.
Mystery displays the index of the first occurrence of the value n in the list.
Mystery displays the index of the last occurrence of the value n in the list.
Mystery displays the index of every occurrence of the value n in the list.
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following best describes the value returned by the procedure below?
PROCEDURE mystery (data)
{
count = 0
i = 1
REPEAT UNTIL (i = LENGTH(data))
{
IF (data[i] < data[i+1])
{
count = count + 1
}
i = i+1
}
RETURN (count)
}
The answers below refer to values being in ascending and descending order. Ascending order means increasing, as in: [1, 2, 5, 8]. Descending order means decreasing, as in [20, 15, 7, 3].
The procedure returns true when data is in ascending order
The procedure returns false when data is in descending order
The procedure returns the number of times adjacent items are in ascending order
The procedure returns how long it takes to find two numbers in ascending order
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A robot starts in a grid facing north (B3). What is the robot's location and direction after the following program is executed?
data = ["F", "F", "R", "F", "L", "F", "R", "R", "F"]
FOR EACH move IN data
{
IF ( move = "F" AND CAN_MOVE(forward) )
{
MOVE_FORWARD()
}
ELSE IF (move = "R"){
rotate_right()
}
ELSE IF ( move = "L") {
rotate_left()
}
}
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Scratch
Quiz
•
KG - Professional Dev...
10 questions
Java: repetition control structure for & while
Quiz
•
10th - 12th Grade
10 questions
Lesson 1 Introduction to Database System
Quiz
•
10th Grade
10 questions
Quiz Komponen Komputer
Quiz
•
1st Grade - University
10 questions
Review
Quiz
•
9th - 12th Grade
10 questions
Latihan Brainware dan Hardware
Quiz
•
9th - 12th Grade
10 questions
TIN8-HK1-KTTX1
Quiz
•
8th Grade
10 questions
Kuis Pengayaan (Aplikasi Sehari-hari?
Quiz
•
9th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
10 questions
Probability Practice
Quiz
•
4th Grade
15 questions
Probability on Number LIne
Quiz
•
4th Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
6 questions
Appropriate Chromebook Usage
Lesson
•
7th Grade
10 questions
Greek Bases tele and phon
Quiz
•
6th - 8th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials
Interactive video
•
6th - 10th Grade
14 questions
[AP CSP] JavaScript Programming Quiz
Quiz
•
9th - 12th Grade
10 questions
Understanding Computers and Computer Engineering
Interactive video
•
7th - 12th Grade
37 questions
Python - Tuples, Lists, and List Methods
Quiz
•
9th - 12th Grade
60 questions
MOS Word Home, Insert, Reference Ribbon Basics
Quiz
•
9th Grade