Top 500 Javascript MCQ Interview Questions

Question 301: Which of the following is a method for converting a JSON string into a JavaScript object?
Answer: B) JSON.parse()
Question 302: What is the output of console.log(typeof NaN);?
Answer: A) number
Question 303: Which symbol is used to denote a block comment in JavaScript?
Answer: D) Both A and B
Question 304: What does the this keyword refer to in a JavaScript function?
Answer: C) The object from which the function was called
Question 305: Which of the following will create an object in JavaScript?
Answer: D) All of the above
Question 306: What is the output of console.log('5' + 5);?
Answer: B) 55
Question 307: Which of the following is the correct way to define an array in JavaScript?
Answer: B) let arr = [1, 2, 3];
Question 308: What is the output of console.log(typeof null);?
Answer: A) object
Question 309: Which method is used to remove the last element from an array in JavaScript?
Answer: A) pop()
Question 310: Which of the following methods can be used to convert a string to an integer in JavaScript?
Answer: C) Both A and B
Question 311: What is the output of console.log(3 > 2 > 1);?
Answer: B) false
Question 312: Which of the following methods will sort an array in place?
Answer: A) sort()
Question 313: What is the output of console.log('Hello' + 'def');?
Answer: A) abcdef
Question 314: Which function is used to get the current date and time in JavaScript?
Answer: B) new Date()
Question 315: What will console.log('Hello' === 'Hello'); output?
Answer: A) true
Question 316: Which of the following is used to define an asynchronous function in JavaScript?
Answer: A) async
Question 317: What is the output of console.log(typeof []);?
Answer: B) object
Question 318: Which of the following is a JavaScript framework?
Answer: D) All of the above
Question 319: What is the output of console.log(1 == '1');?
Answer: A) true
Question 320: Which of the following keywords is used to declare a constant in JavaScript?
Answer: B) const
Question 321: What does parseInt('100.10') return?
Answer: B) 100
Question 322: What is the output of console.log(0 == false);?
Answer: A) true
Question 323: Which method can be used to convert a string to a number?
Answer: D) All of the above
Question 324: What is the output of console.log([2] == [2]);?
Answer: B) false
Question 325: What is the output of console.log(null === undefined);?
Answer: B) false
Question 326: Which of the following is used to stop the execution of a function?
Answer: B) return
Question 327: What will console.log(typeof function(){}); output?
Answer: B) object
Question 328: Which of the following methods is used to remove the last element from an array?
Answer: A) pop()
Question 329: What will console.log(!!''); output?
Answer: B) false
Question 330: Which operator is used to concatenate strings in JavaScript?
Answer: A) +
Question 331: What is the output of console.log(3 == '3');?
Answer: A) true
Question 332: Which function is used to convert a string to lowercase?
Answer: A) toLowerCase()
Question 333: What will console.log('1' + 2 + 3); output?
Answer: B) 123
Question 334: What will console.log([1, 2, 3].pop()); output?
Answer: B) 3
Question 335: What does the Math.random() function return?
Answer: B) A random decimal between 0 and 1
Question 336: Which of the following is not a valid way to check for equality?
Answer: D) ==!
Question 337: Which of the following can be used as a key in an object?
Answer: D) All of the above
Question 338: What will console.log('5' + 5 - 5); output?
Answer: A) 5
Question 339: What is the output of console.log(null === undefined);?
Answer: B) false
Question 340: Which of the following is used to stop the execution of a function?
Answer: B) return
Question 341: What will console.log(typeof function(){}); output?
Answer: A) function
Question 342: Which of the following methods is used to join two or more arrays?
Answer: A) concat()
Question 343: What is the output of console.log('a' > 'b');?
Answer: B) false
Question 344: What is the output of console.log([2] == [2]);?
Answer: B) false
Question 345: What is the output of console.log(0 == false);?
Answer: A) true
Question 346: What is the output of console.log(typeof []);?
Answer: B) object
Question 347: Which of the following is a JavaScript framework?
Answer: D) All of the above
Question 348: What does parseInt('100.10') return?
Answer: B) 100
Question 349: What is the output of console.log(5 + '5');?
Answer: B) 55
Question 350: Which function is used to convert a string to lowercase?
Answer: A) toLowerCase()

Showing 301-350 of 500 questions

Contact Tech Spakes Training