Here are Top 100 multiple-choice questions (MCQs) focused on the HTML5 features and elements in JavaScript MCQs, along with their answers and explanations.

#### 1. What is the purpose of a JavaScript variable?

- To store and manage data
- To define functions
- To control the flow of execution
- To create HTML elements

JavaScript variables are used to store and manage data.

#### 2. Which keyword is used to declare a variable in JavaScript?

- let
- var
- const
- variable

In modern JavaScript, you can use the let keyword to declare variables.

#### 3. What is the difference between let and const for variable declaration?

- let allows reassignment, while const does not.
- const allows reassignment, while let does not.
- let and const are interchangeable.
- Both let and const prevent variable declaration.

let allows reassignment, while const does not. const creates a constant value.

#### 4. What is the value of a variable that is declared but not initialized?

- 0
- null
- undefined
- false

The value of a variable that is declared but not initialized is undefined.

#### 5. Which data type is used to represent whole numbers in JavaScript?

- Integer
- Float
- String
- Number

The Number data type is used to represent both whole numbers and floating-point numbers.

#### 6. What is the result of the expression 5 + '5' in JavaScript?

- 10
- 55
- '55'
- Error

JavaScript performs type coercion and converts the number to a string before concatenation.

#### 7. What is the purpose of the typeof operator in JavaScript?

- To perform type conversion
- To check if a variable is undefined
- To convert a variable to a number
- To determine the data type of a value

The typeof operator is used to determine the data type of a value.

#### 8. Which operator is used to compare two values for equality without considering their data types?

- '=='
- '==='
- '!='
- '!=='

The '==' operator checks for equality without considering data types (type coercion).

#### 9. Which operator is used to compare two values for equality while also checking their data types?

- '=='
- '==='
- '!='
- '!=='

The '===' operator checks for equality while also considering data types (no type coercion).

#### 10. What does the '&&' operator do in JavaScript?

- It performs a logical OR operation
- It performs a logical NOT operation
- It performs a logical AND operation
- It concatenates strings

The '&&' operator performs a logical AND operation.

#### 11. Which operator is used to increment a variable in JavaScript?

- '++'
- '--'
- '+='
- '-='

The '++' operator is used to increment a variable by 1.

#### 12. What is the purpose of the typeof operator in JavaScript?

- To convert a value to a different data type
- To check the type of a value
- To perform arithmetic operations
- To create a new variable

The typeof operator is used to check the data type of a value.

#### 13. What is the purpose of the '!'operator in JavaScript?

- It performs addition
- It negates a Boolean value
- It concatenates strings
- It multiplies numbers

The '!' operator negates a Boolean value, turning true into false and vice versa.

#### 14. What is the result of the expression 5 + 2 * 3 in JavaScript?

- 15
- 11
- 20
- 9

JavaScript follows the order of operations, so multiplication is done before addition.

#### 15. How do you define a multi-line comment in JavaScript?

- '// This is a comment'
- <!-- This is a comment -->
- '/* This is a comment */'
- '#' This is a comment

Multi-line comments in JavaScript are enclosed in '/* */'.

#### 16. What is the result of the expression 5 % 2 in JavaScript?

- 5
- 2.5
- 1
- 0

The % operator calculates the remainder, so 5 % 2 is 1.

#### 17. Which operator is used to concatenate strings in JavaScript?

- '+'
- '&'
- '+'
- '.'

The + operator is used to concatenate strings in JavaScript.

#### 18. What does the NaN value represent in JavaScript?

- An empty string
- A missing or non-existent value
- A zero value
- A special value representing "Not-a-Number"

NaN is a special value representing "Not-a-Number."

#### 19. What is the result of the expression 5 == '5' in JavaScript?

- true
- false
- Error
- Undefined

JavaScript performs type coercion, so 5 is considered equal to '5'.

#### 20. How do you declare a constant variable in JavaScript?

- const myVar
- let myVar
- var myVar
- constant myVar

You declare a constant variable in JavaScript using the const keyword.

#### 21. What is the purpose of the Math.random() function in JavaScript?

- To generate random numbers
- To perform mathematical calculations
- To round numbers to the nearest integer
- To check if a variable is defined

Math.random() is used to generate random numbers between 0 and 1.

#### 22. What is the value of null in JavaScript?

- A missing or non-existent value
- Zero
- An empty string
- False

null represents a missing or non-existent value in JavaScript.

#### 23. What is the result of the expression '5' - 2 in JavaScript?

- '3'
- 3
- Error
- NaN

JavaScript performs type coercion, converting the string to a number for subtraction.

#### 24. Which logical operator is used to perform a logical OR operation in JavaScript?

- '&&'
- '||'
- '!'
- '=='

The '||' operator is used to perform a logical OR operation.

#### 25. What is the purpose of the typeof operator in JavaScript?

- To create a new object
- To change the type of a variable
- To define functions
- To determine the data type of a value

The typeof operator is used to determine the data type of a value.

#### 26. What is the result of the expression '5' + 2 in JavaScript?

- '7'
- 7
- Error
- 52

JavaScript performs string concatenation when one of the operands is a string.

#### 27. What is the purpose of the parseInt() function in JavaScript?

- To convert a string to an integer
- To round a number to the nearest integer
- To calculate the square root of a number
- To create a new variable

The parseInt() function is used to convert a string to an integer.

#### 28. What is the JavaScript operator for exponentiation (raising a number to a power)?

- '^'
- '**'
- '*'
- '%'

The operator is used for exponentiation in JavaScript.

#### 29. Which operator is used to concatenate two or more arrays in JavaScript?

- +
- concat()
- merge()
- extend()

The concat() method is used to concatenate arrays in JavaScript.

#### 30. What is the value of typeof null in JavaScript?

- Object
- Null
- Undefined
- NullObject

The typeof operator returns 'object' for null values, which is a historical quirk in JavaScript.

#### 31. What is the result of the expression 'Hello'.length in JavaScript?

- Error
- Undefined
- 5
- 'Hello'

The .length property returns the length of a string, which is 5 in this case.

#### 32. Which built-in object in JavaScript represents a date and time?

- TimeObject
- Clock
- Date
- DateTime

The Date object represents date and time in JavaScript.

#### 33. What is the result of the expression 5 > 3 && 2 < 4 in JavaScript?

- true
- false
- Error
- Undefined

The '&&' operator returns true if both conditions are true.

#### 34. What is the result of the expression '5' '===' 5 in JavaScript?

- true
- false
- Error
- Undefined

The '===' operator checks for equality and data type, so a string is not equal to a number.

#### 35. What is the result of the expression NaN '===' NaN in JavaScript?

- true
- false
- Error
- Undefined

NaN is not equal to itself in JavaScript.

#### 36. Which operator is used to access properties of an object in JavaScript?

- '.'
- '.'
- '[]'
- '()'

The . operator is used to access object properties.

#### 37. What is the result of the expression 5 / 0 in JavaScript?

- 5
- 0
- Infinity
- Error

Division by zero results in positive or negative infinity in JavaScript.

#### 38. Which operator is used for assigning a value to a variable in JavaScript?

- '='
- '=='
- '==='
- '.'

The '=' operator is used for assignment in JavaScript.

#### 39. What is the result of the expression null '==' undefined in JavaScript?

- true
- false
- Error
- Undefined

null and undefined are loosely equal in JavaScript.

#### 40. What is the JavaScript operator for the remainder of a division operation?

- '%'
- '//'
- '/'
- '*'

The '%' operator is used to calculate the remainder of a division operation.

#### 41. What is the purpose of the Math.floor() function in JavaScript?

- To round a number up to the nearest integer
- To round a number to the nearest integer
- To return the largest integer less than or equal to a given number
- To perform mathematical operations

Math.floor() returns the largest integer less than or equal to a given number.

#### 42. What is the result of the expression '5' - '2' in JavaScript?

- 3
- '3'
- Error
- NaN

JavaScript converts the strings to numbers and performs subtraction.

#### 43. What is the JavaScript operator for the logical NOT operation?

- '!'
- '&&'
- '||'
- '='

The '!' operator is used for the logical NOT operation.

#### 44. What is the result of the expression true '&&' false in JavaScript?

- true
- false
- Error
- Undefined

The '&&' operator returns false if any operand is false.

#### 45. What is the result of the expression '5' * 2 in JavaScript?

- 10
- '10'
- Error
- 52

JavaScript converts the string to a number and performs multiplication.

#### 46. Which operator is used to compare two values for inequality without considering their data types?

- '!='
- '/='
- <>
- '!=='

The '!=' operator checks for inequality without considering data types (type coercion).

#### 47. What is the result of the expression '5' + true in JavaScript?

- 'true5'
- '6'
- 6
- Error

JavaScript converts the boolean true to a string and concatenates it.

#### 48. What is the result of the expression null + 5 in JavaScript?

- 5
- 0
- 'null5'
- Error

null is converted to 0 in arithmetic operations.

#### 49. What does the toFixed() function do in JavaScript?

- It converts a number to a string
- It rounds a number to a specified number of decimal places
- It calculates the square root of a number
- It checks if a variable is defined

The toFixed() function rounds a number to a specified number of decimal places and returns a string.

#### 50. What is the JavaScript operator for the remainder of a division operation?

- '//'
- div
- mod
- '%'

The '%' operator is used for calculating the remainder of a division operation in JavaScript.

#### 51. What is the result of the expression 5 * '2' in JavaScript?

- 10
- '10'
- Error
- 52

JavaScript converts the string to a number and performs multiplication.

#### 52. What does the isNaN() function do in JavaScript?

- It checks if a value is not a number
- It converts a value to a number
- It rounds a number to the nearest integer
- It checks if a variable is defined

The isNaN() function checks if a value is not a number.

#### 53. What is the result of the expression '5' == true in JavaScript?

- true
- false
- Error
- Undefined

JavaScript performs type coercion, and both '5' and true are considered "truthy."

#### 54. Which built-in object in JavaScript represents the global context?

- Window
- Document
- Global
- Context

In a browser environment, the Window object represents the global context.

#### 55. What is the purpose of the Math.ceil() function in JavaScript?

- To round a number up to the nearest integer
- To round a number to the nearest integer
- To return the smallest integer greater than or equal to a given number
- To calculate the square root of a number

Math.ceil() rounds a number up to the nearest integer.

#### 56. What is the JavaScript operator for the logical OR operation?

- '!'
- '&&'
- '||'
- '|'

The '||' operator is used for the logical OR operation.

#### 57. What is the result of the expression 5 + null in JavaScript?

- 5
- null
- Error
- Undefined

null is converted to 0 in arithmetic operations.

#### 58. Which operator is used to check if a value is less than or equal to another value in JavaScript?

- <
- >
- <=
- >=

The <= operator checks if a value is less than or equal to another value.

#### 59. What is the result of the expression true '||' false in JavaScript?

- true
- false
- Error
- Undefined

The '||' operator returns true if either operand is true.

#### 60. What is the result of the expression '5' - 2 in JavaScript?

- '3'
- 3
- Error
- NaN

JavaScript converts the string to a number and performs subtraction.

#### 61. What is the purpose of the Math.sqrt() function in JavaScript?

- To calculate the square root of a number
- To round a number up to the nearest integer
- To round a number to the nearest integer
- To convert a value to a string

Math.sqrt() calculates the square root of a number.

#### 62. Which operator is used to check if a value is greater than another value in JavaScript?

- <
- >
- <=
- >=

The > operator checks if a value is greater than another value.

#### 63. What is the result of the expression true && true in JavaScript?

- true
- false
- Error
- Undefined

The && operator returns true if both operands are true.

#### 64. What is the result of the expression '5' + null in JavaScript?

- '5null'
- 5
- 'null'
- Error

JavaScript converts null to a string and concatenates it.

#### 65. What is the JavaScript operator for the logical XOR operation (exclusive or)?

- '^^'
- '||'
- '&&'
- '^'

The '^' operator is used for the logical XOR (exclusive or) operation.

#### 66. What is the result of the expression '5' + '2' in JavaScript?

- 7
- '72'
- Error
- '5' + '2'

JavaScript concatenates strings when both operands are strings.

#### 67. Which function is used to convert a string to uppercase in JavaScript?

- toLowerCase()
- Uppercase()
- toUpperCase()
- upper()

The toUpperCase() function converts a string to uppercase.

#### 68. What is the JavaScript operator for the logical NOT equal operation?

- '!='
- '=='
- '==='
- '!=='

The '!==' operator checks for inequality while also considering data types.

#### 69. What is the result of the expression 5 / 'two' in JavaScript?

- 5
- '5'
- Error
- NaN

Division by a non-numeric string results in NaN.

#### 70. Which operator is used to check if a value is equal to another value without considering their data types?

- '=='
- '==='
- '!='
- '!=='

The '==' operator checks for equality without considering data types (type coercion).

#### 71. What is the result of the expression '5' - 'two' in JavaScript?

- '3'
- 3
- Error
- NaN

JavaScript cannot convert the string 'two' to a number.

#### 72. Which operator is used to access array elements in JavaScript?

- '[]'
- '{}'
- '()'
- '.'

The '[]' operator is used to access array elements by index.

#### 73. What is the result of the expression undefined + 5 in JavaScript?

- 5
- undefined
- Error
- NaN

Adding a number to undefined results in NaN.

#### 74. What is the purpose of the Math.round() function in JavaScript?

- To round a number up to the nearest integer
- To round a number to the nearest integer
- To calculate the square root of a number
- To perform mathematical operations

Math.round() rounds a number to the nearest integer.

#### 75. What is the result of the expression 5 > 2 '||' 3 > 1 in JavaScript?

- true
- false
- Error
- Undefined

The '||' operator returns true if at least one operand is true.

#### 76. What is the result of the expression true '&&' 0 in JavaScript?

- true
- false
- 0
- Error

The '&&' operator returns false if one operand is false.

#### 77. What is the JavaScript operator for the bitwise AND operation?

- '&'
- '&&'
- '|'
- '!'

The '&' operator is used for bitwise AND in JavaScript.

#### 78. What is the result of the expression '5' '*' 'two' in JavaScript?

- '52'
- 52
- Error
- NaN

JavaScript cannot convert the strings to numbers.

#### 79. What is the result of the expression 5 == '5' in JavaScript?

- true
- false
- Error
- Undefined

JavaScript performs type coercion, so 5 is considered equal to '5'.

#### 80. What is the JavaScript operator for the bitwise OR operation?

- '|'
- '&'
- '||'
- '!'

The '|' operator is used for bitwise OR in JavaScript.

#### 81. What is the purpose of the Math.abs() function in JavaScript?

- To perform mathematical operations
- To return the absolute value of a number
- To calculate the square root of a number
- To round a number to the nearest integer

Math.abs() returns the absolute value of a number.

#### 82. What is the result of the expression '5' > '10' in JavaScript?

- true
- false
- Error
- Undefined

JavaScript compares strings based on their Unicode values.

#### 83. Which operator is used to perform a bitwise shift to the left in JavaScript?

- <<
- >>
- <<<
- >>

The << operator performs a bitwise shift to the left.

#### 84. What is the result of the expression 'true' '===' true in JavaScript?

- true
- false
- Error
- Undefined

The '===' operator checks for equality and data type, so a string is not equal to a boolean.

#### 85. What is the purpose of the Math.max() function in JavaScript?

- To return the maximum of two or more numbers
- To calculate the square root of a number
- To perform mathematical operations
- To round a number to the nearest integer

Math.max() returns the maximum value from a list of numbers.

#### 86. What is the JavaScript operator for the bitwise XOR operation?

- '^'
- '&'
- '|'
- '!'

The '^' operator is used for the bitwise XOR operation.

#### 87. What is the result of the expression true '&&' true in JavaScript?

- true
- false
- 1
- Error

The '&&' operator returns true if both operands are true.

#### 88. What is the result of the expression '5' '!=' 5 in JavaScript?

- true
- false
- Error
- Undefined

The '!=' operator checks for inequality without considering data types.

#### 89. Which function is used to convert a number to a string in JavaScript?

- toString()
- toNumber()
- parseNumber()
- str()

The toString() function converts a number to a string.

#### 90. What is the result of the expression 5 > 2 && 3 < 1 in JavaScript?

- true
- false
- Error
- Undefined

The '&&' operator returns false if any operand is false.

#### 91. What is the JavaScript operator for the bitwise NOT operation?

- '!'
- '&&'
- '||'
- '~'

The '~' operator is used for the bitwise NOT operation.

#### 92. What is the result of the expression 5 < 2 '||' 3 < 1 in JavaScript?

- true
- false
- Error
- Undefined

The '||' operator returns true if at least one operand is true.

#### 93. What is the purpose of the Math.min() function in JavaScript?

- To perform mathematical operations
- To calculate the square root of a number
- To return the minimum of two or more numbers
- To round a number to the nearest integer

Math.min() returns the minimum value from a list of numbers.

#### 94. What is the result of the expression 5 >= 5 in JavaScript?

- true
- false
- Error
- Undefined

The >= operator checks if a value is greater than or equal to another value.

#### 95. What is the JavaScript operator for the bitwise shift to the right (with sign) operation?

- >>
- <<
- <<<
- '&'

The >> operator performs a bitwise shift to the right with sign extension.

#### 96. What is the result of the expression '5' >= 5 in JavaScript?

- true
- false
- Error
- Undefined

JavaScript performs type coercion and considers the strings as numbers for comparison.

#### 97. What is the purpose of the Math.random() function in JavaScript?

- To generate random numbers
- To perform mathematical calculations
- To round numbers to the nearest integer
- To check if a variable is defined

Math.random() is used to generate random numbers between 0 and 1.

#### 98. What is the result of the expression '5' <= 5 in JavaScript?

- true
- false
- Error
- Undefined

JavaScript performs type coercion and considers the strings as numbers for comparison.

#### 99. Which operator is used to check if a value is strictly greater than another value in JavaScript?

- >
- <
- >=
- <=

The > operator checks if a value is strictly greater than another value.

#### 100. What is the result of the expression '5' < '10' in JavaScript?

- true
- false
- Error
- Undefined

JavaScript compares strings based on their Unicode values.