Single Choice Question

  1. Which keyword is used to make the function to be executed asynchronously?
    1. async
    2. await
    3. promise
    4. callback
  2. What is the difference between synchronous and asynchronous programming?
    1. Synchronous programming is executed in a single thread, while asynchronous programming is executed in multiple threads.
    2. Synchronous programming is executed in multiple threads, while asynchronous programming is executed in a single thread.
    3. Synchronous programming is executed in a single thread, while asynchronous programming is executed in a single thread.
    4. Synchronous programming is executed in multiple threads, while asynchronous programming is executed in multiple threads.
  3. What is the difference between callback function and promise?
    1. Callback function is executed immediately after the function is called, while promise is executed asynchronously.
    2. Callback function is executed asynchronously, while promise is executed immediately after the function is called.
    3. Callback function is executed immediately after the function is called, while promise is executed immediately after the function is called.
    4. Both callbacks function and promise are executed asynchronously.
  4. What are complete structure of a promise?
    1. The promise object has three states: pending, fulfilled, and rejected.
    2. The promise object has two methods: then and catch.
    3. The promise object has one method: resolve.
    4. The promise object has one method: reject.
  5. The keyword in error handler which is used to handle errors in a program is?
    1. catch
    2. finally
    3. then
    4. reject

True or False Question

  1. JavaScript is a single threaded language.
  2. Async function is a function that can be paused and resumed.
  3. Await is used to wait for a promise.
  4. A promise is an object that represents an operation that hasn't completed yet.
  5. Error handling is a process of handling errors in a program.
  6. Callback function is a function that is passed as an argument to another function.
  7. If a function returns a promise, it is considered asynchronous.
  8. A promise has three states: pending, fulfilled, and rejected.
  9. If a promise is resolved, the error handling will be executed.
  10. A promise can not be resolved or rejected.
  11. A promise can not be chained.
  12. If the function uses keyword await, it is considered asynchronous, which need to add async keyword.

Definition of Term

  1. Error Handling
  2. Callback Function
  3. Promise
  4. Async
  5. Await

Short Answer

  1. What is the difference between synchronous and asynchronous programming?
  2. What is the difference between callback function and promise?
  3. What are complete structure of a promise?
  4. What are the relationships between async and await?
  5. What are complete structure of error handling?