JavaScript Skills Audio Quiz Quiz

  1. Promise Polyfill Functionality

    In JavaScript, what is the primary purpose of a Promise polyfill?

    1. To provide Promise functionality in environments where Promises are not natively supported
    2. To automatically retry asynchronous code on failure
    3. To handle CSS animations efficiently
    4. To polyfill only arrow functions
    5. To add types to all promise-based functions
  2. Arrow Function Syntax

    Which one of the following is the correct way to write an arrow function that returns the sum of two numbers 'a' and 'b'?

    1. (a, b) =u003E a + b
    2. function(a, b) =u003E { return a + b; }
    3. [a, b] =u003E { return a + b }
    4. a, b -u003E a + b
    5. (a; b) =u003E { return a + b }
  3. Identifying Closures

    What is a closure in JavaScript?

    1. A function having access to its own scope, the outer function's scope, and the global scope
    2. A way to close the browser tab automatically
    3. A block of code that runs immediately after it is defined
    4. An error handling mechanism
    5. A pre-compiled JavaScript file
  4. Async and Await

    What does the 'await' keyword do inside an 'async' function in JavaScript?

    1. It pauses the execution until the promise is resolved
    2. It runs the code synchronously
    3. It throws an error if the promise is rejected
    4. It creates a new thread
    5. It defines a global variable
  5. LRUCache Implementation

    Which feature does a typical Least Recently Used (LRU) cache provide?

    1. Removes the least recently accessed entry when the maximum size is reached
    2. Always keeps the oldest entry regardless of access
    3. Caches only successful network requests
    4. Uses only weak references to stored objects
    5. Ignores duplicate cache keys
  6. Higher-Order Functions

    What is a higher-order function in JavaScript?

    1. A function that takes another function as an argument or returns a function
    2. A function that always executes asynchronously
    3. A function that is hoisted to the top of its scope
    4. A function with infinite recursion
    5. A function only usable inside classes
  7. Object.entries() Usage

    What does Object.entries(obj) return in JavaScript?

    1. An array of key-value pairs from the object
    2. A list of all values of the object
    3. A function reference to the object constructor
    4. A sorted array of object keys
    5. An iterable of prototype methods
  8. Identifying Asynchronous Patterns

    Which of the following is NOT a recognized asynchronous programming pattern in JavaScript?

    1. Thread locks
    2. Promises
    3. Callbacks
    4. Async functions
    5. Event listeners
  9. Code Output: String Manipulation

    Given the code snippet: const result = 'hello'.split('').reverse().join(''); What is the value of 'result'?

    1. olleh
    2. hello
    3. hellohello
    4. ehllo
    5. heoll
  10. Dictionary Lookups in JavaScript

    In JavaScript, which approach checks if a string 'word' exists as a key in a given dictionary object called 'dict'?

    1. 'word' in dict
    2. dict.hasString(word)
    3. word == dict.key
    4. dict[word] = true;
    5. dict.includes(word)