wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

AP CSP | Conditionals Review

Total questions: 44

Worksheet time: 1hrs 6mins

Name
Class
Date
1.

A program is:

a)

a series of steps to complete a task that a computer can understand.

b)

Python, JavaScript, Java, PHP, and Ruby

c)

the action we want the program to take.

d)

a condition that is false.

2.

Coding is:

a)

Python, JavaScript, Java, PHP, and Ruby

b)

the action of writing instructions for a computer in a language that it can understand.

c)

a language that is more precise than English but less precise than a coding language.

d)

a specific action to be taken if the condition is false.

3.

What is syntax?

a)

a catch-all for every other situation besides true.

b)

pieces of code that direct the program to run in different ways depending on what else is happening.

c)

a set of rules for how a language is written.

d)

English, Chinese, or Spanish.

4.

Control flow statements:

a)

pieces of code that direct the program to run in different ways depending on what else is happening.

b)

determine which code is being carried out at a given time.

c)

give the program the flexibility to go down more than one path.

d)

all of these.

5.

Pieces of code that only run "under certain conditions":

a)

conditional statements

b)

control flow statments

c)

syntax

d)

variables

6.

What is a condition?

a)

JavaScript

b)

Something that has to be true in order for an action to be carried out.

c)

syntax

d)

pseudocode

7.

This is a catch-all for every other situation besides the one where the condition is true.

a)

then

b)

do

c)

else

d)

if

8.

What is/are true about pseudocode?

a)

somewhere between English and a coding language.

b)

more precise than English but less precise than a coding language.

c)

used by programmers to figure out the logic and flow of their programs without having to worry about syntax.

d)

all of these

9.

A variable is...

a)

is a placeholder for a piece of information that can change.

b)

is like a bucket for holding information.

c)

can be written as letters or with longer words.

d)

all of these

10.

Which symbol means "not equal to"?

a)

==

b)

<=

c)

>=

d)

!=

11.

Which of the following is a test statement?

a)

color = sprite.ask("What's your favorite color?")

b)

sprite.say("So your favorite color is " + color.")

c)

if color == "red":

d)

color = "red"

12.

Which of the following best describes what a test statement is?

a)

This part is the code that runs in a conditional if the condition is true

b)

This is the part of the code that checks whether a condition is true or false

c)

This is a code that shows how many times a loop should run

d)

This is a code that saves multiple pieces of information in one place

13.

Which of the following best describes what the nested code part of a conditional is?

a)

This part is the code that runs in a conditional if the condition is true

b)

This is the part of the code that checks whether a condition is true or false

c)

This is a code that shows how many times a loop should run

d)

This is a code that saves multiple pieces of information in one place

14.

How many test statements does this program have?

a)

1

b)

2

c)

3

d)

4

15.

What happens if the user inputs "winter" into the first question in this program?

a)

The background changes to a winter background

b)

The user is asked another question

c)

The sprites says "Sad..."

d)

The sprite says "Me too!"

16.

Which of the following best describes what a flowchart is?

a)

A diagram that shows each step of a process or algorithm

b)

Conventions for making code easier for people to read

c)

The line of code in a conditional that checks if something is true or false.

d)

The line of code in a conditional that's indented over

17.

Which of the following symbols compares two values to see if they are the same?

a)

=

b)

[ ]

c)

==

d)

""

18.

According to the following flow chart, what will happen right after the user chooses "red"?

a)

The sprite will ask "Would you like to choose the red door, or the blue door?"

b)

The sprite will say "You win a car!"

c)

The sprite will say "You win a house!"

d)

The sprite will say "Thanks for playing!"

19.

According to the following flow chart, in what situation will the sprite say "Thanks for playing!"?

a)

If the user chooses "red"

b)

If the user chooses "blue"

c)

All of the above

d)

None of the above

20.

Which of the following programs follows the flowchart here?

a)
b)
c)
21.

In this program, there are several variables and If and statements. Check ALL of the lines that will be said by the program after the code is run.

a)

"Cool!"

b)

"Mindblowing!"

c)

"Sweet!"

d)

"Far out!"

22.

Which of these best describes when you want to use a conditional?

a)

When you want to repeat some code

b)

When you want to save a value

c)

When you want the program to do different things depending on user input

d)

When you want to add a certain amount to your variable

23.

Which of these is NOT a conditional?

a)

If-else

b)

If-And

c)

If statement

d)

For Counter

24.

Which line of code here has an error?

a)

1

b)

3

c)

5

d)

6

25.

To check if two values are the same, you need the (a)   sign.

26.

I have a program that has two variables, day and month. day tells you which # day it is, while month tells you which #r month it is. (Ex, for May 20 the month would be 5 and the day would be 20) Which kind of conditional would I need to check if today is Christmas?

a)

If else

b)

If

c)

If And

d)

For Counter

27.

I want to write a program that if the day is a friday, the program says "TGIF!" and if it isn't, it says "Hang in there!" What kind of conditional do I need?

a)

If else

b)

If

c)

If And

d)

For Counter

28.

I want to write a program so that if the user gets to 100 points, the program says "Congrats!" Which conditional should use?

a)

If else

b)

If

c)

If And

d)

For Counter

29.

Which of the following variable declarations are right?

a)

var 10 =10;

b)

var num = 10;

c)

var name = "Bob";

d)

var number 10 = 10;

30.

What is the value of x here?

(a)  

31.

What is the value of z?

(a)  

32.

Is this statement true or false? ( write true or false)

(a)  

33.

Is this statement true or false? (write true or false)

(a)  

34.

Is this statement true or false? (Write true or false)

(a)  

35.

Which statement will be printed to the console?

a)

I am 5

b)

I am not 5

c)

I'm not sure

d)

Nothing will be printed

36.

Which of these statements will be printed?

a)

I am less than or equal to 10

b)

I am none of the options

c)

I am 5

37.

What will be printed to the console?

a)

You are in elementary school

b)

You are in high school

c)

You are in some other school

38.

What will be printed to the console?

a)

You passed

b)

You failed

c)

None of the options

39.

What will be printed to the console log?

a)

You got the average

b)

You failed

c)

Congrats you get ice cream!

40.
If x has the value 12, Java will only evaluate the left side of the compound expression in the statement: if (x > 1 && x < 10)
a)
True
b)
False
41.

Match the following

a)

!

1.

Not

b)

||

2.

or

c)

&&

3.

and

d)

Logical Operator

4.

A symbol or word used to connect two or more expressions

e)

An expression that produces a true or false when evaluated

5.

Boolean Expression

42.

Any expression that can be evaluated for true or false is known as a ________ __________.

(a)  

43.

3 < 8 evaluates to? ​ (a)  

Choose from the below words
TRUE
FALSE
Boolean Value
Neither True or False
==
!
||
44.

Evaluate the expression for a Boolean Value