NEW
Font size
WorksheetsJavaScript Quiz 2
Total questions: 20
Worksheet time: 10mins
In coding, a variable is used to:
Store a value in memory
Draw shapes
Store a value that does not change
Display the result of a math equation
What is a list of steps you can follow to finish a task?
Program
Code
Bug
Algorithm
What is an error in a program that prevents a program from running as expected?
Program
Code
Bug
Algorithm
What are statements that are only run if something is true?
Program
Conditionals
Bug
Algorithm
When drawing in JavaScript, the coordinates for the top left of the screen are ___.
(0, 400)
(0, 0)
(400, 0)
(400, 400)
The command: ellipse(200,100, 20, 20) will draw:
a rectangle whose center is is at (200,100) and is 20 pixels wide and 20 pixels tall
a circle whose center is at (20,20) and 200 pixels wide and 100 pixels tall
a circle whose center is at (200, 100) and is 20 pixels wide by 20 pixels tall
a rectangle whose center is at (20, 20) and is 200 pixels wide by 100 pixels tall
The code below will:
Draw a circle
Draw many circles according to the mouse position
Draw many circles diagonally across the screen
Draw many circles in the center of the screen
The code background(rgb(100,0,0)) will color the background in:
red
green
blue
black
After running the code to the right, what will be displayed?
x
3
15
Nothing will be displayed
Which of the following represents a comment in JavaScript?
<!---------->
//
/
#
A condition is ___.
any expression that evaluates to True or False.
a built-in function that assigns a Boolean value to a variable.
a formula executed for a result.
an operand that indicates both conditions are True or False.
Which variable is named incorrectly?
4sides
sides_four
sides4
sidesFour
In which direction will the sprite move?
plane.x = plane.x + 2
left
right
up
down
In which direction will the sprite move?
bee.y = bee.y - 2
left
right
up
down
Which sprite property would you change to make the sprite grow in size?
sprite.x
sprite.y
sprite.scale
sprite.rotation
Which sprite property would you change to make the sprite turn in a circle?
sprite.x
sprite.y
sprite.scale
sprite.rotation
When calling sprite.IsTouching(target) and you increase the score, why could the score go up many numbers at once?
Because the draw() function is a loop and the two sprites are touching many times.
The score only goes up once. The sprites only touch once.
The program knows that I don't want to increase the score just by one and gives me a larger number because it thinks it's better to use larger numbers.
Because the sprite doesn't actually touch once the code sprite.visible = false is run.
What's the difference between var sprite, and var x?
With a sprite you will need to call createSprite()
With a sprite you will need to call setAnimation( )
the variable x is only used to hold a value that can be changed.
all of the above.
The code if(keyDown("up")) will have a boolean value of
true if the user presses the down key
false if the user presses the down key
true if the user presses the up key
false if the user presses the up key
In the draw loop, if you call the text function before the drawSprites and/or background function, what happens?
You won't be able to see your text because the sprites and background will be drawn on top of the text.
You will be able to see your text because Game Lab knows you want to see the text.
You won't be able to see your sprites or background because order doesn't matter.
You will be able to see your text because the sprites and the background will be drawn after the text.
