Bird
0
0

You want to send 100 API requests in batches of 10 asynchronously to avoid overloading the server. Which approach correctly implements this in JavaScript?

hard📝 Application Q15 of 15
Rest API - Batch and Bulk Operations
You want to send 100 API requests in batches of 10 asynchronously to avoid overloading the server. Which approach correctly implements this in JavaScript?
ASend requests one by one using a for loop with await inside.
BSend all 100 requests at once with Promise.all without batching.
CUse a forEach loop with async fetch calls without awaiting.
DSplit URLs into chunks of 10, then use Promise.all on each chunk sequentially.
Step-by-Step Solution
Solution:
  1. Step 1: Understand batch size control

    Sending all 100 requests at once may overload the server; batching limits concurrency.
  2. Step 2: Implement batch processing

    Split URLs into groups of 10, then await Promise.all for each batch sequentially.
  3. Final Answer:

    Split URLs into chunks of 10, then use Promise.all on each chunk sequentially. -> Option D
  4. Quick Check:

    Batch requests in chunks with Promise.all = Split URLs into chunks of 10, then use Promise.all on each chunk sequentially. [OK]
Quick Trick: Batch requests in small groups, await each batch [OK]
Common Mistakes:
MISTAKES
  • Sending all requests at once causing overload
  • Not awaiting async calls properly
  • Sending requests one by one losing async benefits

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes