What is the result of the following code snippet?
A). A. SyntaxError
B). B. ReferenceError
C). C. TypeError
D). D. No error
What is the behavior of accessing a let variable before its declaration in JavaScript?
A). A. SyntaxError
B). B. ReferenceError
C). C. undefined
D). D. No error
How does hoisting differ between let and var declarations in JavaScript?
A). A. Both let and var variables are hoisted with their initial values
B). B. let variables are hoisted with their initial values, var variables are hoisted with undefined
C). C. let variables are not hoisted, var variables are hoisted with their initial values
D). D. Hoisting behavior is the same for let and var declarations
What is the behavior of accessing a const variable within a function before its declaration in JavaScript?
A). A. ReferenceError is thrown
B). B. SyntaxError is thrown
C). C. undefined is printed
D). D. No error
What is the behavior of accessing a const variable before its declaration in a nested block in JavaScript?
A). A. ReferenceError is thrown
B). B. SyntaxError is thrown
C). C. undefined is printed
D). D. No error
What is the behavior of accessing a var variable within a block before its declaration in JavaScript?
A). A. ReferenceError is thrown
B). B. SyntaxError is thrown
C). C. undefined is printed
D). D. No error
What is the output of the following code snippet?
A). A. TypeError
B). B. 10
C). C. undefined
D). D. SyntaxError
What happens if you declare a const variable with the same name as an existing variable in JavaScript?
A). A. SyntaxError is thrown
B). B. The existing variable is reassigned
C). C. ReferenceError is thrown
D). D. TypeError is thrown
How does hoisting affect const declarations in JavaScript?
A). A. const variables are hoisted with their initial values
B). B. const variables are hoisted but cannot be accessed before declaration
C). C. const variables are hoisted and can be accessed before declaration
D). D. Hoisting does not affect const declarations
What is the purpose of the Temporal Dead Zone (TDZ) in JavaScript?
A). A. To prevent variable reassignment
B). B. To catch errors at compile time
C). C. To ensure variables are initialized before use
D). D. To reduce memory usage