JavaScript Institute Functions and Scope Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Thames
T
Thames
Community Contributor
Quizzes Created: 11982 | Total Attempts: 187,298
| Questions: 21 | Updated: Aug 15, 2026
Please wait...
Question 1 / 22
🏆 Rank #-- ▾
0 %
0/100
Score 0/100

1. True or False: Arrow functions have their own 'this' binding.

Explanation

Arrow functions do not have their own `this` binding. Instead, they inherit `this` from the surrounding scope where they are defined, so their `this` value cannot be changed by calling them with a different context.

Submit
Please wait...
About This Quiz
JavaScript Institute Functions and Scope Quiz - Quiz

This quiz evaluates your understanding of functions and scope in JavaScript, core concepts for the JSE and JSA certifications. You'll test your knowledge of function declarations, expressions, closures, variable scope (global, local, function, block), and how the JavaScript engine manages execution contexts. Master these fundamentals to write efficient, bug-free code... see moreand advance your JavaScript proficiency. see less

2.

What first name or nickname would you like us to use?

You may optionally provide this to label your report, leaderboard, or certificate.

2. How does JavaScript determine which variable to use when the same name exists in multiple scopes?

Explanation

JavaScript resolves variable names by searching the current scope first, then moving outward through enclosing scopes. It uses the first matching declaration it finds, so a variable in a nearer scope shadows one with the same name in an outer scope.

Submit

3. True or False: Block scope (let/const) is available in all JavaScript environments.

Explanation

Block-scoped declarations using `let` and `const` were introduced in ECMAScript 2015 (ES6). Older JavaScript environments may not support them, though transpilers can convert code for compatibility. Therefore, block scope is not available in every JavaScript environment.

Submit

4. A function that returns another function is called a ____ function.

Explanation

A function that returns another function is called a higher-order function. Higher-order functions can also take functions as arguments, making it easier to compose and reuse behavior.

Submit

5. What is variable shadowing in JavaScript?

Explanation

Variable shadowing occurs when a variable declared in an inner scope has the same name as a variable in an outer scope. Within the inner scope, references to that name refer to the inner variable, temporarily hiding the outer one.

Submit

6. Which of the following creates a new function scope?

Explanation

A function declaration introduces a function body, which creates its own function scope for parameters and locally declared variables. By contrast, `if`, `for`, and `switch` statements do not create function scopes; they may create block scopes when variables are declared with `let` or `const`.

Submit

7. The scope chain in JavaScript is resolved from ____ to ____.

Explanation

JavaScript resolves a variable by first searching the current, innermost scope. If it is not found there, the search moves outward through enclosing scopes, continuing toward the global scope until the identifier is found or no scope remains. Thus, scope resolution proceeds from inner to outer.

Submit

8. True or False: const variables can be reassigned if they contain an object.

Explanation

A `const` variable cannot be reassigned, even when it refers to an object. However, the object’s properties can still be changed; `const` protects the reference, not the object’s contents.

Submit

9. What happens when you reference a variable that doesn't exist in local or parent scopes?

Explanation

Referencing an undeclared variable causes JavaScript to throw a `ReferenceError` because it cannot find the variable in the current or any enclosing scope. It does not create a global variable or simply return `undefined`.

Submit

10. A nested function that accesses variables from its outer function creates a ____.

Explanation

A closure is formed when a nested function retains access to variables from its outer function, even after the outer function has finished executing. This lets the nested function use the surrounding variables later.

Submit

11. Which statement about global scope is correct?

Explanation

Variables declared in the global scope can generally be accessed by functions throughout the program, unless a local variable or other scope rule shadows them. Global scope is not created inside each function, and global variables are not inherently immutable.

Submit

12. What is the primary purpose of function scope in JavaScript?

Explanation

Function scope confines variables declared within a function to that function, preventing them from being accessed or changed elsewhere. This encapsulation reduces accidental interference between parts of a program and helps prevent naming conflicts with variables in other functions or the global scope.

Submit

13. Parameters in a function are scoped to the ____.

Explanation

Parameters are variables that receive values when a function is called. They are accessible within that function’s body, but not outside it unless their values are returned or otherwise shared. This is called function scope.

Submit

14. What is the key difference between 'return' and 'return undefined' in a function?

Explanation

In JavaScript, a bare `return` immediately ends the function and implicitly returns `undefined`. Writing `return undefined` also ends the function and explicitly returns that same value, so their observable return values are identical.

Submit

15. Which of the following best describes the 'this' keyword in a regular function?

Explanation

When a regular function is called as a standalone function, its `this` value is the global object in non-strict mode and `undefined` in strict mode. Its value can differ when the function is called as a method or with `call`, `apply`, `bind`, or `new`, so it depends on how the function is invoked.

Submit

16. True or False: Function declarations are hoisted to the top of their scope.

Explanation

True. Function declarations are hoisted within their scope, so they can generally be called before the point where they appear in the code. This differs from function expressions, whose availability depends on how the variable holding them is declared and initialized.

Submit

17. A function expression assigned to a variable can be invoked using the ____ name.

Explanation

When a function expression is assigned to a variable, that variable holds a reference to the function. You can invoke the function by using the variable’s name followed by parentheses, such as `myFunction()`.

Submit

18. What is the scope of a variable declared with 'var' inside a function?

Explanation

A variable declared with `var` inside a function is accessible throughout that function, including before its declaration due to hoisting. It is not limited to the block in which it appears. Outside the function, it cannot be accessed.

Submit

19. In JavaScript, variables declared with 'let' are scoped to the ____.

Explanation

Variables declared with `let` are accessible only within the block—such as the code between `{}`—where they are defined. They cannot be accessed outside that block, unlike `var` variables, which may be scoped to a function.

Submit

20. What does a closure allow a function to do?

Explanation

A closure preserves access to variables in the scope where a function was created. This lets the function continue using those variables even after the parent function has finished executing.

Submit

21. Which keyword declares a function that can be hoisted before its definition?

Explanation

The `function` keyword creates a function declaration, which is hoisted in JavaScript. This means the function can be called earlier in the same scope, even before its declaration appears in the code. By contrast, functions assigned to `const`, `let`, or `var` variables are not available in the same way before initialization.

Submit
×
Saved
Thank you for your feedback!
View My Results
Cancel
  • All
    All (21)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
True or False: Arrow functions have their own 'this' binding.
How does JavaScript determine which variable to use when the same name...
True or False: Block scope (let/const) is available in all JavaScript...
A function that returns another function is called a ____ function.
What is variable shadowing in JavaScript?
Which of the following creates a new function scope?
The scope chain in JavaScript is resolved from ____ to ____.
True or False: const variables can be reassigned if they contain an...
What happens when you reference a variable that doesn't exist in local...
A nested function that accesses variables from its outer function...
Which statement about global scope is correct?
What is the primary purpose of function scope in JavaScript?
Parameters in a function are scoped to the ____.
What is the key difference between 'return' and 'return undefined' in...
Which of the following best describes the 'this' keyword in a regular...
True or False: Function declarations are hoisted to the top of their...
A function expression assigned to a variable can be invoked using the...
What is the scope of a variable declared with 'var' inside a function?
In JavaScript, variables declared with 'let' are scoped to the ____.
What does a closure allow a function to do?
Which keyword declares a function that can be hoisted before its...
play-Mute sad happy unanswered_answer up-hover down-hover success oval cancel Check box square blue
Alert!