
APCSP Unit 1 Variables, Random, Math Practice Questions

Quiz
•
Computers
•
11th Grade
•
Hard

Victoria Berkowitz
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A developer is creating a program that will store a user's email address and whether the user has verified their account. Which of the following variables are most appropriate for the program?
A string variable named e and a Boolean variable named v
A string variable named emailAddress and a Boolean variable named isVerified
A string variable named email and a numeric variable named verificationStatus
A string variable named userEmail and a numeric variable named verified
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment, which uses the variables x, y, and z.
x ← 4
y ← 5
z ← 6
x ← z
y ← x
DISPLAY (x)
DISPLAY (y)
What is displayed as a result of running the code segment?
4 5
5 6
6 6
6 5
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The variable amountBooks is to be used to represent the amount of books on a shelf. Which of the following is the most appropriate data type for numBooks?
Boolean
String
Number
Array
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the following code segment.
a ← 15
b ← a MOD c
Which of the following initial values of the variable c would result in the variable b being set to 3 after the code segment is executed?
2
3
4
5
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A die has 6 faces numbered 1 to 6. Which of the following code segments can be used to simulate rolling the die four times and assigns the sum of the values obtained by the four different rolls to the variable total?
total ← RANDOM(1, 6) + RANDOM(1, 6) + RANDOM(1, 6) + RANDOM(1, 6)
total ← RANDOM(1, 24)
total ← 4 * RANDOM(1, 6)
total ← 6 * RANDOM(1, 4)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of executing the code segment with variables a, b, c, and d initialized as shown?
11 30 40 55
12 35 35 50
17 45 35 60
10 25 35 50
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which code segment correctly simulates two spins of a spinner with 8 equal regions?
sum ← RANDOM(1, 8) + RANDOM(1, 8)
sum ← RANDOM(1, 16)
sum ← 2 * RANDOM(1, 8)
sum ← 8 * RANDOM(1, 2)
Create a free account and access millions of resources
Similar Resources on Wayground
16 questions
Variables and Data Types Knowledge Check

Quiz
•
9th - 12th Grade
10 questions
String Methods

Quiz
•
9th - 12th Grade
10 questions
Introduction algorithmique

Quiz
•
11th Grade
20 questions
Kuis 1 DPPLG 2

Quiz
•
10th - 11th Grade
20 questions
Python year 9

Quiz
•
8th - 11th Grade
20 questions
JavaScript Basics Review

Quiz
•
7th - 12th Grade
20 questions
Examen 2 - Informática

Quiz
•
9th - 12th Grade
18 questions
Unit 4 Variables, Conditionals & Functions CS20-21

Quiz
•
9th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
10 questions
Lab Safety Procedures and Guidelines

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

Quiz
•
5th Grade
10 questions
UPDATED FOREST Kindness 9-22

Lesson
•
9th - 12th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
US Constitution Quiz

Quiz
•
11th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade