Master Service Worker vocabulary: registration, install/activate lifecycle, fetch interception, cache strategies (cache-first, network-first), and background sync.
0 / 10 completed
1 / 10
Calling navigator.serviceWorker.register('/sw.js') does which of the following?
register() is the entry point: the browser fetches the script, checks if it differs from the installed version, and if so begins the install lifecycle. It does NOT immediately intercept requests — the worker must install and activate first.
2 / 10
The service worker 'install' event is typically used to:
The install handler is the ideal place to populate the cache with shell assets. Wrapping cache.addAll() in event.waitUntil() delays activation until caching completes — if caching fails, the install fails and the old worker stays active.
3 / 10
The 'activate' event fires when:
Activate fires after a new service worker successfully installs and any previously active version is no longer in use. It is the correct place to delete stale caches: event.waitUntil(caches.delete('old-cache-v1')).
4 / 10
The 'network-first' caching strategy means the service worker will:
Network-first prioritises fresh data: the service worker tries the live request, caches the result, and falls back to cache on failure (offline or server error). Best for dynamic content like API data where stale information would be misleading.
5 / 10
Background Sync allows a web app to:
Background Sync lets apps register a sync tag (registration.sync.register('send-message')). The service worker listens for the sync event and processes queued work when online. The browser may retry on failure. The user's tab does not need to be open.
6 / 10
John from the Frontend team just commented on your PR: 'I'm seeing inconsistent offline behavior. The service worker seems to be aggressively caching outdated assets after a recent update. Can you investigate using the postMessage API to ensure the latest version is being served?' Which of the following best describes what postMessage could be used for in this context?
postMessage is used for inter-message communication between different contexts (like a service worker and a webpage). In this scenario, John wants to ensure the web page receives the latest assets – effectively telling the service worker to refresh its cache. The incorrect options all represent actions that would either directly manipulate the cache or prevent the desired update; postMessage is for requesting an action.
7 / 10
During a standup meeting, you're asked about your progress on implementing offline support. You explain that your service worker is configured to use 'network-first' caching. What does this primarily mean regarding the order in which the service worker handles asset requests?
'Network-first' caching means the service worker initially attempts to retrieve assets directly from the network. If the asset is found in the network, it's served to the user; only if the network fails does the service worker then check its cache for a stored copy. This approach ensures users get the latest version of assets whenever possible, and avoids serving potentially outdated cached versions.
8 / 10
You're reviewing a PR that includes a background sync implementation. The code uses the SyncInfo object to specify which data should be synchronized. What is the primary purpose of the SyncInfo object?
The SyncInfo object is crucial for background sync. It dictates *what* needs to be synced and *when* – in this case, the developer has defined that certain data should be synchronized when the device is offline or at a specific interval. The other options relate to different aspects of service worker functionality but aren't the core purpose of SyncInfo.
9 / 10
Sarah from Operations sends you a Slack message: 'We're seeing increased app usage on mobile devices with poor network connectivity. The service worker is aggressively caching assets to improve the user experience, but this seems to be exacerbating the problem.' What technical strategy would MOST directly address Sarah's concern?
Sarah's observation highlights that overly aggressive caching can be detrimental when connectivity is unreliable. Reducing the cache size will limit the amount of potentially outdated data stored, preventing the service worker from serving stale assets and thus alleviating the issue. The other options would worsen the problem in this scenario.
10 / 10
You're debugging a web app that uses a service worker to manage offline assets. The service worker is logging messages indicating it's attempting to fetch an image from the network when the user is actively browsing online. What is the MOST likely cause of this behavior?
A race condition occurs when multiple processes attempt to access or modify shared resources simultaneously. In this case, the service worker might initiate a fetch before the web page has fully loaded and determined that it needs the image. This can lead to redundant network requests and unexpected behavior. While network instability could contribute, the core issue is the timing mismatch.
This exercise, "Service Worker Vocabulary", tests your understanding of wasm browser vocabulary and phrasing through 10 multiple-choice questions drawn from real workplace scenarios.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 10 questions. Each one presents a realistic sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Who is this Wasm Browser exercise for?
It's designed for IT professionals and learners who want to sound natural discussing wasm browser topics in English — useful for meetings, documentation, interviews, and day-to-day communication with English-speaking teams.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more Wasm Browser exercises?
Browse the full Wasm Browser exercises hub for more practice, or explore other exercise categories covering vocabulary, grammar, interviews, and workplace communication.