1. What is the scope of a variable declared with the 'let' keyword?
A) Global scope
B) Block scope
C) Function scope
D) None of the above
Show Explanation
2. What does the value 'undefined' represent in JavaScript?
A) Variable is not declared
B) Variable has been deleted
C) Variable has been declared but not assigned
D) None of the above
Show Explanation
3. What is the primary purpose of a Promise in JavaScript?
A) To create synchronous operations
B) To manage multiple events
C) To handle error exceptions
D) To handle asynchronous operations
Show Explanation
4. What does the 'this' keyword refer to in JavaScript?
A) The current execution context
B) A global variable
C) A function parameter
D) None of the above
Show Explanation
5. What is a key feature of arrow functions in JavaScript?
A) They have their own 'this' context
B) They cannot use parameters
C) They inherit 'this' from the parent scope
D) They are slower than regular functions
Show Explanation
6. What does 'NaN' stand for in JavaScript?
A) Not an Object
B) Not-a-Number
C) Non-available Number
D) None of the above
Show Explanation
7. Which API is commonly used in JavaScript for making HTTP requests?
A) XMLHttpRequest
B) jQuery AJAX
C) Axios
D) Fetch API
Show Explanation
8. What does the 'addEventListener' method do in JavaScript?
A) Adds an event handler to an element
B) Removes an event handler from an element
C) Retrieves an event handler
D) None of the above
Show Explanation
9. What does the 'map' method do in JavaScript arrays?
A) Modifies the original array
B) Reduces the array to a single value
C) Creates a new array with the results of applying a function to each element
D) None of the above
Show Explanation
10. What is a closure in JavaScript?
A) A type of function
B) A way to create global variables
C) A syntax error
D) A function retaining access to its lexical scope
Show Explanation
11. What is the purpose of the 'break' statement in JavaScript?
A) To pause execution
B) To exit a loop or switch
C) To create an infinite loop
D) None of the above
Show Explanation
12. What does the 'forEach' method do in JavaScript arrays?
A) Executes a function for each element
B) Creates a new array
C) Modifies the original array
D) None of the above
Show Explanation
13. What is the purpose of the 'setTimeout' function?
A) To delay execution indefinitely
B) To execute a function immediately
C) To execute a function after a delay
D) None of the above
Show Explanation
14. What is the difference between '==' and '===' in JavaScript?
A) There is no difference
B) '==' performs type coercion, while '===' does not
C) '==' is faster than '==='
D) None of the above
Show Explanation
15. What does the 'slice' method do in JavaScript arrays?
A) Modifies the original array
B) Sorts the array
C) Removes elements from the array
D) Returns a shallow copy of a portion of the array
Show Explanation
16. What do 'async' and 'await' keywords do in JavaScript?
A) Handle asynchronous operations in a cleaner way
B) Create synchronous functions
C) Provide a way to handle exceptions
D) None of the above
Show Explanation
17. What does the 'bind' method do in JavaScript?
A) Calls a function with a given 'this' value
B) Creates a new object
C) Returns a new function with 'this' set to the specified value
D) None of the above
Show Explanation
18. What is 'hoisting' in JavaScript?
A) A type of function
B) Moving variable declarations to the top of their scope
C) A method for asynchronous calls
D) None of the above
Show Explanation
19. What is a promise in JavaScript?
A) A synchronous operation
B) A method for data storage
C) A type of error handling
D) An object for asynchronous operation handling
Show Explanation
20. What does the 'reduce' method do in JavaScript?
A) Reduces an array to a single value
B) Filters the array
C) Modifies the original array
D) None of the above
Show Explanation