Javascript quiz on variables



Check these javascript variables MCQs (multiple choice questions) and quiz for free and evaluate your expertise on JS variables. This MCQ test covers topics like declaration and initialization of JS variables - var, let, and const.


Instructions

Topic- JS variables

The test consists of 14 questions.

No negative marking for this test.

No Time limit

The pass percentage is 70%

The correct answer with a description will be displayed after the answer has been marked.

Submit the test to calculate your score once you are done with all the questions.

Complexity Level- Moderate




Q1: Variables defined with let cannot be redeclared.

Select True or False.











Q2: Select whether the below JS code is valid or not:

let x = "Hello Peter Doe";
let x = 0;











Q3: Select whether the below JS code is valid or not:

var x = "John Doe";
var x = 0;











Q4: Variables defined with const cannot be Reassigned.

Select True or False:











Q5: Variables defined with const can be Redeclared.

Select True or False:











Q6: Select whether the below JS code is valid or not:

const PI = 3.141592653589793;
PI = 3.14;














Q7: Select whether the below JS code is valid or not:

const PI = 3.141592653589793;
PI = PI + 10;














Q8: A value must be assigned to a const variable when it is declared

Select True or False:














Q9: Select whether the below JS code is valid or not:

const PI;
PI = 3.14159265359;














Q10: Select whether the below JS code is valid or not:

const cars = ["Ford", "Honda", "BMW"];
cars[0] = "Nissan";














Q11: Select whether the below JS code is valid or not:

const cars = ["Ford", "Honda", "BMW"];
cars = ["Toyota", "Skoda", "Audi"];














Q12: Select whether the below JS code is valid or not:

var x = 2;
var x = 3;














Q13: Select whether the below JS code is valid or not:

const x = 2;

{
const x = 3;
}

{
const x = 4;
}















Q14: What will be the console output of the below javascript code?

const a=34;
let b=56;
console.log(a=b);