Top 500 Javascript MCQ Interview Questions

Question 101: Which of the following is a primitive data type in JavaScript?
Answer: C) String
Question 102: What will console.log(1 == '1'); output?
Answer: A) true
Question 103: Which method is used to add one or more elements to the end of an array?
Answer: A) push()
Question 104: What will console.log('10' + 1); output?
Answer: B) 101
Question 105: Which of the following is used to declare a variable in JavaScript?
Answer: D) All of the above
Question 106: What is the output of console.log(typeof null);?
Answer: B) object
Question 107: Which of the following is a method to convert a string to a number?
Answer: D) All of the above
Question 108: What does the Array.isArray() method do?
Answer: A) Checks if a variable is an array
Question 109: Which of the following is not a falsy value in JavaScript?
Answer: D) 1
Question 110: What will be the output of console.log(5 === '5');?
Answer: B) false
Question 111: Which of the following methods removes the last element from an array?
Answer: A) pop()
Question 112: What will console.log([1, 2, 3].includes(2)); output?
Answer: A) true
Question 113: What is the output of console.log(Math.max(1, 2, 3));?
Answer: C) 3
Question 114: Which keyword is used to create a new function in JavaScript?
Answer: A) function
Question 115: What does console.log(3 + 2 + '7'); output?
Answer: B) 57
Question 116: Which method is used to remove the first element from an array?
Answer: B) shift()
Question 117: What is the output of console.log(!!null);?
Answer: B) false
Question 118: Which method can be used to iterate over an array?
Answer: D) All of the above
Question 119: What will console.log('Hello'.substring(1, 4)); output?
Answer: B) ell
Question 120: Which operator is used for strict equality comparison?
Answer: B) ===
Question 121: What does the map() method do?
Answer: A) Transforms each element of an array
Question 122: What is the output of console.log(1 + 2 + '3' - 1);?
Answer: A) 2
Question 123: Which of the following is a way to create an object in JavaScript?
Answer: D) All of the above
Question 124: What is the output of console.log('5' - 2);?
Answer: A) 3
Question 125: Which of the following will trigger a TypeError in JavaScript?
Answer: D) All of the above
Question 126: What is the output of console.log([2] == [2]);?
Answer: B) false
Question 127: What is the output of console.log('abc'.charAt(1));?
Answer: B) b
Question 128: What does the JSON.stringify() method do?
Answer: A) Converts a JavaScript object to a JSON string
Question 129: Which method is used to add an element to the end of an array?
Answer: A) push()
Question 130: What is the output of console.log(!!undefined);?
Answer: B) false
Question 131: Which method is used to convert a JSON string into a JavaScript object?
Answer: A) JSON.parse()
Question 132: What is the output of console.log('1' + 1);?
Answer: B) 11
Question 133: Which keyword is used to declare a variable in JavaScript?
Answer: D) All of the above
Question 134: What does the 'this' keyword refer to in JavaScript?
Answer: B) The current function context
Question 135: Which of the following is a falsy value in JavaScript?
Answer: D) All of the above
Question 136: What is the output of console.log(typeof NaN);?
Answer: A) number
Question 137: Which of the following is used to handle exceptions in JavaScript?
Answer: D) All of the above
Question 138: What is the output of console.log('2' + '2');?
Answer: B) 22
Question 139: Which function is used to remove the last element from an array?
Answer: A) pop()
Question 140: What does the '===' operator do in JavaScript?
Answer: B) Compares two values and types for equality
Question 141: What is the output of console.log(1 == '1');?
Answer: A) true
Question 142: What is the output of console.log(typeof null);?
Answer: A) object
Question 143: Which of the following methods is used to convert a string to an integer?
Answer: D) All of the above
Question 144: What is the output of console.log('3' - 2);?
Answer: A) 1
Question 145: Which method is used to remove the first element from an array?
Answer: A) shift()
Question 146: What is the output of console.log(1 === '1');?
Answer: B) false
Question 147: Which method is used to add one or more elements to the beginning of an array?
Answer: C) unshift()
Question 148: What is the output of console.log(2 + '2');?
Answer: B) '22'
Question 149: Which of the following is used to define a block scope variable in JavaScript?
Answer: D) All of the above
Question 150: What is the output of console.log(!!'');?
Answer: B) false

Showing 101-150 of 500 questions

Contact Tech Spakes Training