Array And Function - Study Mode
[#6] What is a closure?
Correct Answer
(C) Both Function objects and Scope where function’s variables are resolved
Explanation
Solution: A combination of a function object and a scope (a set of variable bindings) in which the function’s variables are resolved is called a closure.
[#7] Which of the following are examples of closures?
Correct Answer
(D) All of the mentioned
Explanation
Solution: Technically, all JavaScript functions are closures: they are objects, and they have a scope chain associated with them.
[#8] Which of the following uses a lot of CPU cycles?
Correct Answer
(C) Dynamically generated graphics
Explanation
Solution: Dynamically generating graphics from real-time data uses a lot of CPU cycles.
[#9] What is the fundamental rule of lexical scoping?
Correct Answer
(B) Functions are executed using scope chain
Explanation
Solution: The fundamental rule of lexical scoping is that the JavaScript functions are executed using the scope chain that was in effect when they were defined.
[#10] What is the opposite approach to the lexical scoping?
Correct Answer
(C) Dynamic scoping
Explanation
Solution: The opposite approach to the lexical scoping is the dynamic scoping.