1. What is the output of the following code?
- A) "object"
- B) "null"
- C) "undefined"
- D) "boolean"
Answer: A) "object"
2. Which of the following is not a JavaScript data type?
- A) String
- B) Number
- C) Boolean
- D) Float
Answer: D) Float
3. What will the following code output?
- A) true, true
- B) true, false
- C) false, true
- D) false, false
Answer: B) true, false
4. **What is the purpose of the
- A) To declare a block-scoped variable
- B) To declare a global variable
- C) To declare a constant
- D) To declare a function
Answer: A) To declare a block-scoped variablele**
What will the following code output?t?**
- A) "122"
- B) "32"
- C) "14"
- D) "5"
Answer: A) "122"2"**
Which method is used to add an element to the end of an array?y?**
- A)
- B)
- C)
- D)
**Answer: A)
7. **What is the output of the following code?**
- A) "number"
- B) "NaN"
- C) "undefined"
- D) "Answer: A) "number") "number"**
8. **What does the
- A) The function itself
- B) The global object
- C) The object that the method belongs to
- D) The paAnswer: C) The object that the method belongs tohod bWhat will the following code output?g code output?**
- A) "undefined"
- B) "null"
- C) ""
Answer: C) ""*AnsweWhich of the following is not a valid way to create a JavaScript object?Script object?**
- A)
- B)
- C)
- D)
**Answer: D)
11. **What is the output of the following code?**
- A) true, true
- B) true, false
- C) false, true
Answer: A) true, true*Answer: A) true, true**
12. **What is the purpose of the
- A) To bind a function to an object
- B) To bind an event to a function
- C) To bind a variable to a function
- D) To bind a Answer: A) To bind a function to an objectnd a fWhat will the following code output?the following code output?**
- A) "undefined"
- B) "null"
- C) "objeAnswer: A) "undefined" **AnWhich of the following is not a JavaScript framework or library?ript framework or library?**
- A) React
- B) Angular
- Answer: D) Djangoo
What is the output of the following code?put of the following code?**
- A) "21"
- B) "22"
Answer: C) 21 D) 3
**Answer: C) 21**
16. **What is the purpose of the
- A) To create a new array by applying a function to each element of an existing array
- B) To filter elements of an array based on a condition
- C) To reduce an array to a single value
- D) To sorAnswer: A) To create a new array by applying a function to each element of an existing arrayh elemWhat will the following code output?ill the following code output?**
- A) "array"
- B) "object"
- C) "Answer: B) "object"ll"
Which of the following is not a valid JavaScript loop?s not a valid JavaScript loop?**
- A)
- B)
- C)
- D)
**Answer: D)
console.log(typeof null);
- A) "object"
- B) "null"
- C) "undefined"
- D) "boolean"
Answer: A) "object"
2. Which of the following is not a JavaScript data type?
- A) String
- B) Number
- C) Boolean
- D) Float
Answer: D) Float
3. What will the following code output?
console.log(0 == '0');
console.log(0 === '0');
- A) true, true
- B) true, false
- C) false, true
- D) false, false
Answer: B) true, false
4. **What is the purpose of the
let keyword in JavaScript?**- A) To declare a block-scoped variable
- B) To declare a global variable
- C) To declare a constant
- D) To declare a function
Answer: A) To declare a block-scoped variablele**
What will the following code output?t?**
console.log(1 + "2" + "2");
- A) "122"
- B) "32"
- C) "14"
- D) "5"
Answer: A) "122"2"**
Which method is used to add an element to the end of an array?y?**
- A)
push()- B)
pop()- C)
shift()- D)
unshift()**Answer: A)
push()**7. **What is the output of the following code?**
console.log(typeof NaN);
- A) "number"
- B) "NaN"
- C) "undefined"
- D) "Answer: A) "number") "number"**
8. **What does the
this keyword refer to in a JavaScript method?**- A) The function itself
- B) The global object
- C) The object that the method belongs to
- D) The paAnswer: C) The object that the method belongs tohod bWhat will the following code output?g code output?**
console.log([] + []);
- A) "undefined"
- B) "null"
- C) ""
Answer: C) ""*AnsweWhich of the following is not a valid way to create a JavaScript object?Script object?**
- A)
let obj = {};- B)
let obj = new Object();- C)
let obj = Object.create(null);- D)
let obj = new Object(null);**Answer: D)
let obj = new Object(null);**11. **What is the output of the following code?**
console.log(1 == true);
console.log(0 == false);
- A) true, true
- B) true, false
- C) false, true
Answer: A) true, true*Answer: A) true, true**
12. **What is the purpose of the
bind() method in JavaScript?**- A) To bind a function to an object
- B) To bind an event to a function
- C) To bind a variable to a function
- D) To bind a Answer: A) To bind a function to an objectnd a fWhat will the following code output?the following code output?**
console.log(typeof undefined);
- A) "undefined"
- B) "null"
- C) "objeAnswer: A) "undefined" **AnWhich of the following is not a JavaScript framework or library?ript framework or library?**
- A) React
- B) Angular
- Answer: D) Djangoo
What is the output of the following code?put of the following code?**
console.log(2 + "2" - 1);
- A) "21"
- B) "22"
Answer: C) 21 D) 3
**Answer: C) 21**
16. **What is the purpose of the
map() method in JavaScript?**- A) To create a new array by applying a function to each element of an existing array
- B) To filter elements of an array based on a condition
- C) To reduce an array to a single value
- D) To sorAnswer: A) To create a new array by applying a function to each element of an existing arrayh elemWhat will the following code output?ill the following code output?**
console.log(typeof []);
- A) "array"
- B) "object"
- C) "Answer: B) "object"ll"
Which of the following is not a valid JavaScript loop?s not a valid JavaScript loop?**
- A)
for- B)
while- C)
do...while- D)
foreach**Answer: D)
foreach**π1
19. What is the output of the following code?
- A) true
- B) false
- C) undefined
- D) null
Answer: B) false
20. **What is the purpose of the
- A) To handle asynchronous operations
- B) To handle synchronous operations
- C) To handle event listeners
- D) To handle DOM manipulation
Answer: A) To handle asynchronous operationsns**
These questions cover a range of JavaScript topics, including data types, operators, methods, and more, which are commonly asked in interviews.
console.log(1 === true);
- A) true
- B) false
- C) undefined
- D) null
Answer: B) false
20. **What is the purpose of the
Promise object in JavaScript?**- A) To handle asynchronous operations
- B) To handle synchronous operations
- C) To handle event listeners
- D) To handle DOM manipulation
Answer: A) To handle asynchronous operationsns**
These questions cover a range of JavaScript topics, including data types, operators, methods, and more, which are commonly asked in interviews.