WorksheetsJavaScript Quiz 1
Total questions: 30
Worksheet time: 15mins
Which type of JavaScript value is described as having fixed values?
Variables
Functions
Literals
Objects
Which type of JavaScript value is described as having variable values?
Literals
Variables
Constants
Arrays
What is the correct way to declare a constant variable in JavaScript?
let x = 5;
const fname = "John";
var y = 10;
static z = 20;
How does JavaScript interpret the keyword "let"?
It interprets "LET" and "Let" as "let".
It only interprets "let" as "let".
It interprets "LET" as "let".
It interprets "Let" as "let".
What are variables identified with in JavaScript?
Numbers
Unique names called identifiers
Symbols
Reserved words
Why can't reserved words be used as JavaScript identifiers?
They are too long
They are case sensitive
They are JavaScript keywords
They contain special characters
What type of scope do variables declared with 'let' have?
Global Scope
Function Scope
Block Scope
Module Scope
Can variables declared with 'let' be redeclared in the same scope?
Yes, always
No, never
Only in strict mode
Only in non-strict mode
Before ES6, what types of scope did JavaScript have?
A) Block Scope and Global Scope
B) Global Scope and Function Scope
C) Function Scope and Block Scope
D) Block Scope and Local Scope
What happens to variables declared inside a block in JavaScript?
A) They can be accessed from anywhere in the code.
B) They cannot be accessed from outside the block.
C) They are automatically global variables.
D) They are converted to constants.
What scope do variables declared with the 'var' keyword always have?
Local Scope
Block Scope
Global Scope
Function Scope
Can variables declared with the 'var' keyword have block scope?
Yes, always
No, never
Only in functions
Only in loops
What is a key difference between variables declared with "let" and "var"?
Variables with "let" can be redeclared, but "var" cannot.
Variables with "var" can be redeclared, but "let" cannot.
Both "let" and "var" variables can be redeclared.
Neither "let" nor "var" variables can be redeclared.
Which of the following statements is true about variables declared with "let"?
They can be redeclared within the same scope.
They cannot be redeclared within the same scope.
They must be initialized at the time of declaration.
They are function-scoped.
What happens if you try to redeclare a variable using "let" in the same scope?
The variable is overwritten.
An error is thrown.
The variable is ignored.
The variable is automatically converted to "var".
What is a characteristic of variables defined with the 'const' keyword in JavaScript?
They can be redeclared
They can be reassigned
They have block scope
They are automatically global
Which of the following statements is true about 'const' variables in JavaScript?
They can be redeclared in the same scope
They can be reassigned new values
They cannot be reassigned
They are function-scoped
What does the 'Number' data type represent?
A unique and primitive identifier
A data type representing true or false
A number representing a mathematical value
A primitive variable with no assigned value
Which of the following is an example of a String in JavaScript?
let length = 16;
let color = "Yellow";
let x = true;
const cars = ["Saab", "Volvo", "BMW"];
What is the correct way to declare a BigInt in JavaScript?
let x = 1234567890123456789012345n;
let x = "1234567890123456789012345";
let x = 1234567890123456789012345;
let x = BigInt("1234567890123456789012345n");
Which of the following represents a Boolean value in JavaScript?
let x = 1234567890123456789012345n;
let x = true;
const date = new Date("2022-03-25");
const x = Symbol();
What is the correct way to declare a Date object in JavaScript?
const date = new Date("2022-03-25");
let x = null;
const x = Symbol();
let y = false;
What is the purpose of the assignment operator (=) in JavaScript?
To compare two values
To assign values to variables
To perform arithmetic operations
To declare a function
What is a JavaScript expression?
A combination of values, variables, and operators that computes to a value
A function that returns a string
A method to store data in arrays
A way to declare variables
What does the expression (5 + 6) * 10 evaluate to?
50
110
56
60
What will the expression "John" + " " + "Doe" evaluate to?
JohnDoe
John Doe
John + Doe
John " " Doe
What will the expression "5 * 2 + 3" evaluate to?
8
13
10
15
Which of the following statements is true about variables declared with "const"?
They are block-scoped.
They cannot be reassigned after declaration.
They can be reassigned new values.
They can be redeclared in the same scope.
What is the result of the expression "10 / 2 - 1"?
2
4
5
3
What will the expression "true && false" evaluate to?
true
undefined
false
null
