Q
What happens when you try to access a variable that has not been declared in JavaScript?

Answer & Solution

Answer: Option B
Solution:
Attempting to access an undeclared variable in JavaScript results in a ReferenceError.
Related Questions on Average

What is the data type of the value NaN in JavaScript?

A). Number

B). String

C). Object

D). Undefined

Which of the following statements is true about primitive data types in JavaScript?

A). They have methods and properties

B). They can be used as keys in objects

C). They are instances of Object

D). They are passed by value

Which of the following is not a primitive value in JavaScript?

A). Number

B). Boolean

C). Object

D). String

What is a primitive value in JavaScript?

A). A complex data structure

B). A basic data type

C). A function

D). An array

Which of the following is a valid JavaScript symbol?

A). symbol

B). &symbol

C). #symbol

D). Symbol('description')

What is the result of the expression true + false in JavaScript?

A). true

B). false

C). 1

D). 0

What is the result of the expression undefined + null in JavaScript?

A). undefined

B). null

C). 0

D). Error

What does the Symbol data type represent in JavaScript?

A). A unique identifier

B). A number

C). A boolean value

D). An object

Which primitive value represents absence of value or no value assigned?

A). undefined

B). null

C). 0

D). 'undefined'

What is the default value of a variable in JavaScript if it is not initialized?

A). null

B). undefined

C). 0

D). 'undefined'