Top 500 Javascript MCQ Interview Questions

Question 401: What is the output of console.log(2 + '2');?
Answer: B) '22'
Question 402: What is the result of console.log(0 == '0');?
Answer: A) true
Question 403: What does the Array.isArray() method do?
Answer: A) Checks if an object is an array
Question 404: What is the output of console.log('abc'.length);?
Answer: A) 3
Question 405: What is the result of console.log(typeof NaN);?
Answer: A) number
Question 406: Which of the following will create a new array?
Answer: C) Both A and B
Question 407: Which method is used to add one or more elements to the end of an array?
Answer: A) push()
Question 408: What will console.log('5' - 2); output?
Answer: A) 3
Question 409: Which of the following is a way to create an object in JavaScript?
Answer: C) Both A and B
Question 410: What is the output of console.log(typeof []);?
Answer: B) object
Question 411: What is the output of console.log([1] == true);?
Answer: A) true
Question 412: What is the output of console.log(typeof {});?
Answer: A) object
Question 413: What will console.log([1, 2, 3].slice(1)); output?
Answer: B) [2, 3]
Question 414: Which of the following is not a primitive data type in JavaScript?
Answer: C) Object
Question 415: Which method can be used to remove an element from an array by its value?
Answer: C) filter()
Question 416: What is the output of console.log('a' + 'b' + 'c');?
Answer: A) 'abc'
Question 417: What will console.log([2] + [3]); output?
Answer: B) '23'
Question 418: Which method can be used to find the index of an element in an array?
Answer: C) both A and B
Question 419: What does the `map()` method do in JavaScript?
Answer: B) Returns a new array with the results of calling a function on every element
Question 420: What will console.log(true + false); output?
Answer: A) 1
Question 421: Which operator is used for strict equality in JavaScript?
Answer: B) ===
Question 422: What does JSON stand for?
Answer: A) JavaScript Object Notation
Question 423: How do you write an array in JavaScript?
Answer: B) var colors = [1, 2, 3];
Question 424: What will console.log(!!'false'); output?
Answer: A) true
Question 425: What is the result of '5' + 1 - 1?
Answer: C) '51'
Question 426: What does the `reduce()` method do in JavaScript?
Answer: B) Applies a function against an accumulator and each element in the array
Question 427: What will console.log('5' - 1); output?
Answer: A) 4
Question 428: Which of the following is used to define a function in JavaScript?
Answer: A) function myFunction() { }
Question 429: What will console.log(1 + '1'); output?
Answer: B) '11'
Question 430: What does the `filter()` method do in JavaScript?
Answer: A) Creates a new array with all elements that pass the test implemented by the provided function
Question 431: What is the output of console.log(null == undefined);?
Answer: A) true
Question 432: Which operator is used to assign a value to a variable in JavaScript?
Answer: A) =
Question 433: What is the result of NaN === NaN?
Answer: B) false
Question 434: How do you create an object in JavaScript?
Answer: C) both A and B
Question 435: What is the output of console.log('5' == 5);?
Answer: A) true
Question 436: What will console.log(typeof NaN); output?
Answer: A) 'number'
Question 437: What does the `concat()` method do in JavaScript?
Answer: A) Merges two or more arrays
Question 438: What is the output of console.log(typeof null);?
Answer: A) 'object'
Question 439: Which of the following is a primitive data type in JavaScript?
Answer: C) String
Question 440: What does the `slice()` method do in JavaScript?
Answer: A) Extracts a section of an array and returns a new array
Question 441: How do you create a function that returns a value in JavaScript?
Answer: A) function myFunction() { return value; }
Question 442: What will console.log(typeof undefined); output?
Answer: A) 'undefined'
Question 443: What is the output of console.log('1' + '1');?
Answer: B) '11'
Question 444: What is a closure in JavaScript?
Answer: A) A function that has access to its own scope, the outer function's scope, and the global scope
Question 445: What will console.log(0.1 + 0.2 == 0.3); output?
Answer: B) false
Question 446: How do you declare a variable in JavaScript?
Answer: D) All of the above
Question 447: What is the output of console.log(typeof 123);?
Answer: B) 'number'
Question 448: What is the output of console.log(true + true);?
Answer: A) 2
Question 449: What will console.log(1 == '1'); output?
Answer: A) true
Question 450: What is the difference between == and === in JavaScript?
Answer: B) == checks only value; === checks value and type

Showing 401-450 of 500 questions

Contact Tech Spakes Training