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

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

View

What happens when two variables with the same name are declared in different scopes?

View

What is the scope of a variable declared using let inside a block?

View

If a variable is not declared inside any function or block, what is its scope?

View

Which variable declaration type can cause hoisting issues?

View

What will be the result of this code? var a = 10; function test() { var a = 20; console.log(a); } test();

View

What happens if a variable declared with let is accessed before its initialization?

View

In JavaScript, the this keyword inside a regular function refers to what by default?

View

What is the scope of a variable declared with const inside a block?

View

What is the result of the following code? let x = 5; { let x = 10; } console.log(x);

View

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

Global
Block
Function
Local

What happens when two variables with the same name are declared in different scopes?

Both are considered global variables
One shadows the other based on the scope
It results in an error
Both are overwritten

What is the scope of a variable declared using let inside a block?

Global
Function
Block
Local

If a variable is not declared inside any function or block, what is its scope?

Block
Function
Global
Local

Which variable declaration type can cause hoisting issues?

var
let
const
Arrow functions

What will be the result of this code? var a = 10; function test() { var a = 20; console.log(a); } test();

10
20
Undefined
Error

What happens if a variable declared with let is accessed before its initialization?

It returns undefined
Throws a ReferenceError
Returns null
Logs NaN

In JavaScript, the this keyword inside a regular function refers to what by default?

Global object
Function object
The parent object
Window object

What is the scope of a variable declared with const inside a block?

Global
Block
Function
Local

What is the result of the following code? let x = 5; { let x = 10; } console.log(x);

10
5
Undefined
Error