Search Header Logo

Game Lab - Variables

Authored by Tim Helland

Computers

7th - 12th Grade

Used 28+ times

Game Lab - Variables
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE SELECT QUESTION

45 sec • 1 pt

Choose all of the blocks that create a new variable in Game Lab.

Media Image
Media Image
Media Image
Media Image

Answer explanation

To create a variable, the JavaScript keyword var should be present. Otherwise, you are attempting to use an existing variable.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Every block in Game Lab represents a piece of Javascript code.

True

False

Answer explanation

When you use blocks in Game Lab, you are really dragging around pieces of Javascript code.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the final value of x when this program runs?

3

4

0

Nothing. An error will occur.

Answer explanation

Media Image

This is valid code. x will have the same value as y because of the last code block.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What should be changed about this code?

Nothing. It is the best way to write this code.

The blocks should be reordered.

The variable names don't match.

You must always set a variable to equal a number.

Answer explanation

Media Image

The blocks should be reordered so that x is defined before it is used in other blocks.


A variable should be declared with the var keyword before it is used elsewhere.


Note: Due to how Javascript works, this code will run either way. But, it is best practice to reorder these blocks.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which statement is most accurate about this code?

The program will not run.

The ellipse is very wide.

The ellipse is at the right.

The ellipse is at the left

The ellipse is very tall.

Answer explanation

Media Image

The correct code should have been to put width in the 3rd spot.



But, it will still work as is. The "x" value of the ellipse will be 400. This moves it to the far right.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is wrong with this code?

x has been declared more than once using var.

Values should not exceed 100.

Nothing. It is perfectly fine as is.

Answer explanation

Media Image

The correct code should look like this.


You should only declare the same variable one time using the var keyword.


Note: This won't show an error in Game Lab, but it isn't correct.

Access all questions and much more by creating a free account

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?