Quiz: Variables

Question 1:

What is the output?

var a;
console.log(a);

Reference Error: a is not defined

undefined

0

""

----o----

Question 2:

What is the output?

let a;
console.log(a);

Reference Error: a is not defined

undefined

0

""

----o----

Question 3:

What is the output?

const a;
console.log(a);

SyntaxError: Missing initializer in const declaration

undefined

SyntaxError: Unexpected identifier

""

----o----

Question 4:

What is the output?

var a = 10;

{
  var a = 20;
}

console.log(a);

undefined

SyntaxError: a is already registered

20

10

----o----

Question 5:

What is the output?

var a = 3;
var a;
console.log(a);

3

undefined

null

""

----o----

Question 6:

What is the output?

var a;
let a;
console.log(a);

""

0

undefined

SyntaxError: Identifier 'a' has already been declared

----o----

Question 7:

What is the output?

console.log(a);
var a = 6;

undefined

ReferenceError: a is not defined

6

None of these