Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

Which of the following is an anonymous function?

View

What is the key difference between a function declaration and a function expression?

View

What does the following code print? var myFunc = function() { return "Hello"; }; console.log(myFunc());

View

Where are anonymous functions typically used in JavaScript?

View

Can function expressions be named?

View

What happens if you try to call a function expression before it is defined?

View

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

View

What is an advantage of using anonymous functions?

View

Which of the following is false about function expressions?

View

What does the following code print? let square = function(num) { return num * num; }; console.log(square(4));

View

Which of the following is an anonymous function?

function myFunc() {}
const myFunc = function() {}
function() {}
const myFunc = () => {}

What is the key difference between a function declaration and a function expression?

Function expressions are not hoisted
Function declarations must be named
Function expressions cannot accept parameters
Function declarations return undefined

What does the following code print? var myFunc = function() { return "Hello"; }; console.log(myFunc());

"Hello"
myFunc
undefined
Error

Where are anonymous functions typically used in JavaScript?

Inside loops
As function arguments (callbacks)
As variable declarations
Inside if-else statements

Can function expressions be named?

Yes
No
Only in strict mode
Only in classes

What happens if you try to call a function expression before it is defined?

It works normally
It throws a ReferenceError
It logs undefined
It behaves like a function declaration

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

const myFunc = function() {}
function myFunc() {}
const myFunc = function foo() {}
const myFunc = () => {}

What is an advantage of using anonymous functions?

They are hoisted
They provide more readable code
They make code modular
They are easy to use in callbacks and IIFEs

Which of the following is false about function expressions?

They can be anonymous
They are hoisted
They can be assigned to variables
They can have names

What does the following code print? let square = function(num) { return num * num; }; console.log(square(4));

4
8
16
undefined