wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

coding variables

Total questions: 28

Worksheet time: 1hrs 15mins

Name
Class
Date
1.

Programming is when humans write computer instructions

a)

true

b)

false

2.

A computer needs correct syntax to understand code

a)

True

b)

False

3.

_______ are the rules for writing code

a)

Syntax

b)

Loops

c)

Variables

d)

Functions

4.

variables have names

a)

true

b)

false

c)

optional

5.

A _________ holds your data for later

a)

syntax

b)

Expression

c)

Variable

d)

Value

6.

A variable is just a _____ for storing a____

a)

constant; value

b)

container; value

c)

constant; variable

d)

container; variable

7.

What is the purpose of a variable?

a)

To store data, and give it a name for later use

b)

To replace numbers

c)

To make algebra work

d)

show the x axis or y axis

8.

The operator to assign values?

a)

==

b)

<==

c)

=

d)

new

9.

______ is a type of data that represents text

a)

Basic

b)

Syntax

c)

Argument

d)

String

10.

Words that signal to the computer that you are about to create a variable in Javascript or Java ?

a)

var

b)

con

constant

c)

new

class

function

d)

score

x

y

11.

Match the following

a)

javaScript

1.

coding language

b)

variable

2.

data storage

c)

10

3.

a number value of ten

d)

=

4.

assignment operator

e)

"10"

5.

A string value "10"

12.

what can we store in a JavaScript variable?

a)

food storage

example

tupperware

b)

strings

example

"abc"

c)

objects

example:

new Circle()

d)

boolean

example:

true

e)

numbers

example

3

13.

Select 2: Why create variables with precise names?

a)

Write code understandable to others or yourself later in time

b)

Avoid duplicate names or reserved words in a language

c)

Create long names as a form of cryptic encoding

d)

Short names are always bad

14.

join a string "your heath points: " with variable hp

a)

concatenation

b)

+

c)

++

d)

merge

15.

var s = "1";

var i = "3";

var t = s + i;

// what is stored in variable t?

(a)  

16.

print( "health points: " + hp );

// what describes the + operator?

a)

+

syntax error

b)

+

add hp points

c)

+

increment points

d)

concatentation

17.

radius is a property of what?

a)

Circle object

b)

Circle and Rectangle

c)

Image

d)

Image and Circle

18.

The screen area where JavaScript circles can be drawn on screen

a)

canvas

b)

area

c)

radius

d)

HD

19.

coordinates that best match the red dot in the image

a)

canvas.width/2

,

canvas.height/2

b)

canvas.width

,

canvas.height

c)

(y,x)

d)

axis_y, axis_x

20.

var planet = new circle();

planet.draw()

//are there bugs here?

a)

must use animate

b)

missing x,y values

c)

Make C

in Circle

UPPERCASE

d)

missing radius

21.

dot.draw()

// what is .draw() most like?

a)

noun

b)

verb

c)

adjective

d)

doing

nothing

22.

alien = new image();

alien.x = 200;

alien.y = 200;

alien.name =  "monster1.png";

monster.draw();

// what code revisions fix the bugs above

a)

alien = monster.png

b)

draw image()

c)

var alien= new Image()

alien.draw()

d)

("alien.png")

23.

what clue shows x is assigned a literal string value 3

a)

quotes

"3"

b)

var = new Literal

c)

colon

3: 3

d)

var x = syntax

24.

Defining variable for the first time.

a)

Declare a Variable

b)

Variable

c)

Console

d)

readLine

25.

var ship = new Circle(40,40);

ship.radius = 30;

a)

30 is a value

b)

ship is an object

c)

radius is a property of ship

d)

objects are properties

26.

var ship = {

shields: 40,

seats: 10,

fuel: 0,

}

a)

40 and 10 are properties

b)

seats is a property

c)

there are 4 properties

d)

40 and 10 are values

27.

var morgan = {

eyeColor: "brown",

age : 10,

walletValue: 0,

}

a)

age and eyeColor

1.

properties

b)

zero && brown

2.

values

c)

object name

3.

morgan

d)

var x = {}

4.

declare object literal x

28.

var pat = {

humor: "good",

age : 40,

pronoun: "they",

}

a)

they good

1.

values

b)

object name

2.

pat

c)

humor, pronoun

3.

properties

d)

var x = {}

4.

declare object literal x