Search Header Logo

APCSP Unit 1 Variables, Random, Math Practice Questions

Authored by Victoria Berkowitz

Computers

11th Grade

APCSP Unit 1 Variables, Random, Math Practice Questions
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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

Media Image

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)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?