BJC U2L1 Global vs. Local Variables

Quiz
•
Computers
•
10th Grade - University
•
Hard
TSEE LEE
Used 25+ times
FREE Resource
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 10 pts
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
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
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
"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
"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
Similar Resources on Wayground
15 questions
JAVASCRIPT.QUIZ

Quiz
•
University
15 questions
JavaScript Basics

Quiz
•
12th Grade - University
10 questions
TLE Q3 M4

Quiz
•
10th Grade
11 questions
JS Certification

Quiz
•
12th Grade
10 questions
JavaScript

Quiz
•
11th Grade
15 questions
PYTHON UNIT I MCQS

Quiz
•
University
15 questions
Introduction to TypeScript

Quiz
•
12th Grade
10 questions
Java Script

Quiz
•
10th - 12th Grade
Popular Resources on Wayground
15 questions
Hersheys' Travels Quiz (AM)

Quiz
•
6th - 8th Grade
20 questions
PBIS-HGMS

Quiz
•
6th - 8th Grade
30 questions
Lufkin Road Middle School Student Handbook & Policies Assessment

Quiz
•
7th Grade
20 questions
Multiplication Facts

Quiz
•
3rd Grade
17 questions
MIXED Factoring Review

Quiz
•
KG - University
10 questions
Laws of Exponents

Quiz
•
9th Grade
10 questions
Characterization

Quiz
•
3rd - 7th Grade
10 questions
Multiply Fractions

Quiz
•
6th Grade