0% found this document useful (0 votes)
14 views4 pages

JavaScript Data Types & Variables - MCQs

The document contains multiple-choice questions (MCQs) focused on JavaScript data types and variable declarations. It covers topics such as primitive data types, variable scopes, and the behavior of specific JavaScript operators. The questions test knowledge on variable initialization, type checking, and the differences between various data types in JavaScript.

Uploaded by

harshkamle03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views4 pages

JavaScript Data Types & Variables - MCQs

The document contains multiple-choice questions (MCQs) focused on JavaScript data types and variable declarations. It covers topics such as primitive data types, variable scopes, and the behavior of specific JavaScript operators. The questions test knowledge on variable initialization, type checking, and the differences between various data types in JavaScript.

Uploaded by

harshkamle03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

JavaScript Data Types & Variables – MCQs

1. Which of the following is a primitive data type in JavaScript?


a) Object
b) Array
c) String
d) Function

2. What keyword is used to declare a variable that cannot be reassigned?


a) var
b) const
c) let
d) static

3. What will be the type of a variable declared as: let x = null;?


a) "object"
b) "null"
c) "undefined"
d) "number"

4. Which of the following is NOT a valid JavaScript variable name?


a) _value
b) 1value
c) $value
d) value1

5. What is the output of typeof undefined?


a) "object"
b) "null"
c) "undefined"
d) "boolean"

6. Which of these types is NOT primitive in JavaScript?


a) Symbol
b) Boolean
c) Object
d) String
7. What will typeof NaN return?
a) "number"
b) "NaN"
c) "undefined"
d) "object"

8. How can you define a variable that can be reassigned later?


a) var
b) const
c) static
d) final

9. Which keyword is used for block-scoped variable declaration in ES6?


a) var
b) static
c) let
d) define

10. What is the default value of an uninitialized variable in JavaScript?


a) 0
b) null
c) undefined
d) NaN

11. What type does the typeof operator return for an array?
a) "array"
b) "object"
c) "list"
d) "collection"

12. Which of the following types is used to represent logical values?


a) Integer
b) Float
c) Boolean
d) Bit

13. Which method can be used to convert a string to an integer in JavaScript?


a) parseFloat()
b) parseInt()
c) toInteger()
d) convertInt()

14. What is the result of typeof function() {}?


a) "object"
b) "function"
c) "method"
d) "undefined"

15. How do you declare a constant variable in JavaScript?


a) let x = 5;
b) const x = 5;
c) var x = 5;
d) static x = 5;

16. What will be the output of: let a; console.log(typeof a);?


a) "null"
b) "undefined"
c) "object"
d) "NaN"

17. Which of the following is not a valid data type in JavaScript?


a) number
b) string
c) character
d) boolean

18. What is the result of: typeof []?


a) "object"
b) "array"
c) "list"
d) "undefined"

19. Which keyword was introduced in ES6 for declaring variables?


a) var
b) let
c) define
d) new

20. Which of the following statements is true about const variables?


a) They can be reassigned
b) They are globally scoped
c) They must be initialized at the time of declaration
d) They can be declared without a value

You might also like