Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

BJC U2L1 Global vs. Local Variables

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

What will the script say?

a)

50, 50, 50

b)

50, 60, 60

c)

50, 60, 50

d)

60, 60, 50

2.

A local variable is

a)

a variable that is limited in scope

b)

is the same as a constant

c)

can be accessed anywhere in the program

d)

is the same as a block

3.

A predicate block will return...

a)

a value of any type

b)

nothing

c)

true or false

d)

a condition

4.

Assuming age is a global variable, what will the script say?

a)

50, 60, 50

b)

50, 50, 50

c)

50, 60, 60

d)

50, 50, 60

5.

A global variable is

a)

accessible inside only one block in a program

b)

accessible by only one sprite in a program

c)

used as an input parameter

d)

accessible anywhere within the program

6.

"i" and "branches" are not global variables. What will the script do at "say i for 3 seconds"?

a)

100 for 3 seconds

b)

error

c)

say 8 for 3 seconds

d)

say 9 for 3 seconds

7.

"a" is not a global variable. I will execute script 1. What happens when I execute script 2?

a)

... 3

b)

... 5

c)

error

d)

Nothing - need a hat block first

8.

I click on script 1. "a" is a global variable set to 5.

I click on script 2.

What happens if I click on script 3?

a)

3

b)

5

c)

error

d)

nothing

9.

x is a global variable. What will the script say?

a)

error

b)

nothing - x is undefined

c)

x is 5

d)

x is 10

10.

x is a global variable. What will script 1 say?

a)

x is 5

b)

x is 10

c)

x is 15

d)

error

11.

Which of these is not a "true berry"?

a)

blackberries

b)

gooseberries

c)

peppers

d)

tomatoes