
JavaScript Function Closures Quiz

Quiz
•
Computers
•
5th Grade
•
Medium
Tanvir Hossain
Used 1+ times
FREE Resource
Student preview

8 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a closure in JavaScript?
A method to create global variables.
A way to define a function inside another function.
A type of variable that can only be used inside a function.
A function that can access its parent scope even after the parent function has closed.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens to local variables when a function is finished?
They are deleted.
They become global variables.
They are stored in memory forever.
They can be accessed by other functions.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of a self-invoking function?
To create a function that runs only once.
To increase the performance of the code.
To create multiple functions at once.
To define global variables.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will happen if you create a variable without a declaration keyword?
It will be undefined.
It will cause an error.
It will be a local variable.
It will always be a global variable.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you protect a variable from being changed by other code?
By defining it inside a loop.
By using a closure.
By using the var keyword.
By declaring it as a global variable.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the lifetime of a global variable?
Only while the function is running.
Until the page is discarded.
Until the variable is deleted.
Until the browser is closed.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the 'this' keyword refer to in a function?
The current object the function is being executed in.
The global scope.
The parent function.
The first argument of the function.
8.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the main issue with using a global counter variable?
It will cause an error if modified.
It cannot be accessed by functions.
Any code can change it without permission.
It will always be undefined.
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
Appointment Passes Review

Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
20 questions
Grammar Review

Quiz
•
6th - 9th Grade