
JavaScript Function Closures Quiz
Quiz
•
Computers
•
5th Grade
•
Practice Problem
•
Medium
Tanvir Hossain
Used 4+ 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.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade