BJC U2L1 Global vs. Local Variables

BJC U2L1 Global vs. Local Variables

10th Grade - University

11 Qs

quiz-placeholder

Similar activities

Quiz on Variables in Programming

Quiz on Variables in Programming

11th Grade - University

15 Qs

QUARTER3 MOD 1 TO 5

QUARTER3 MOD 1 TO 5

10th Grade

10 Qs

Variables in Scratch

Variables in Scratch

2nd Grade - University

11 Qs

Javascript Basics

Javascript Basics

9th - 12th Grade

16 Qs

Básicas de JavaScript

Básicas de JavaScript

University

10 Qs

TLE Q3 QUIZ MODULES 1-5

TLE Q3 QUIZ MODULES 1-5

10th Grade

10 Qs

Scratch Function from Verbal Description

Scratch Function from Verbal Description

2nd Grade - University

12 Qs

Scratch Parameters

Scratch Parameters

2nd Grade - University

12 Qs

BJC U2L1 Global vs. Local Variables

BJC U2L1 Global vs. Local Variables

Assessment

Quiz

Computers

10th Grade - University

Hard

Created by

TSEE LEE

Used 25+ times

FREE Resource

11 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 10 pts

Media Image

What will the script say?

50, 50, 50

50, 60, 60

50, 60, 50

60, 60, 50

Answer explanation

The custom block (procedure) creates a script variable, which is temporary & exists only for the duration of that block. The script variable is erased from existence when the block finishes.

2.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

A local variable is

a variable that is limited in scope

is the same as a constant

can be accessed anywhere in the program

is the same as a block

Answer explanation

A scope may be a custom block, a script, or the whole program (all scripts & sprites).

A local variable may be a parameter (local to inside the block) or a script variable (local to the connected blocks in that script).

3.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

A predicate block will return...

a value of any type

nothing

true or false

a condition

Answer explanation

Media Image

Boolean values true/false are NOT the words true/false. They're their own data type (cf. number, text, sound, etc.).

4.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

Media Image

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

50, 60, 50

50, 50, 50

50, 60, 60

50, 50, 60

Answer explanation

There's only one copy of the variable age throughout the entire run of the program.

5.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

A global variable is

accessible inside only one block in a program

accessible by only one sprite in a program

used as an input parameter

accessible anywhere within the program

6.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

Media Image

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

100 for 3 seconds

error

say 8 for 3 seconds

say 9 for 3 seconds

Answer explanation

branches is a parameter, a local variable within the scope of the "draw a pinwheel" procedure. It does not exist outside the block.

7.

MULTIPLE CHOICE QUESTION

30 sec • 10 pts

Media Image

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

... 3

... 5

error

Nothing - need a hat block first

Answer explanation

a is a local variable within the scope of the script (connected blocks). It doesn't exist in the second script.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?