# PWA interview questions — Progressive Web Apps

Source: https://www.geekswithgeeks.com/en/pwa/pwa-interview-questions

> Master common PWA interview questions and discussion topics.

## Core PWA concepts

Common interview topics: What defines a PWA? Service worker lifecycle? Caching strategies? Difference between offline-first and network-first? How to handle service worker updates? What is the app shell model?

## Sample Q&A

Interview answer examples for common PWA questions.

```markdown
**Q: What's the difference between network-first and cache-first?**
A: Network-first fetches from the network first, falling back to cache if offline—ideal for pages that change often. Cache-first serves from cache immediately, checking the network for updates—ideal for static assets.

**Q: How do you handle service worker updates?**
A: Listen to the 'controllerchange' event and the 'message' event in the service worker. Use skipWaiting() to activate immediately or notify users to refresh.

**Q: What's the app shell model?**
A: The app shell is the minimal static shell (HTML, CSS, JS) cached aggressively. Dynamic content loads separately. This pattern enables instant loads and offline-first architecture.
```

Output:

```
Common interview questions and comprehensive answers prepared.
```

## Interview tips

Prepare with: Building a demo PWA, explaining trade-offs in caching strategies, discussing real-world PWA implementations (Twitter Lite, Spotify), and understanding browser compatibility.

Quick check

**Quiz:** What is the main purpose of a service worker in a PWA?

- [x] Intercept network requests, enable offline functionality, and handle caching
- [ ] Render the user interface
- [ ] Store user authentication tokens

*Answer:* Intercept network requests, enable offline functionality, and handle caching. Service workers are background scripts that intercept requests, manage caches, and enable offline support.
