Moodle JavaScript MCQ Test: Moodle JavaScript MCQs - Practice Questions
1. Which event fires when the browser window is resized?
2. What is the purpose of the 'Symbol' data type introduced in ES6?
3. What is the result of the expression '5' == 5 in JavaScript?
4. Which statement is used to skip the rest of the current iteration in a loop?
5. Which method returns the calling string value converted to lowercase?
6. How do you round the number 7.25 to the nearest integer in JavaScript?
7. What does the 'parseInt()' function do in JavaScript?
8. What is the result of the following code? ```javascript console.log(3 + '2' - 1); ```
9. Which built-in method reverses the order of the elements of an array?
10. How do you declare a constant variable in JavaScript?
11. What is the result of the following code? ```javascript console.log(3 * '3');```
12. Which event fires when an HTML element loses focus?
13. Which method is used to add an element to the end of an array?
14. What does the 'yield' keyword do in JavaScript?
15. Which method is used to remove the first element from an array?
16. In JavaScript, what does the 'finally' block do in a try-catch-finally statement?
17. How do you define a function expression in JavaScript?
18. What is the difference between '==' and '===' operators in JavaScript?
19. How do you define a function in JavaScript?
20. How do you declare a variable in JavaScript?
21. What does the 'new' keyword do in JavaScript?
22. What does the 'concat()' method do in JavaScript?
23. Which method removes the last element from an array and returns that element?
24. In JavaScript, how do you initiate a loop that will continue while a condition is true?
25. Which JavaScript method is used to remove the last element from an array?
26. In JavaScript, how do you check if an object has a specific property?
27. Which built-in method returns the characters in a string beginning at the specified location?
28. In JavaScript, which statement is used to jump out of a loop?
29. Which of the following methods removes the first element from an array?
30. Which built-in method returns the index within the calling String object of the first occurrence of the specified value?
31. What does the 'map()' method do to an array in JavaScript?
32. What is the purpose of the 'this' keyword in JavaScript?
33. Which operator is used to compare two values without considering their data type?
34. What is the result of the following code? ```javascript console.log(3 + 2 + '7');```
35. In JavaScript, how can you check the length of an array?
36. What is the result of the expression 'typeof null' in JavaScript?
37. What does the '!=='' operator signify in JavaScript?
38. Which symbol is used for string concatenation in JavaScript?
39. Which method is used to sort elements in an array in JavaScript?
40. In JavaScript, how do you access the last element of an array?