Font size
WorksheetsAP CSP | Conditionals Review
Total questions: 44
Worksheet time: 1hrs 6mins
A program is:
a series of steps to complete a task that a computer can understand.
Python, JavaScript, Java, PHP, and Ruby
the action we want the program to take.
a condition that is false.
Coding is:
Python, JavaScript, Java, PHP, and Ruby
the action of writing instructions for a computer in a language that it can understand.
a language that is more precise than English but less precise than a coding language.
a specific action to be taken if the condition is false.
What is syntax?
a catch-all for every other situation besides true.
pieces of code that direct the program to run in different ways depending on what else is happening.
a set of rules for how a language is written.
English, Chinese, or Spanish.
Control flow statements:
pieces of code that direct the program to run in different ways depending on what else is happening.
determine which code is being carried out at a given time.
give the program the flexibility to go down more than one path.
all of these.
Pieces of code that only run "under certain conditions":
conditional statements
control flow statments
syntax
variables
What is a condition?
JavaScript
Something that has to be true in order for an action to be carried out.
syntax
pseudocode
This is a catch-all for every other situation besides the one where the condition is true.
then
do
else
if
What is/are true about pseudocode?
somewhere between English and a coding language.
more precise than English but less precise than a coding language.
used by programmers to figure out the logic and flow of their programs without having to worry about syntax.
all of these
A variable is...
is a placeholder for a piece of information that can change.
is like a bucket for holding information.
can be written as letters or with longer words.
all of these
Which symbol means "not equal to"?
==
<=
>=
!=
Which of the following is a test statement?
color = sprite.ask("What's your favorite color?")
sprite.say("So your favorite color is " + color.")
if color == "red":
color = "red"
Which of the following best describes what a test statement is?
This part is the code that runs in a conditional if the condition is true
This is the part of the code that checks whether a condition is true or false
This is a code that shows how many times a loop should run
This is a code that saves multiple pieces of information in one place
Which of the following best describes what the nested code part of a conditional is?
This part is the code that runs in a conditional if the condition is true
This is the part of the code that checks whether a condition is true or false
This is a code that shows how many times a loop should run
This is a code that saves multiple pieces of information in one place
How many test statements does this program have?
1
2
3
4
What happens if the user inputs "winter" into the first question in this program?
The background changes to a winter background
The user is asked another question
The sprites says "Sad..."
The sprite says "Me too!"
Which of the following best describes what a flowchart is?
A diagram that shows each step of a process or algorithm
Conventions for making code easier for people to read
The line of code in a conditional that checks if something is true or false.
The line of code in a conditional that's indented over
Which of the following symbols compares two values to see if they are the same?
=
[ ]
==
""
According to the following flow chart, what will happen right after the user chooses "red"?
The sprite will ask "Would you like to choose the red door, or the blue door?"
The sprite will say "You win a car!"
The sprite will say "You win a house!"
The sprite will say "Thanks for playing!"
According to the following flow chart, in what situation will the sprite say "Thanks for playing!"?
If the user chooses "red"
If the user chooses "blue"
All of the above
None of the above
Which of the following programs follows the flowchart here?
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.
"Cool!"
"Mindblowing!"
"Sweet!"
"Far out!"
Which of these best describes when you want to use a conditional?
When you want to repeat some code
When you want to save a value
When you want the program to do different things depending on user input
When you want to add a certain amount to your variable
Which of these is NOT a conditional?
If-else
If-And
If statement
For Counter
Which line of code here has an error?
1
3
5
6
To check if two values are the same, you need the (a) sign.
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?
If else
If
If And
For Counter
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?
If else
If
If And
For Counter
I want to write a program so that if the user gets to 100 points, the program says "Congrats!" Which conditional should use?
If else
If
If And
For Counter
Which of the following variable declarations are right?
var 10 =10;
var num = 10;
var name = "Bob";
var number 10 = 10;
What is the value of x here?
(a)
What is the value of z?
(a)
Is this statement true or false? ( write true or false)
(a)
Is this statement true or false? (write true or false)
(a)
Is this statement true or false? (Write true or false)
(a)
Which statement will be printed to the console?
I am 5
I am not 5
I'm not sure
Nothing will be printed
Which of these statements will be printed?
I am less than or equal to 10
I am none of the options
I am 5
What will be printed to the console?
You are in elementary school
You are in high school
You are in some other school
What will be printed to the console?
You passed
You failed
None of the options
What will be printed to the console log?
You got the average
You failed
Congrats you get ice cream!
!
Not
||
or
&&
and
Logical Operator
A symbol or word used to connect two or more expressions
An expression that produces a true or false when evaluated
Boolean Expression
Any expression that can be evaluated for true or false is known as a ________ __________.
(a)
3 < 8 evaluates to? (a)
Evaluate the expression for a Boolean Value
