Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Javascript Function Quiz

Total questions: 11

Worksheet time: 6mins

Name
Class
Date
1.

What is abstraction in the context of JavaScript functions?

a)
It is a process of hiding the implementation details and showing only the functionality
b)
It is a process of creating new data types
c)
It is a process of converting one data type to another
d)
It is a process of creating multiple copies of a function
2.

When you invoke a function, which of the following is true about generalization?

a)
Generalization is the process of invoking a function
b)
Generalization is the process of making something more general
c)
Generalization is the process of defining a function
d)

The function can accept multiple arguments and provide more generalized functionality.s

3.

What does a JavaScript function typically return if there is no explicit return statement?

a)

undefined

b)

null

c)

The value of the last executed statement inside the function.

d)

An error.

4.

What is hoisting with respect to JavaScript functions?

a)
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their containing scope before code execution.
b)
Hoisting is a JavaScript mechanism for changing the scope of a variable.
c)
Hoisting is a JavaScript mechanism for declaring variables only.
d)
Hoisting is a JavaScript mechanism for executing functions before they are declared.
5.

Which of the following is an example of a function expression?

a)
function myFunction() {}
b)
myFunction() {}
c)

const myFunction = function() {}

d)
myFunction: function() {}
6.

What is an anonymous function in JavaScript?

a)
A function with no name
b)
A function that is not declared
c)
A function that returns null
d)
A function that cannot be called
7.

What does an Immediately Invoked Function Expression (IIFE) do?

a)
It allows to run a function as soon as it is defined
b)
It allows to delay the execution of a function
c)
It allows to repeat the execution of a function
d)
It allows to stop the execution of a function
8.

In JavaScript, what is the scope of a variable declared inside a function (function-level scope)?

a)
Global scope
b)
Block scope
c)
Function-level scope
d)
None of the above
9.

What is the scope chain in JavaScript?

a)
The scope chain in JavaScript is a hierarchy of variable scopes, where each scope is a object that provides a set of variables.
b)
A chain of methods in JavaScript.
c)
A chain of classes in JavaScript.
d)
A chain of functions in JavaScript.
10.

What is a closure in JavaScript?

a)
A closure is a function that has access to its own scope, the outer function’s scope, and the global scope.
b)
A closure is a special kind of object that combines two functions.
c)
A closure is a type of variable in JavaScript.
d)
A closure is a JavaScript keyword used to close a function.
11.

Which of the following is a correct syntax for an arrow function in JavaScript?

a)
function() => {}
b)
() -> {}
c)
function => {}
d)

const myFunction = () => {}