Privacy by Design and Default Questions
Designing privacy into products, architectures and the software development lifecycle instead of bolting it on afterward. Covers the privacy-by-design principles and privacy-protective defaults, data minimization and purpose limitation at design time, personal-data flow mapping and PII inventory for a feature, consent and preference design including consent storage, enforcement across web and mobile and region-specific consent flows, retention and deletion design including legal holds, deletion across backups and immutable logs, provable deletion, and data-subject access, export and erasure flows, PII-safe logging, telemetry and session replay, on-device processing to limit data exposure, privacy-versus-personalization trade-offs, privacy in ML training data, feature stores and erasure from trained models, and privacy review gates, checklists, CI/CD checks, release readiness and requirements traceability inside engineering workflows. Includes designing privacy-first features, reference architectures, remediating privacy design flaws and rollout programs across product teams, and working with product, legal and security partners. Cryptographic and statistical privacy techniques, formal impact assessments, data-protection law, cross-border transfer rules, vendor risk, and encryption or access-control mechanics are covered elsewhere.
You're asked to remove a popular personalization feature implemented with on-device ML models because of privacy concerns, but it improves engagement by ~10%. Propose alternative architectures or design changes that preserve value while reducing privacy risk, and outline an evaluation plan to compare them.
Sample Answer
Direct answer. First find out what the privacy concern actually is, because on-device models already keep raw data off the server, so removal may be a heavier fix than the risk needs. Then offer a ladder of designs from least to most change, test them against both engagement and a privacy-risk score, and pick the option that keeps most of the value at the lowest risk. The decision rule is written before the test starts.
Step 1: pin down the concern. Typical causes: the model infers sensitive traits (health, finances), the data is retained too long, a sync to the cloud exists, other apps or people could read the on-device store, or the feature is switched on without a clear choice. Each leads to a different fix, so ask privacy and legal what the specific objection is.
Step 2: alternatives, from least to most change
- Keep the model, shrink the inputs: remove sensitive categories from features, use coarse categories rather than item-level history, shorten the window, add decay (older actions count for less each day, so old history fades instead of accumulating).
- Change the defaults and controls: opt-in or a clear first-run choice, a visible "why this" and a reset button. This addresses consent without touching the model.
- Contextual personalisation: rank by the current session and context (time, screen, query) with no stored history. Usually lowest value, lowest risk.
- Cohort model: the server trains on aggregated groups of similar users (cohorts) and the device picks the closest cohort, so no individual history is stored. Needs a minimum group size so no cohort identifies a person.
- Remove the feature: the baseline for comparison.
Step 3: evaluation plan. Illustrative numbers: engagement without personalisation is 20%, and the feature lifts that by about 10% relative (10% of 20% is 2 points), to 22%. Decision rule: adopt an alternative if it retains at least half the lift. Half of 2 points is 1 point, so the bar is 21%.
- Detecting 20% against 21% needs a sample size. Significance of 5% (two-sided) is the false-alarm rate you accept: a 1 in 20 chance of declaring a difference when there is none. Power of 80% is the chance the test catches a real difference of this size, so 1 in 5 real effects of this size are missed. The two-proportion formula is n = (1.96 * sqrt(2 * pbar * (1 - pbar)) + 0.8416 * sqrt(p1(1-p1) + p2(1-p2)))^2 / (p1 - p2)^2, where 1.96 and 0.8416 are the normal-curve values for 5% two-sided significance and 80% power, p1 = 0.20, p2 = 0.21 and pbar = 0.205. That gives n = (1.1190 + 0.4805)^2 / 0.0001 = 25,582.5, rounded up to 25,583 users per arm (computed in python). With four arms (no personalisation, current feature, two alternatives) that is 102,332 users.
- Run for whole weeks, at least two, so weekday patterns and a novelty effect (a short-lived jump in engagement because something is new) do not mislead.
- Compare each alternative with the no-personalisation arm (the 21% bar is judged against the 20% baseline) using a correction for several comparisons: each extra comparison is another chance for a fluke to look significant, so split the 5% budget. With two comparisons, test each at 2.5%, which raises the sample to about 30,980 per arm (about 123,920 across four arms) (computed in python, same formula with 2.2414 in place of 1.96, the normal-curve value for a 2.5% two-sided level, so 2.24 would give about 30,952). Comparing an alternative directly with the current feature (21% against 22%) is a different test with a smaller gap relative to the noise: it needs about 26,493 per arm at the 5% level and about 32,082 at 2.5% (computed in python), so size the arms for whichever comparison the decision rests on.
- Guardrails (metrics that must not get worse even if the main metric wins): opt-out rate, support complaints, session length, and a privacy-risk score computed per design. An illustrative scoring rule: 1 point per personal field retained, plus 5 if sensitive categories can be inferred, plus 1 per 30 days of retention (rounded up), plus 5 if anything leaves the device. The current feature retains 12 fields, allows sensitive inference and keeps data 180 days: 12 + 5 + 6 + 0 = 23. Alternative 1 (smaller inputs) retains 5 fields, no sensitive inference, 30 days: 5 + 0 + 1 + 0 = 6. If alternative 1 shows 21.4% engagement (1.4 of the 2 points, 70% of the lift) it clears the 21% bar at about a quarter of the risk score.
Step 4: who signs off. Product owns the engagement trade-off, privacy and legal own the residual risk, and security owns the on-device protection. If the "10%" is an absolute rather than a relative gain, redo the sample size.
Pitfalls. Judging only by engagement will favour the risky design. A test too small to see a 1 point difference will say "no difference" when there is one.
You are designing the privacy settings screen for a mobile app. Which controls would you expose, how would you explain the trade-offs to users in plain language, and how do you make sure what the screen says matches what the system does?
Sample Answer
Direct answer
Expose a small set of real choices, grouped by what they affect, with privacy-protective starting values. Describe each in one plain sentence about what the app does and what you give up. Then make the screen true by wiring every toggle to an enforced check in the system and testing it.
Controls to expose
- Analytics and diagnostics (on or off): off unless the user opts in where possible.
- Personalization (use my activity to tailor suggestions).
- Location (never, while using, precise or approximate), linking to the system permission.
- Marketing messages and ad personalization, separate from account emails.
- Contacts, photos and microphone access, each separate.
- Data actions: download my data, delete my account, clear history.
- Sharing and visibility of the profile.
Fewer, meaningful toggles beat thirty vague ones. Keep legal terms out of the labels.
Plain-language explanations
Say what happens either way. Example: "Personalized suggestions: we use what you watch to suggest more. If off, you still get suggestions, but they are the same for everyone." Do not use guilt wording (labels that shame the person for saying no, such as "No thanks, I don't care about my privacy") or hide the off option behind extra taps; these are called dark patterns.
Making the screen match the system
- Store each choice as one preference record (one row per user and setting, such as
user 52, analytics = off, changed 3 May), and have services read it through a single check, not copies. In code that is one shared function,is_allowed(user, "analytics"), that every service calls, instead of each service keeping its own copy of the flag. - Enforce server-side as well as in the app, since a client toggle alone can be ignored by a backend job.
- Test: an automated test turns each toggle off, then asserts that the matching events, requests or jobs stop (for example, no analytics calls fire).
- Review: privacy sign-off whenever a new data use is added, so a new use gets a toggle or a notice.
- Propagate changes to downstream systems (the other services and data pipelines that use this data) within a stated time, for example 24 hours, by publishing a change event they consume. An app that was offline keeps the old value locally, so it syncs the stored preference at next launch before sending anything, and the server rejects events from users whose record says off.
Worked example
A user switches "Analytics" off. The next app launch makes no requests to the analytics endpoint (a test confirms this), the server stops processing queued events for that user, and the screen shows when the change took effect.
You are building consent management for a mobile app that several backend services depend on. Lay out what you would build: how consent is captured, stored, and checked, and how other services learn that a user changed their mind.
Sample Answer
Direct answer
Build one consent service as the system of record. Clients capture choices per purpose, the service stores them as an append-only history, other services check against it, and every change is published as an event so downstream services update without polling. Consent here means the user's recorded choice for a specific purpose.
Capture
- The app shows a notice with a version number and one toggle per purpose (analytics, personalised ads, and so on), none pre-set to yes.
- Each choice is sent with user identity (or an anonymous device ID before login, merged at login), purpose, decision, notice version and timestamp.
- Offline: the SDK (software development kit) queues the change and syncs later, with the device's local time stored next to the server's recorded time.
Store
An append-only event log (one row per grant or revocation, only ever added to, never edited) plus a "current state" view derived from it. This keeps history for proof and a fast read for checks.
Check
- Services call a check API (user, purpose, minimum notice version) or read a cached snapshot.
- Fail closed (when unsure, deny): if the service is down and the cached answer is too old, treat consent-dependent processing as not allowed. Essential processing that does not rely on consent keeps working.
Telling other services the user changed their mind
| Mechanism | Role |
|---|---|
| Publish a consent-changed event to a message topic (a named channel that services subscribe to), with a per-user sequence number (a counter that rises by one for each change that user makes) | Fast push to subscribers |
| Subscribers ignore any event whose sequence number is lower than the last one they applied, and applying the same event twice changes nothing (idempotent) | Safe under retries and reordering |
| Short cache lifetime as a backstop | Covers a missed event |
| Nightly reconciliation (a job that compares each subscriber's stored state with the service and reports differences) | Catches drift |
Worked case for ordering: a user switches personalised ads on at 10:00 (sequence 7) and off at 10:05 (sequence 8). The ad service receives sequence 8 first and records "off"; sequence 7 then arrives late. Because 7 is lower than the 8 already applied, it is ignored and ads stay off. Without the rule, the late grant would silently turn ads back on.
Revocation must be as easy as granting (GDPR Article 7(3)). Stopping future processing is immediate; what happens to data already collected is a per-purpose decision (delete, keep aggregated, keep under another lawful basis) that legal confirms. For example, on revoking ads: stop targeting immediately; delete the user's ad-click history; keep the invoice records that tax law requires.
Conflict rule
If two devices change the same purpose offline, the later effective time wins, and a tie goes to the more restrictive choice. Example: a phone, offline, records analytics off at 09:00; a tablet records analytics on at 09:30; both sync at 11:00. The 09:30 choice is later, so analytics is on. If both had been stamped 09:30, the result would be off. Two details keep this consistent with the ordering rule above: the per-user sequence number is assigned by the consent service when it records the resolved outcome, not by arrival order, so a late-arriving offline event that loses the conflict is kept in history but does not become the current state; and the effective time is the device time clamped to the server's receipt time (a device clock set in the future is not trusted), with the server's recorded time stored beside it as noted under capture.
Pitfall
Checking consent only in the app is not enough: the backend must enforce it, because clients can be out of date.
Users set privacy choices on the web, iOS and Android versions of your product. How do you make sure a choice made on one surface is synced and enforced consistently everywhere, including downstream analytics, marketing and personalization systems?
Sample Answer
Direct answer
Keep one server-side source of truth for choices, have every surface read and write through it, push changes to downstream systems as events, enforce at the point of use on the server (never only in the app), and verify continuously with reconciliation and an end-to-end test. A privacy choice here means a per-purpose setting such as analytics, personalised recommendations or marketing.
Sync across web, iOS and Android
- All three clients call the same consent API. Each choice has a version number and timestamp.
- Clients refresh on launch and on returning to the foreground, and receive a push or live-connection message when another surface changes the choice.
- Before login, a choice attaches to a device or browser ID and is merged into the account at login; if the account has a different choice, the more restrictive one applies until the user confirms.
- Browser opt-out signals (Global Privacy Control, a browser setting that tells every site the user opts out of having their data sold or shared) count as a choice where the rules require it; counsel confirms where.
Enforcement in downstream systems
| System | What a change must do |
|---|---|
| Analytics | Event gateway drops or strips events for purposes the user declined; client SDK also stops sending |
| Marketing | Sync the suppression list (the list of people who must not be contacted or targeted) to the email and ad tools and remove the user from audiences (the target groups ad tools build) |
| Personalization | Stop using the user's data as input and flush derived profiles and cached recommendations |
Granular controls matter: separate toggles for recommendations and for tracking mean a change to one must not silently change the other. After a change, new collection and new use stop immediately; historic data is handled per purpose (delete, de-identify by removing what links it to the person, or keep under another lawful basis, meaning a different legal ground such as a contract or a legal duty).
Timeline example: the user turns marketing off on the web at 10:00, which is version 12. iOS last synced at 09:55 and still shows "on". The service pushes the change to the email tool and the iOS app within the target; if the push is missed, iOS refreshes when it returns to the foreground. If instead iOS had recorded its own change at 09:58 while offline, the later timestamp (10:00, web) wins.
Proving it works
- Reconciliation job (a scheduled check): compare the consent service's state with each downstream list and alert on mismatches.
- Synthetic test user: toggle on one surface, then assert on the others and downstream within the agreed propagation target (a number written down per system, for example 15 minutes for email lists and 5 minutes for analytics; illustrative values).
- Metric: share of users with a mismatch, trended.
Pitfall
A client-only gate fails for old app versions and for server-side events. Enforce at ingestion too.
A mobile app wants to ask permission to use location and contacts for a new feature. Design the flow: when to ask, what to say, how to record the decision, and how the user can change it later.
Sample Answer
Short answer. Ask at the moment the user taps the feature that needs the data, never at app launch. Ask for location and contacts separately, explain the benefit in one plain sentence, store the decision with its context, and give the user an in-app settings screen that can reverse it.
1. When to ask
- Trigger on intent. Example feature: "Find friends nearby". The user taps it, and only then do you ask. Android's own guidance is to request a permission in context, when the user starts interacting with the feature that needs it.
- One permission per moment. Location first (for "nearby"), contacts only when the user taps "Find friends from my contacts". Bundling both on first launch drives denials and collects data you may never use.
- Prefer less access. Ask for "while using the app" and approximate location if approximate is enough. For contacts, a system contact picker (a screen the phone itself shows, listing the address book, where the user taps the few people to share; the app receives only those) needs no blanket contacts permission.
2. What to say
Use your own short screen before the operating system (OS) dialog only if it adds information (on Android, the system can tell the app that the user has already declined this permission once, and Android suggests an explanation screen at that point, always with a "no thanks" path). Example copy:
- Title: "Find friends who are already here"
- Body: "We use your approximate location while the app is open to show people within 5 km. We do not store your location history."
- Buttons of equal size and weight: "Continue" and "Not now".
Transparency without nudging: no guilt wording ("Don't you want friends?"), no fake urgency, no pre-ticked options, no hiding "Not now" in a small grey link. The copy must match what the app really does, because the OS prompt text and your privacy notice must agree with it.
3. How to record the decision
The OS stores the permission state. The app also stores a consent record per purpose (a purpose is the specific reason, such as "nearby friends"):
user_ref | purpose | choice | timestamp (UTC) | app_version | copy_version
u_81f3 | nearby_friends | granted | 2026-03-02T10:14:09Z | 5.2.0 | loc-v3
u_81f3 | contact_match | declined| 2026-03-02T10:15:41Z | 5.2.0 | con-v2
Keep it server-side if the feature processes data on your servers (for example uploading hashed contacts, meaning phone numbers scrambled one-way so the server can compare them with members' scrambled numbers without storing readable ones; they are still other people's data, so that is its own explicit step). Be honest about the protection: phone numbers come from a small, guessable set, so anyone can hash every possible number and match them, which means a plain hash hides little from a determined server-side attacker. Use a keyed hash or a private set intersection scheme where you can, upload only after the explicit step, delete the upload when the user turns the purpose off, and do not describe the hashed upload to users as anonymous. Re-read the OS state on every app resume, because the user may have changed it in system settings.
4. How the user changes it later
A "Privacy" screen with one toggle per purpose, showing the live OS state. Turning off a purpose stops collection and deletes data derived from it (uploaded contact hashes, cached locations). If the OS state must change, deep-link (a link that opens the phone's Settings straight on this app's page) to it.
5. If the user says no
Disable only that feature and show a calm "Turn on in Settings" hint inside it. On Android, after two denials the system stops showing the dialog, so do not loop; do not nag. On iOS the system prompt for a given permission appears only once; after a denial the only route is the Settings screen, so the in-feature hint should say so and deep-link there.
What would change this: if the feature works with the picker or coarse location, skip the stronger permission entirely. Counsel decides whether a separate consent record is legally required for your markets.
Unlock Full Question Bank
Get access to all 12 Privacy by Design and Default interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.