javascript mcq(multiple choice) question with answers

javascript MCQ (Multiple Choice Question) with answers

Javascript is one of the popular programming language among developers. It is a lightweight, object-oriented, and cross-platform scripting language. Javascript is widely used in many web frameworks like ReactJS, NodeJS, Angular, etc. Today more than 80% of websites use javascript as clientside. Javascript is mainly designed for DOM manipulation in browsers.

Javascript Features:-

  • Javascript is a lightweight, object-oriented, and cross-platform scripting language.
  • Javascript can be used for client-side form validation.
  • Javascript doesn't need any compiler to run the code.
  • It can be used to manipulate the DOM objects. 

1. Which of the keyword is used to define the variable in the javascript?
2. which of the method is used to get HTML element in javascript?
3. What does NaN means?
4. How do we put Javascript inside HTML?
5. What will be the output?
function myfunc() {
  console.log(name);
  console.log(age);
  var name = 'BBBootstrap';
  let age = 21;
}
myfunc(); 
6. What's the output of the following code?
for (var i = 0; i < 3; i++) {
  setTimeout(() => console.log(i), 1);
}
7. Which one is true?
const bird = {
    size: 'small',
};

const mouse = {
    name: 'Mickey',
    small: true,
};
8. Which of the following is not a javascript framework?
9. Which of the following tag used to write javascript code?
10. What will be the output?
var x;
console.log(x); 
x = 25;
11. What will be the output?
function output() {
    x = 33;
    console.log(x);
    var x;
}
output();
12. The "let" and " var" are known as:
13. What will be the output?
var x = 2;
var y = "2";
console.log(x==y);
14. What will be the output?
var x = 2;
var y = "2";
console.log(x===y);
15. What will be the output?
var x = 5;
var y = "5";
console.log(x + y);
16. Which one is not a comparison operator?
17. Which type of JavaScript language is?
18. Which symbol is used separate JavaScript statements?
19. Which event is related to the keyboard?
20. Which on is not a mouse event?

Remove adsremove