Which principle of object-oriented programming focuses on hiding internal implementation details and exposing only necessary information?
Inheritance
Encapsulation
Polymorphism
Abstraction
Which of the following is NOT a valid HTTP method used with the Fetch API?
POST
GET
CONNECT
DELETE
What is a common practice to avoid deeply nested callbacks when working with multiple asynchronous operations?
Chaining multiple '.then()' methods together.
Using nested 'try...catch' blocks extensively.
Employing synchronous functions exclusively.
Switching to a different programming language.
Which of these methods allows you to explicitly set the this value when calling a function in JavaScript?
this
.forEach()
.map()
.call()
.filter()
What is the primary difference between 'nextSibling' and 'nextElementSibling' in DOM traversal?
'nextSibling' might return a text node or comment, while 'nextElementSibling' only returns element nodes.
'nextSibling' traverses upwards in the DOM, while 'nextElementSibling' traverses downwards.
There is no difference; they are interchangeable.
'nextSibling' only works with elements, while 'nextElementSibling' works with any node type.
What does the 'Fetch API' return as the result of a successful network request?
A callback function for handling the response.
A Promise that resolves to a Response object.
The requested data directly as a JavaScript object.
An error object indicating a failed request.
What is a higher-order function in JavaScript?
A function that can only be called once.
A function that takes another function as an argument or returns a function.
A function that uses arrow syntax.
A function that does not have a return statement.
What will be logged to the console in this code snippet: console.log((function(a) { return a * a; })(5));?
console.log((function(a) { return a * a; })(5));
25
5
undefined
10
Consider the code: const myFunc = (a, b) => a + b;. What type of function is myFunc?
const myFunc = (a, b) => a + b;
myFunc
Constructor function
Generator function
Method
Arrow function
In JavaScript's event loop, what is the role of the 'microtask queue'?
It executes tasks that have been explicitly delayed with setTimeout.
It manages network requests and responses.
It processes promises and other tasks with higher priority than the main task queue.
It handles user interactions like clicks and scrolls.