Moodle JavaScript MCQ Test: Moodle JavaScript MCQs - Practice Questions
1. What does the '!=='' operator signify in JavaScript?
2. What does NaN stand for?
3. Which method removes the last element from an array and returns that element?
4. What does the 'map()' method do to an array in JavaScript?
5. Which statement is used to skip to the next iteration in a loop?
6. What is the result of the following code? ```javascript console.log(typeof null); ```
7. Which method is used to add an element to the end of an array?
8. Which operator is used to compare two values without considering their data type?
9. How do you call a function named 'myFunction'?
10. What is the result of the expression 'typeof null' in JavaScript?
11. Which built-in method returns the character at the specified index?
12. In JavaScript, how do you access the last element of an array?
13. How do you convert a string to uppercase in JavaScript?
14. Which of the following methods removes the first element from an array?
15. Which method is used to remove the first element from an array?
16. Which method is used to merge two or more arrays in JavaScript?
17. What is the output of the following code? ```javascript console.log(typeof NaN); ```
18. What does the 'let' keyword do in JavaScript?
19. What does the 'bind()' method do in JavaScript?
20. Which of the following is not a valid JavaScript variable name?
21. Which JavaScript method is used to remove the last element from an array?
22. Which method is used to join two or more arrays?
23. How can you deep clone an object in JavaScript?
24. What is the result of the following code? ```javascript console.log('Hello'.length); ```
25. Which event fires when the browser window is resized?
26. How can you check if a variable is undefined in JavaScript?
27. Which symbol is used for comments in JavaScript?
28. Which function is used to display a message in a dialog box?
29. In JavaScript, how do you check if an object has a specific property?
30. What is the result of the following code? ```javascript console.log(3 + '2' - 1); ```
31. What is the result of the expression '5' + 3 in JavaScript?
32. Which statement is used to skip the rest of the current iteration in a loop?
33. What is the difference between '==' and '===' operators in JavaScript?
34. In JavaScript, what does the 'finally' block do in a try-catch-finally statement?
35. Which built-in method returns the index within the calling String object of the first occurrence of the specified value?
36. In JavaScript, how do you initiate a loop that will continue while a condition is true?
37. Which method is used to select elements by their CSS class in JavaScript?
38. What is the result of the following code? ```javascript console.log(3 + 2 + '7');```
39. What is the purpose of the 'this' keyword in JavaScript?
40. What is the purpose of the 'Symbol' data type introduced in ES6?
41. How do you define a function in JavaScript?
42. What does the 'async' keyword do in a function declaration?
43. Which built-in method returns the characters in a string beginning at the specified location?
44. How can you implement a private variable in JavaScript?
45. What is the output of the following code? ```javascript console.log(1 + '2' + '2');```
46. How can you determine if a number is an integer in JavaScript?
47. Which statement is used to throw a user-defined exception in JavaScript?
48. What does the 'typeof' operator return for a null value?
49. How do you check if a variable is an array in JavaScript?
50. What is the primary function of the 'typeof' operator in JavaScript?