WorksheetsVariables and Conditionals review
Total questions: 20
Worksheet time: 10mins
What is a word we set that contains a specific type of data that we use to keep track of information in our code
Variable
Conditional
Object
Method
The information that’s stored inside a variable, such as a number or a name, is called what?
Variable
Value
Object
Conditional
Which word is the variable name in this line of code: var steps = 2;
var
steps
2
;
What word is the variable name in this line of code: var enemy = hero.findNearestEnemy();
findNearestEnemy
hero
enemy
var
What word is the variable name in this line of code: var friend = "George";
"George"
var
=
friend
What is the value in this line of code? var steps = 3;
var
steps
3
;
What is the value in this line of code: var friend = "George";
friend
var
"George"
;
What is a tool that checks conditions to help us plan ahead and make decisions in our code?
Variable
Conditional
Object
Argument
Which line of code will find the nearest friend and save their name as the variable "friend" (must be written correctly)
var friend = hero.findNearestFriend();
var enemy = hero.findNearestEnemy();
hero.findNearestFriend();
var ally = findNearestFriend();
An if statement is also called a what?
Object
Method
Variable
Conditional
What is this an example of: var enemy = "Joker";
Variable
Conditional
Object
Method
How would you reassign this variable to a value of 5: var steps = 2;
var steps = 5
var newStep = 5;
steps = 3;
steps = 5;
What is this an example of?
Value
Method
Variable
Conditional
When writing an else conditional, what does the word "else" replace?
the action
the second if statement
all of the if statements
the numbers
When will the code do the action in under "else"
When distance > 3 is true
When distance > 3 is false
When distance = 5
If the enemy is 4 steps away, what will the hero do?
cast earth wave
cast earth pit on the nearest enemy
cast illusion mist on the nearest enemy
move right
What will the hero do if pathFree === true
move right then up
move left then up
move up then right
move up then left
If the enemy is 2 steps away, what will the hero do?
cast earth wave
cast earth pit on the nearest enemy
cast illusion mist on the nearest enemy
move right
What is wrong with this conditional?
the actions are written incorrectly
there are no parentheses
there are no curly brackets
there are spelling errors
How would you reassign this variable to find the new nearest enemy: var nearestEnemy = hero.findNearestEnemy();
var enemy = hero.findNearestEnemy();
friend = hero.findNearestEnemy();
nearestEnemy = hero.findNearestEnemy();
var nearestEnemy = hero.findNearestEnemy();
