AP CSP Conditions

AP CSP Conditions

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Medium

Used 3+ times

FREE Resource

Student preview

quiz-placeholder

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

A Boolean expression is an expression that evaluates to which of the of the following?

Any Integer

Integers between 1 and 10

Any single character

Yes/Maybe/No

True/False

2.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Two grids are shown. Each grid contains a robot represented as a triangle. Both robots are initially facing left. Each robot can move into a white or gray square, but cannot move into a black region.


For each grid, the program below is intended to move the robot to the gray square. The program uses the procedure Goal_Reached ( ), which evaluates to true if the robot is in the gray square and evaluates to false otherwise.


For which of the grids does the program correctly move the robot to the gray square?

Grid I only

Grid II only

Both Grid I and Grid II

Neither Grid I nor Grid II

3.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

An office building has two floors. A computer program is used to control an elevator that travels between the two floors. Physical sensors are used to set the following Boolean variables.


The elevator moves when the door is closed and the elevator is called to the floor that it is not currently on.


Which of the following Boolean expressions can be used in a selection statement to cause the elevator to move?

(onFloor1 AND callTo2) AND (onFloor2 AND callTo1)

(onFloor1 AND callTo2) OR (onFloor2 AND callTo1)

(onFloor1 OR callTo2) AND (onFloor2 OR callTo1)

(onFloor1 OR callTo2) OR (onFloor2 OR callTo1)

4.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Consider the code segment.


If the variables onTime and absent both have the value false, what is displayed as a result of running the code segment?

Is anyone there?

Better late than never.

Hello. Is anyone there?

Hello. Better late than never.

5.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

A game programmer uses this nested conditional in their online Four Square game.


When mouseX is 173 and mouseY is 199, what will be the value of currentSquare?

1

2

3

4

6.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Trace the code and plot the movements of the robot for the 3 scenarios.

If the robot is directed to move onto a black square, it “crashes” and the program ends.


Choose the scenario that results in a "crash."

Media Image
Media Image
Media Image

7.

MULTIPLE CHOICE QUESTION

5 mins • 1 pt

Media Image

Trace the code and plot the movements of the robot for the 3 scenarios.

If the robot is directed to move onto a black square, it “crashes” and the program ends.


Choose the scenario that results in a "crash."

Media Image
Media Image
Media Image

Create a free account and access millions of resources

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?