Smart Future Point

Java Script MCQ

1. What is the correct syntax to declare a variable in JavaScript?



2. Which of the following is a JavaScript data type?



3. How do you create a function in JavaScript?



4. What is the output of the following code: console.log(typeof null);?



5. Which of the following is used to parse a JSON string in JavaScript?



6. How do you create an object in JavaScript?



7. Which of the following is a JavaScript framework?



8. What is the output of the following code: console.log(0.1 + 0.2 === 0.3);?



9. Which of the following is used to prevent default action in an event?



10. What is the purpose of the `this` keyword in JavaScript?



11. Which of the following methods can be used to convert a string to a number in JavaScript?



12. What will be the output of the following code: console.log(1 + '1');?



13. Which of the following is a way to create an object in JavaScript?



14. What is the purpose of the `setTimeout()` function in JavaScript?



15. Which of the following is used to handle exceptions in JavaScript?



16. What is the output of the following code: console.log(2 + '2');?



17. Which of the following is a way to create an array in JavaScript?



18. What will be the output of the following code: console.log(typeof NaN);?



19. Which of the following is used to define a block of code in JavaScript?



20. What is the purpose of the `window.onload` event in JavaScript?



21. Which operator is used to assign a value to a variable in JavaScript?



22. How can you write a comment in JavaScript?



23. What is the correct syntax for referring to an external script called "script.js"?



24. How do you create a function in JavaScript?



25. Which keyword is used to declare a variable in JavaScript?



26. Which method can be used to round a number to the nearest integer in JavaScript?



27. Which of the following is a JavaScript data type?



28. How do you call a function named "myFunction" in JavaScript?



29. Which keyword is used to exit a loop in JavaScript?



30. Which method adds an element to the end of an array in JavaScript?



31. How do you write an if statement in JavaScript?



32. Which method removes the last element of an array?



33. How can you convert a string to an integer in JavaScript?



34. Which of these is not a JavaScript loop?



35. What will the expression `typeof null` return?



36. What will `2 + '2'` return in JavaScript?



37. Which symbol is used for comments in JavaScript?



38. Which operator is used to assign a value to a variable?



39. Which keyword is used to declare a constant in JavaScript?



40. What is the correct syntax for referring to an external JavaScript file?



41. What does the `isNaN()` function do?



42. Which object is the top of the JavaScript scope chain?



43. Which method is used to write a message to the console in JavaScript?



44. What is the result of `typeof []` in JavaScript?



45. Which event occurs when the user clicks on an HTML element?



46. What will `Boolean(0)` return?



47. Which function can be used to parse a JSON string?



48. How do you find the length of a string in JavaScript?



49. Which symbol is used for strict equality in JavaScript?



50. What does the `addEventListener()` method do?



JavaScript Short Questions

1. What is JavaScript?

2. What are the main features of JavaScript?

3. What is a variable in JavaScript?

4. What are JavaScript data types?

5. What is an array in JavaScript?

6. What are JavaScript loops?

7. What is a function in JavaScript?

8. What is an event in JavaScript?

9. What is the difference between localStorage and sessionStorage in JavaScript?

10. What is the difference between == and === in JavaScript?

11. What is a closure in JavaScript?

12. Explain the concept of hoisting in JavaScript.

13. What is the difference between null and undefined in JavaScript?

14. What are arrow functions in JavaScript?

15. How does prototypal inheritance work in JavaScript?

16. What is the use of the ‘this’ keyword in JavaScript?

17. What are JavaScript Promises?

18. What are callbacks in JavaScript?

19. What is the event loop in JavaScript?

20. What are template literals in JavaScript?

21. Explain the use of async/await in JavaScript.

22. What is event delegation in JavaScript?

23. What is the purpose of the try...catch statement?

24. What are higher-order functions in JavaScript?

25. What is the difference between let, var, and const?

26. What is the difference between synchronous and asynchronous code?

27. What is destructuring in JavaScript?

28. What is the difference between for...in and for...of loops?

29. What are spread and rest operators in JavaScript?

30. What is the difference between function declaration and function expression?

31. What is memoization in JavaScript?

32. Explain the concept of debouncing in JavaScript.

33. What are data types in JavaScript?

34. How do you clone an object in JavaScript?

35. What is a promise chain in JavaScript?

36. What are the different ways to define a function in JavaScript?

37. How does JavaScript handle scope and scope chain?

38. What are Immediately Invoked Function Expressions (IIFE)?

39. What is a generator function in JavaScript?

40. What is the difference between Map and Object in JavaScript?

41. What is the purpose of the `bind()` method?

42. How does JavaScript handle memory management?

43. What is the DOM and how can you manipulate it with JavaScript?

44. What is a symbol in JavaScript?

45. What is JSON and how is it used in JavaScript?

46. What are modules in JavaScript?

47. What is the difference between window and document in JavaScript?

48. What is the use of the `setTimeout()` and `setInterval()` functions?

49. How can you handle errors in JavaScript?

50. What are service workers in JavaScript?

Coumputer Course

Popular Courses

(123)
Web Development
(123)
FULL STACK JAVA
PROGRAMING
(123)
PYTHON PROGRAMING
smartfuturepoint