Top 500 Javascript MCQ Interview Questions

Question 201: What is the output of console.log(1 + 2 + '3');?
Answer: D) 123
Question 202: Which operator is used to assign a value to a variable?
Answer: A) =
Question 203: What will console.log(3 + 4 + '5'); output?
Answer: B) 45
Question 204: Which method can be used to parse a JSON string?
Answer: A) JSON.parse()
Question 205: What is the output of console.log('5' + 3);?
Answer: B) 53
Question 206: Which of the following is a block-scoped variable declaration?
Answer: D) Both B and C
Question 207: What is the output of console.log(1 == '1');?
Answer: A) true
Question 208: Which of the following data types is not primitive in JavaScript?
Answer: C) Object
Question 209: What will console.log(typeof null); output?
Answer: B) object
Question 210: Which of the following is used to declare a constant in JavaScript?
Answer: C) const
Question 211: What is the output of console.log([1, 2] == [1, 2]);?
Answer: B) false
Question 212: Which method is used to remove the last element from an array?
Answer: A) pop()
Question 213: What will console.log(2 + '2' == '22'); output?
Answer: A) true
Question 214: Which of the following is not a valid way to declare a function in JavaScript?
Answer: D) const myFunc() {}
Question 215: What is the output of console.log(1 + '2' - 1);?
Answer: A) 2
Question 216: Which of the following will create an array?
Answer: D) All of the above
Question 217: What will console.log(2 * '3' + 1); output?
Answer: A) 7
Question 218: What is the output of console.log('1' + 2 + 3);?
Answer: B) 123
Question 219: Which method can be used to find the index of an element in an array?
Answer: D) All of the above
Question 220: What is the output of console.log(0 == false);?
Answer: A) true
Question 221: Which of the following is used to create a new promise?
Answer: B) new Promise()
Question 222: What will console.log('hello'.charAt(1)); output?
Answer: A) e
Question 223: Which of the following is not a valid way to create an object?
Answer: C) let obj = Object.create();
Question 224: What is the output of console.log(true + true);?
Answer: B) 2
Question 225: What does console.log([1, 2, 3].slice(1, 2)); return?
Answer: A) [2]
Question 226: Which method can be used to execute a function after a specified number of milliseconds?
Answer: A) setTimeout()
Question 227: What is the output of console.log([1] == true);?
Answer: B) false
Question 228: Which operator is used to compare both value and type in JavaScript?
Answer: B) ===
Question 229: What is the output of console.log('5' - 3);?
Answer: A) 2
Question 230: What does console.log(typeof NaN); return?
Answer: A) 'number'
Question 231: What will console.log(typeof null); output?
Answer: B) 'object'
Question 232: Which method is used to convert a JSON string into a JavaScript object?
Answer: A) JSON.parse()
Question 233: Which of the following is used to check if a variable is an array?
Answer: A) Array.isArray()
Question 234: What will console.log((2 > 1) ? 'yes' : 'no'); output?
Answer: A) yes
Question 235: Which of the following is not a JavaScript data type?
Answer: D) Character
Question 236: What does console.log(1 + '1'); return?
Answer: B) 11
Question 237: Which of the following methods can be used to remove the last element from an array?
Answer: A) pop()
Question 238: What will console.log(2 * '3'); output?
Answer: A) 6
Question 239: What does console.log([1, 2, 3].concat([4, 5])); return?
Answer: A) [1, 2, 3, 4, 5]
Question 240: Which method can be used to find the largest number in an array?
Answer: D) Both A and C
Question 241: What is the result of the expression '5' + 3?
Answer: B) '53'
Question 242: What will be the output of console.log(!!'');?
Answer: B) false
Question 243: What will be the output of console.log([2] == [2]);?
Answer: B) false
Question 244: Which of the following can be used to create a new array from an existing array?
Answer: D) All of the above
Question 245: What does the 'this' keyword refer to in JavaScript?
Answer: C) The object from which the function was called
Question 246: What will be the output of console.log(typeof []);?
Answer: B) 'object'
Question 247: What will be the result of console.log(0.1 + 0.2 == 0.3);?
Answer: B) false
Question 248: Which of the following methods can add elements to the end of an array?
Answer: A) push()
Question 249: What is the output of console.log('2' - 1);?
Answer: B) 1
Question 250: What will be the output of console.log(1 == '1');?
Answer: A) true

Showing 201-250 of 500 questions

Contact Tech Spakes Training