JavaScript Variables & Hoisting Quiz

Quiz
•
Information Technology (IT)
•
Professional Development
•
Medium
Mohammad Allam
Used 6+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Explain the difference between var, let, and const in terms of scope.
let is function-scoped, var and const are block-scoped.
const is function-scoped, var and let are block-scoped.
var is block-scoped, let and const are function-scoped.
var is function-scoped, let and const are block-scoped. const variables cannot be reassigned.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider this code snippet:
console.log(a); // What will be the output?
var a = 10; console.log(a); // What will be the output?
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is hoisting in JavaScript?
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution.
Hoisting is a JavaScript concept that refers to the process of optimizing code execution for faster performance.
Hoisting is a JavaScript feature that allows variables to be declared without using the 'var' keyword.
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the bottom of their scope before code execution.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider this code snippet:
{
let d = 25;
}
console.log(d); // What will be the output?
ReferenceError
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
When should you use const over let in JavaScript?
When the variable is declared inside a function
When the variable will be reassigned multiple times
When the variable is used in a loop
When the variable will not be reassigned
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the difference between global and local scope in JavaScript?
Global scope variables are only accessible within the function they are declared in.
Global scope variables are accessible from anywhere in the code, while local scope variables are only accessible within the function they are declared in.
Local scope variables are accessible from anywhere in the code.
Global scope variables are limited to a specific block of code.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What type of error happens if you try to access a variable before it is declared in JavaScript?
SyntaxError
TypeError
RuntimeError
ReferenceError
Create a free account and access millions of resources
Similar Resources on Wayground
12 questions
Quiz sobre Sintaxe Básica em C#

Quiz
•
Professional Development
15 questions
Compreensão de Código React Native

Quiz
•
Professional Development
8 questions
Quiz sobre Lógica de Jogo da Cobrinha

Quiz
•
Professional Development
5 questions
14/12/2024 - Array

Quiz
•
Professional Development
5 questions
Who am I

Quiz
•
Professional Development
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Information Technology (IT)
11 questions
All about me

Quiz
•
Professional Development
10 questions
How to Email your Teacher

Quiz
•
Professional Development
15 questions
Fun Random Trivia

Quiz
•
Professional Development
22 questions
Anne Bradstreet 1612-1672

Quiz
•
Professional Development
18 questions
Spanish Speaking Countries and Capitals

Quiz
•
KG - Professional Dev...
14 questions
Fall Trivia

Quiz
•
11th Grade - Professi...
15 questions
Disney Characters Quiz

Quiz
•
Professional Development
15 questions
Quiz to Highlight Q types & other great features in Wayground

Quiz
•
Professional Development