Worksheetsquiz 1
Total questions: 10
Worksheet time: 10mins
Question 1: Which of the following is not a JavaScript data type?
a) String
b) Array
c) Float
d) Function
Question 2: What is the correct data type for the value "42"?
a) Number
b) String
c) Boolean
d) Undefined
Question 3: What will the following expression evaluate to?
typeof "Hello"
a) "Number"
d) "Undefined"
c) "String"
b) "Boolean"
Question 4: How do you declare a variable in JavaScript?
d) const myVariable;
c) let myVariable;
b) variable myVariable;
a) var myVariable;
Question 5: Which data type is used to store multiple values in a single variable?
c) Boolean
d) Array
b) Number
a) String
Question 6: What will the following expression evaluate to?
typeof true
a) "String"
d) "Undefined"
c) "Boolean"
b) "Number"
Question 7: How do you check if two variables have the same value and data type in JavaScript?
a) Using the == operator
b) Using the === operator
c) Using the != operator
d) Using the !== operator
Question 8: What is the correct way to access the length of an String called "myStr" in JavaScript?
a) length(myStr)
d) myStr.length()
c) myStr.length
b) myStr.size
Question 9: What will the following expression evaluate to?
typeof [1, 2, 3]
a) "String"
b) "Number"
d) "Object"
c) "Boolean"
Question 10: How do you create a single-line comment in JavaScript?
a) // This is a comment
c) /* This is a comment */
b) <!-- This is a comment -->
d) # This is a comment
