Top 500 Javascript MCQ Interview Questions

Question 351: What is the output of console.log(!!'');?
Answer: B) false
Question 352: Which of the following statements is used to create a function in JavaScript?
Answer: A) function myFunction() {}
Question 353: What does the Math.random() function return?
Answer: B) A random decimal between 0 and 1
Question 354: What will console.log('foo' === new String('foo')); output?
Answer: B) false
Question 355: Which of the following is a valid way to create a promise in JavaScript?
Answer: D) All of the above
Question 356: What is the output of console.log(5 + '5');?
Answer: B) 55
Question 357: Which method can be used to convert a string to a number?
Answer: D) All of the above
Question 358: What is the output of console.log(null === undefined);?
Answer: B) false
Question 359: Which of the following is used to stop the execution of a function?
Answer: B) return
Question 360: What will console.log(typeof function(){}); output?
Answer: A) function
Question 361: Which of the following is not a valid way to check for equality?
Answer: D) ==!
Question 362: What is the output of console.log([1, 2, 3].pop());?
Answer: B) 3
Question 363: Which method is used to join two or more arrays?
Answer: A) concat()
Question 364: What is the output of console.log('1' + 2 + 3);?
Answer: B) 123
Question 365: Which of the following is a correct way to write an anonymous function?
Answer: D) All of the above
Question 366: Which method can be used to find the index of an element in an array?
Answer: D) Both A and B
Question 367: What will console.log(typeof {}); output?
Answer: A) object
Question 368: What is the output of console.log(1 + '1');?
Answer: C) '11'
Question 369: What is the output of console.log('hello'.charAt(0));?
Answer: A) h
Question 370: Which of the following is the correct syntax for creating an object in JavaScript?
Answer: C) Both A and B
Question 371: What will console.log([1, 2, 3].shift()); output?
Answer: A) 1
Question 372: Which method can be used to convert a string to lowercase?
Answer: A) toLowerCase()
Question 373: What is the output of console.log('10' - 1);?
Answer: B) 9
Question 374: Which operator is used to assign a value to a variable?
Answer: B) =
Question 375: What is the output of console.log([2] == [2]);?
Answer: B) false
Question 376: Which of the following is a way to define a function in JavaScript?
Answer: C) Both A and B
Question 377: What is the output of console.log(0 == '0');?
Answer: A) true
Question 378: Which of the following is the correct way to create an array in JavaScript?
Answer: C) Both A and B
Question 379: What is the output of console.log([1, 2] == [1, 2]);?
Answer: B) false
Question 380: What is the output of console.log('2' + 2);?
Answer: B) '22'
Question 381: What will console.log(typeof NaN); output?
Answer: A) number
Question 382: What is the output of console.log(true + false);?
Answer: C) 1
Question 383: Which of the following is a falsy value in JavaScript?
Answer: D) All of the above
Question 384: What will console.log(2 === '2'); output?
Answer: B) false
Question 385: Which of the following is the correct way to declare a variable in JavaScript?
Answer: D) All of the above
Question 386: What is the output of console.log(typeof null);?
Answer: A) object
Question 387: What will console.log('5' + 5); output?
Answer: A) '55'
Question 388: Which of the following is the result of console.log(typeof []);?
Answer: B) object
Question 389: What will console.log(5 + '5'); output?
Answer: B) '55'
Question 390: Which of the following is not a primitive data type in JavaScript?
Answer: B) Object
Question 391: What will console.log([1, 2, 3].pop()); output?
Answer: A) 3
Question 392: Which of the following is the correct way to concatenate two strings in JavaScript?
Answer: C) Both A and B
Question 393: What will console.log('Hello'.charAt(0)); output?
Answer: A) 'H'
Question 394: What is the output of console.log(1 + '1');?
Answer: B) '11'
Question 395: Which method is used to remove the last element from an array in JavaScript?
Answer: A) pop()
Question 396: What will console.log(typeof undefined); output?
Answer: A) undefined
Question 397: What will console.log('a' > 'A'); output?
Answer: A) true
Question 398: Which operator is used for strict equality in JavaScript?
Answer: C) ===
Question 399: What is the output of console.log([1] == true);?
Answer: A) true
Question 400: Which of the following methods can be used to convert a string to a number in JavaScript?
Answer: D) All of the above

Showing 351-400 of 500 questions

Contact Tech Spakes Training