22 PWA Interview Questions Every Developer Should Know in 2020
Tags: pwa, mobile, career, interview
Published: 2020-01-16 00:57:45

---
title: 22 PWA Interview Questions Every Developer Should Know in 2020
published: true
description: 22 Progressive Web Applications Interview Questions Every Developer Should Know in 2020
tags: #pwa #mobile #career #interview
canonical_url: https://www.fullstack.cafe/blog/pwa-interview-questions
cover_image: https://images.pexels.com/photos/442540/pexels-photo-442540.jpeg?auto=compress&cs=tinysrgb&dpr=2&w=500
---

PWAs are on the rise. Arguably Progressive Web Applications is the future of Web Development & Design. The PWA apps load like a regular web page but provide the feature to work offline, push notification, and device hardware access. Follow along and check the top 22 Progressive Web Applications interview questions and answers every full stack developer would be asked in 2020-2021.

> Originally published on [FullStack.Cafe - Real Tech Interview Questions And Answers For Devs](https://www.fullstack.cafe/blog/pwa-interview-questions)

### Q1: What is a progressive web app?
> Topic: **PWA**<br/>Difficulty: ⭐

The concept of the **progressive web app (PWA)** was approached by Google in late 2015. They are basically web applications (Website) but have look and feel like other native mobile apps. The progressive web app enabled websites can offer functionalities such as working offline, push notifications, and device hardware access.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/47055893/what-is-a-progressive-web-app-in-laymans-terms)
### Q2: What are some benefits of PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐

Benefits of the progressive web app:

1. **Smaller and Faster:**
The progressive web apps are much smaller in size than native apps. They don’t even need to install. That’s they are not wasting disc space and load very fast.
2. **Responsive Interface:**
Progressive web app (PWA) supported web pages are capable to fit in every screen sizes automatically. It could be a smartphone, tablet, desktop or laptop.
3. **No Updates Required:**
Most of the mobile apps need regular weekly updates. Like the normal website, progressive web apps (PWA) are always loaded latest updated version whenever the user interaction happens and no App or Play Store approval required.
4. **Cost Effective:**
Native mobile apps need to be developed for both Android and iOS devices separately and their development cost is very high. On the other hand, progressive web apps are had the same features but the fraction of the prior price.
5. **SEO Advantage:**
Progressive web apps are discoverable by search engines and load super-fast. Just like other websites, their links are sharable too. This, in other words, gives good user experience and result in SEO rank boost.
5. **Offline capabilities:**
Due to the support of service worker API, PWAs are accessible in offline or low internet connections.
6. **Security:**
PWAs are delivered over HTTPS connection and secure user-data over each interaction.
8. **Push Notifications:**
By the support of push notifications, PWAs can interact easily with the users and provide a really amazing user experience.
9. **Bypass the  app stores:**
PWAs don’t need the App store or Google play store support. Their updated version can be directly loaded from the web server without the requirement of app store approval. On the other hand, native apps need days of approval if any new update required. There are possibilities of getting rejected or banned.
10. **Zero installation:**
During browsing, progressive web app gets its own icon on phones and tablets, just like a mobile application, but without the need to go through the tedious and slow App Store installation process.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/47055893/what-is-a-progressive-web-app-in-laymans-terms)
### Q3: What makes an app a PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐

There are some key principles a web app should try to observe to be identified as a PWA. It should be:

* **Discoverable**, so the contents can be found through search engines.
* **Installable**, so it's available on the device's home screen.
* **Linkable**, so you can share it by simply sending a URL. 
*** Network independent**, so it works offline or with a poor network connection.
* **Progressive**, so it's still usable on a basic level on older browsers, but fully-functional on the latest ones.
* **Re-engageable**, so it's able to send notifications whenever there's new content available.
* **Responsive**, so it's usable on any device with a screen and a browser — mobile phones, tablets, laptops, TVs, fridges, etc.
* **Safe**, so the connection between you and the app is secured against any third parties trying to get access to your sensitive data.

🔗 **Source:** [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Introduction)
### Q4: Why do we need a web manifest for PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐

A **web manifest** file lists all the information about the website in a JSON format. Having this file is one of the requirements **to make the website installable**.

It usually resides in the root folder of a web app. It contains useful information, such as the app’s title, paths to different-sized icons that can be used to represent the app on a mobile OS (for example, as the home screen icon), and a background color to use in loading or splash screens. This information is needed for the browser to present the web app properly when installing, and on the home screen.

🔗 **Source:** [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs)
### Q5: What are some disadvantages of PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

**Disadvantages of the progressive web app:**

1. **Less access to system features:**
Currently, Progressive Web Apps have limited access to native system features than native apps. Also, all browsers are not supporting its full features but maybe in near future, it will be the new standard of development.

2. **More Android – Less Apple’s iOS:**
progressive web apps are currently, most supported by Android devices. Apple’s iOS is only partially supporting.

3. **No review standard:**
progressive web apps don’t need any kind of review system which is applicable for native apps from the app store. It may make the process faster but lack of promotional benefits from the app store.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/47055893/what-is-a-progressive-web-app-in-laymans-terms)
### Q6: What features do Progressive Web Apps have that native apps lacks?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

There are some: 

* **discoverability** - content in progressive web apps can easily be found by search engines but a content-centric native app like StackOverflow won't show among app store search results for content that it does offer access to, such as "pwa vs. native". This is a problem for communities like Reddit, which can't expose their numerous sub-communities to the app store as individual "apps".
* **linkability** - any page/screen can have a direct link, which can be shared easily
* **bookmarkability** - save that link to access an app's view directly  
* **always fresh** - no need to go through the app stores to push updates
* **universal access** - not subject by app stores [sometimes arbitrary policies](https://medium.com/@krave/apple-s-app-store-review-process-is-hurting-users-but-we-re-not-allowed-to-talk-about-it-55d791451b#.s2bse2bai) or (unintended) [geographic restrictions](https://android.stackexchange.com/questions/12538/how-can-i-circumvent-regional-restrictions-in-googles-play-store)
* **large data savings**, extremely important in emerging markets with expensive and/or slow Internet access. For example, e-commerce website Konga [cut data usage by 92% for the first load by migrating to a PWA](https://developers.google.com/web/showcase/2016/konga).
* **low friction of distribution** - if your progressive web app is online, it's already accessible for Android (and other mobile) users.
  * [65.5% of US smartphone users don't download any new apps each month](http://www.businessinsider.com/how-many-apps-people-download-per-month-2014-8)
  * PWAs eliminate the need to go to the app store, search for the app, click Install, wait for the download, then open the app. [Each of these steps loses 20% of the potential users.](https://www.youtube.com/watch?v=qmE_jpnYXFo&feature=youtu.be&t=96)

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/35504194/what-features-do-progressive-web-apps-have-vs-native-apps-and-vice-versa-on-an)
### Q7: What is a service worker?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

A **service worker** is a specific type of JS Script, which runs in the background of the user’s browser. It acts like a proxy server exists between your app, the browser and the network. Among other things, service workers allow apps to continue functioning offline in case the user loses internet connection.

Service Workers are a virtual proxy between the browser and the network. They finally fix issues that front-end developers have struggled with for years — most notably how to properly cache the assets of a website and make them available when the user’s device is offline.

They run on a **separate thread** from the main JavaScript code of our page, and don't have any access to the DOM structure. This introduces a different approach from traditional web programming — the API is non-blocking, and can send and receive communication between different contexts. You are able to give a Service Worker something to work on, and receive the result whenever it is ready using a Promise-based approach.

They can do a lot more than "just" offering offline capabilities, including handling notifications, performing heavy calculations on a separate thread, etc. Service workers are quite powerful as they can take control over network requests, modify them, serve custom responses retrieved from the cache, or synthesize responses completely.

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/primers/service-workers)
### Q8: What is the differences between a Hybrid Mobile App and a Progressive Web App?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

A **hybrid mobile app** usually refers to an application built using a combination of web and native technology that is distributed via a native app store. These apps go through Apple, Google, Microsoft, etc's app store review process.

A **Progressive Web App** is an application built using web technology that runs in the browser and may be added to the home screen. They do not need to be distributed via native app stores, but can be included in them. Microsoft includes PWAs in its Microsoft Store as of 2018 and Trusted Web Activities make it easier to submit PWAs to the Google Play Store.

Some hybrid mobile app platforms include PhoneGap (aka Cordova), Appcelerator Titanium, and Ionic. You don't need a platform to create a hybrid app, but they are helpful because they've already taken care of creating a bridge between native APIs and JavaScript APIs.

Progressive Web Apps simply run in the browser so they can be built with basic HTML, CSS and JavaScript.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/40820592/difference-between-a-progressive-web-app-and-a-hybrid-mobile-app)
### Q9: What is a fetch event?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

After a service worker is installed and the user navigates to a different page or refreshes, the service worker will begin to receive `fetch` events.

A `fetch` event fires every time any resource controlled by a service worker is fetched, which includes the documents inside the specified scope, and any resources referenced in those documents (for example if index.html makes a cross origin request to embed an image, that still goes through its service worker.)

Consider:
```js
self.addEventListener('fetch', function(event) {
  event.respondWith(
    caches.match(event.request)
      .then(function(response) {
        // Cache hit - return response
        if (response) {
          return response;
        }
        return fetch(event.request);
      }
    )
  );
});
```

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/primers/service-workers)
### Q10: What are some requirements to make the website installable as PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

To make the website installable, it needs the following things in place:

* A web manifest, with the correct fields filled in
* The website to be served from a secure (HTTPS) domain
* An icon to represent the app on the device
* A service worker registered, to make the app work offline (this is required only by Chrome for Android currently)

🔗 **Source:** [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Installable_PWAs)
### Q11: What is IndexedDB and how is it used by PWA?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

IndexedDB is a large-scale, NoSQL storage system. It lets you store just about anything in the user's browser. In addition to the usual search, get, and put actions, IndexedDB also supports transactions.

IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high performance searches of this data. While DOM Storage is useful for storing smaller amounts of data, it is less useful for storing larger amounts of structured data. IndexedDB provides a solution.

In a context of PWA a general recommendation for storing data offline:

* For the network resources necessary to load your app while offline, use the Cache API (part of service workers).
* For all other data, use IndexedDB (with a promises wrapper).

🔗 **Source:** [developers.google.com](https://developers.google.com/web/ilt/pwa/working-with-indexeddb)
### Q12: What is CacheStorage?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐

**CacheStorage** is a storage mechanism in browsers for storing and retrieving network requests and response. It stores a pair of Request and Response objects. The Request as the key and Response as the value.

**CacheStorage** is not a Service Worker API, but it enables SW to cache network responses so that they can provide offline capabilities when the user is disconnected from the network.

The `caches` (an instance of CacheStorage) object is used to access the CacheStorage, to retrieve, store and delete objects.

🔗 **Source:** [blog.bitsrc.io](https://blog.bitsrc.io/introduction-to-the-cache-storage-a-new-browser-cache-pwa-api-a5d7426a2456)
### Q13: Explain the service worker lifecycle
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐

A service worker has a lifecycle that is completely separate from your web page.

To install a service worker for your site, you need to register it, which you do in your page's JavaScript. Registering a service worker will cause the browser to start the service worker install step in the background.

Typically during the install step, you'll want to cache some static assets. If all the files are cached successfully, then the service worker becomes installed. If any of the files fail to download and cache, then the install step will fail and the service worker won't activate (i.e. won't be installed).

When installed, the activation step will follow and this is a great opportunity for handling any management of old caches.

After the activation step, the service worker will control all pages that fall under its scope, though the page that registered the service worker for the first time won't be controlled until it's loaded again. Once a service worker is in control, it will be in one of two states: either the service worker will be terminated to save memory, or it will handle fetch and message events that occur when a network request or message is made from your page.

<div class="text-center"/>
<img src="https://developers.google.com/web/fundamentals/primers/service-workers/images/sw-lifecycle.png" class="img-fluid" />
</div>


🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/primers/service-workers)
### Q14: How to update a service worker?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐

There will be a point in time where your service worker will need updating. When that time comes, you'll need to follow these steps:

* Update your service worker JavaScript file. When the user navigates to your site, the browser tries to redownload the script file that defined the service worker in the background. _If there is even a byte's difference in the service worker file compared to what it currently has, it considers it new._
* Your new service worker will be started and the install event will be fired.
* At this point the old service worker is still controlling the current pages so the new service worker will enter a waiting state.
* When the currently open pages of your site are closed, the old service worker will be killed and the new service worker will take control.
* Once your new service worker takes control, its activate event will be fired.

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/primers/service-workers)
### Q15: What are some service worker's caching strategies do you know?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐

Those three caching strategies are framework agnostic:

* **Cache only** - The SW expects to find the requested assets already here.
* **Network only** - This strategy is exactly the opposite of the previous one: we always access the network, without even querying the cache.
* **Stale while revalidate** - Similarly to the cache only strategy, the goal is to ensure a fast responses by delivering the data from the cache.
However, while the client request is served, a separate request is triggered to the server to fetch a newer version, if available, and store it into the cache.

Angular provides only two kind of caching strategy:
* **Performance (default)** - Here the goal is to optimise the response time. If a resource is available in the cache, this version is delivered. Otherwise a network request is executed to fetch and then cache it.
* **Freshness** - Used when it is required to deliver the latest data from the network. We can specify a timeout after which the request falls back to the cache and tries to deliver the required data from there.

🔗 **Source:** [dev.to](https://dev.to/paco_ita/service-workers-and-caching-strategies-explained-step-3-m4f)
### Q16: What is App Shell?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐

An **application shell** (or app shell) architecture is one way to build a Progressive Web App that reliably and instantly loads on your users' screens, similar to what you see in native applications.

The app "shell" is the minimal HTML, CSS and JavaScript required to power the user interface and when cached offline can ensure instant, reliably good performance to users on repeat visits. This means the application shell is not loaded from the network every time the user visits. Only the necessary content is needed from the network.

An application shell architecture makes the most sense for apps and sites with relatively unchanging navigation but changing content.

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/architecture/app-shell)
### Q17: What are some requirements to app shell?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐

The app shell should ideally:

* Load fast
* Use as little data as possible
* Use static assets from a local cache
* Separate content from navigation
* Retrieve and display page-specific content (HTML, JSON, etc.)
* Optionally, cache dynamic content

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/architecture/app-shell)
### Q18: What about PWA for iOS?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐⭐

Service worker is available in Safari 11.1, which shipped March 29, 2018 with iOS 11.3 and macOS 10.13.4.

Note:

* Service Worker + Cache API are both supported (Cache API is actually a pre-requisite for Service Worker support)
* There are some noticeable problems with Apple's implementation of Service Worker
* No "Add to Home Screen" prompt
* No Push API
* No Background Sync

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/29895387/service-workers-and-ios-safari)
### Q19: Is it possible to have multiple service workers?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐⭐

There's two things to keep in mind here:

* It's possible to register an arbitrary number of service workers for a given origin, as long as each service worker has its own unique scope
* The Cache Storage API (and other storage mechanisms, like IndexedDB) are shared throughout the entire origin, and by default there's no "sharding" or namespace segregation.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/40820592/difference-between-a-progressive-web-app-and-a-hybrid-mobile-app)
### Q20: What can service workers do that web workers cannot?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐⭐

* **Web Workers**  - provide a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface. In addition, they can perform I/O using XMLHttpRequest (although the responseXML and channel attributes are always null). Once created, a worker can send messages to the JavaScript code that created it by posting messages to an event handler specified by that code (and vice versa.)

* **Service Worker** - is essentially act as proxy servers that sit between web applications, and the browser and network (when available). They are intended to (amongst other things) enable the creation of effective offline experiences, intercepting network requests and taking appropriate action based on whether the network is available and updated assets reside on the server. They will also allow access to push notifications and background sync APIs.

```sh
               | Web Workers  | Service Workers  |
|--------------|--------------|------------------|
| Instances    | Many per tab | One for all tabs |
| Lifespan     | Same as tab  | Independent      |
| Intended use | Parallelism  | Offline support  |
```

Web Workers are handy to run expensive scripts without causing the user interface to freeze, while Service Workers are useful to modify the response from network requests (for example, when building an offline app).

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/38632723/what-can-service-workers-do-that-web-workers-cannot)
### Q21: What are some benefits of an app shell architecture with a service worker?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐⭐

The benefits of an app shell architecture with a service worker include:

* **Reliable performance that is consistently fast**. Repeat visits are extremely quick. Static assets and the UI (e.g. HTML, JavaScript, images and CSS) are cached on the first visit so that they load instantly on repeat visits. Content may be cached on the first visit, but is typically loaded when it is needed.

* **Native-like interactions**. By adopting the app shell model, you can create experiences with instant, native-application-like navigation and interactions, complete with offline support.

* **Economical use of data**. Design for minimal data usage and be judicious in what you cache because listing files that are non-essential (large images that are not shown on every page, for instance) result in browsers downloading more data than is strictly necessary. Even though data is relatively cheap in western countries, this is not the case in emerging markets where connectivity is expensive and data is costly.

🔗 **Source:** [developers.google.com](https://developers.google.com/web/fundamentals/architecture/app-shell)
### Q22: Is it possible to have truly persistent storage in a PWA and why may you want one?
> Topic: **PWA**<br/>Difficulty: ⭐⭐⭐⭐⭐

The answer is **No**. The user can delete the PWA (if installed on Android) and clear their browser's cache of everything from your PWA.

The Cache API is temporary by design, and the IndexedDB data can be wiped when the user clears their browser cache.

So to persist app's data across PWA installations you should use cloud storage via some API.

🔗 **Source:** [stackoverflow.com](https://stackoverflow.com/questions/56708828/is-truly-persistent-storage-possible-in-a-progressive-web-app)

> *Thanks 🙌 for reading and good luck on your interview!* <br/>*Please share this article with your fellow devs if you like it!* <br/>*Check more FullStack Interview Questions & Answers on 👉 [www.fullstack.cafe](https://www.fullstack.cafe)*