Moodle JavaScript MCQ Test: Moodle JavaScript MCQs - Practice Questions
1. What is the output of the expression '3' + 2 + 1 in JavaScript?
2. In JavaScript, what does the 'finally' block do in a try-catch-finally statement?
3. What is the result of the expression '5' + 3 in JavaScript?
4. What is the primary function of the 'typeof' operator in JavaScript?
5. Which method removes the last element from an array and returns that element?
6. What does the 'parseInt()' function do in JavaScript?
7. How do you declare a variable in JavaScript?
8. What does the 'async' keyword do in a function declaration?
9. Which event fires when an HTML element loses focus?
10. What does the 'typeof' operator return for a null value?
11. What is the purpose of the 'this' keyword in JavaScript?
12. What is the purpose of the 'Symbol' data type introduced in ES6?
13. How can you deep clone an object in JavaScript?
14. What does the 'continue' statement do in a loop?
15. What is the result of the following code? ```javascript console.log(3 * '3');```
16. What is the result of the expression 'typeof null' in JavaScript?
17. Which built-in method reverses the order of the elements of an array?
18. In JavaScript, how can you check the length of an array?
19. In JavaScript, how do you initiate a loop that will continue while a condition is true?
20. How do you convert a string to uppercase in JavaScript?
21. Which statement is used to throw a user-defined exception in JavaScript?
22. How can you implement a private variable in JavaScript?
23. What does the '!=='' operator signify in JavaScript?
24. How do you define a function in JavaScript?
25. What is the output of the following code? ```javascript console.log(1 + '2' + '2');```
26. How do you call a function named 'myFunction'?
27. What does NaN stand for?
28. What does the 'bind()' method do in JavaScript?
29. What is the difference between '==' and '===' operators in JavaScript?
30. What is the output of the following code? ```javascript console.log(typeof NaN); ```