Zscaler interview questions & answers

20 real Zscaler interview questions with full model answers — Technical, System design, Behavioral, Coding. Drawn from the same verified bank ChannelPulse drills from (49 Zscaler questions in total).

BehavioralMediumZscalerEngineering Manager

1. How do you handle architectural disagreements within your engineering team?

The full question

How do you handle architectural disagreements within your engineering team? Give an example of how you resolved one.

Model answer

Situation

On a team responsible for a high-traffic customer workflow, two senior engineers disagreed about a proposed architectural change. One favored a service split to improve independent scaling; the other wanted to keep the capability in the existing service to avoid operational overhead and delivery risk. The discussion was becoming positional, and the decision affected several teams and an upcoming launch.

Task

I needed to help the team make a timely, evidence-based decision, preserve a constructive working relationship, and ensure we had a clear owner and a way to revisit the choice if our assumptions proved wrong.

Action

  • I first met with each engineer to understand the underlying concerns, then restated the disagreement as hypotheses: expected scaling benefits versus added latency, deployment complexity, and on-call burden.
  • I brought the discussion back to shared criteria: customer impact, reliability, expected traffic, team capacity, reversibility, and cost to operate. We agreed on the criteria before debating solutions.
  • I asked the engineers to gather concrete data: current bottleneck profiles, projected load, failure domains, and the work required to split and operate the service. I made sure less senior engineers could contribute evidence without having to take sides.
  • We compared three options, including a smaller change that isolated the bottleneck within the existing service. I encouraged a time-boxed prototype and set a decision deadline so analysis would not become a way to avoid a decision.
  • Based on the evidence, I facilitated a decision to make the smaller change first, with explicit scaling and latency thresholds that would trigger a service split. I recorded the rationale, owner, risks, and revisit date in a short architecture decision record.

Result

The team shipped the change before the launch, met the agreed reliability and latency targets, and avoided taking on an unproven operational burden. The engineers aligned around the decision and later used the documented thresholds to revisit the architecture calmly. I learned that the goal is not to eliminate disagreement; it is to make assumptions visible, decide at the right level of reversibility, and preserve trust.

What interviewers listen for

  • You resolve conflict with evidence and shared goals, not authority or consensus at any cost.
  • You consider organizational and operational costs alongside technical quality.
  • You make a decision, document it, and define how to learn or revisit it.
BehavioralMediumZscalerSenior Engineering Manager

2. Can you discuss a time when you had to give a presentation on a controversial topic and how you handled the situation?

Model answer

Situation

At a previous company, I had to present a proposal to consolidate several teams’ services onto a shared platform. The change was controversial: some engineers worried it would reduce team autonomy, while product leaders were concerned about migration cost and delivery risk. I was accountable for presenting the recommendation to a mixed audience of engineering, product, and operations leaders.

Task

My goal was not simply to win approval. I needed to make the evidence and trade-offs clear, ensure dissenting views were represented fairly, and leave the group with a decision or a concrete path to reach one.

Action

  • I met with key stakeholders before the presentation, especially people who disagreed, to understand their strongest concerns and check that I was not presenting a straw-man version of their position.
  • I structured the presentation around the decision: the current problem, options considered, evaluation criteria, recommendation, risks, and what evidence might change my mind.
  • I separated measured facts from assumptions. For example, I showed the observed operational burden separately from the projected migration savings, and labeled the latter as an estimate.
  • I made the trade-offs explicit: consolidation could improve reliability and reduce duplicated work, but a rushed migration could disrupt roadmap delivery and create a new central bottleneck.
  • During questions, I acknowledged valid objections before responding. When the discussion became heated, I restated the concern neutrally, answered what I could, and captured unresolved questions rather than arguing over tone.
  • I proposed a reversible pilot with success criteria and a review date, so the decision could be tested against evidence instead of framed as an all-or-nothing organizational change.

Result

The group agreed to a limited pilot rather than immediate broad migration. The pilot produced evidence on reliability, developer effort, and support load; use the actual results and decision outcome in a real interview. The process also improved stakeholder alignment because people could see their concerns reflected in the plan. I learned that handling controversy well means being candid about uncertainty, fair to opposing views, and disciplined about how a decision will be made.

What interviewers listen for

  • Preparation for disagreement and genuine stakeholder listening.
  • Clear evidence, assumptions, and trade-offs.
  • Ability to keep discussion constructive and move toward a decision.
BehavioralMediumZscalerEngineering Manager

3. How do you foster ownership, accountability, and continuous learning in a remote or geographically distributed team?

Model answer

Situation

I led a distributed engineering team across several time zones, where ownership was becoming uneven: work was handed off late, decisions were concentrated among a few people, and newer engineers had limited access to informal learning. The team was delivering, but unclear decision ownership and slow feedback were creating avoidable delays and a risk of burnout.

Task

I wanted to make accountability clear without relying on surveillance or expecting people to be online at the same time. I also wanted learning and knowledge sharing to be part of the team's normal work rather than an extra activity that disappeared under delivery pressure.

Action

  • I worked with the team to define outcomes and ownership for each initiative. Every project had a directly responsible owner, a written goal, success measures, key dependencies, and a decision log; ownership meant driving coordination and surfacing risks, not doing every task personally.
  • I introduced lightweight, asynchronous status updates focused on progress, next steps, and blockers. We agreed on response-time expectations for urgent versus routine issues and reserved overlapping hours for decisions that genuinely benefited from live discussion.
  • I made work and decisions discoverable through concise design notes, runbooks, and project channels. For example, when a service migration depended on another time zone, the owner documented the dependency and fallback plan rather than relying on a meeting or a private message.
  • I built in coaching through pairing, rotating technical reviews, and post-incident reviews that focused on system improvements rather than blame. I asked senior engineers to explain the reasoning behind feedback and gave less experienced engineers ownership of appropriately scoped decisions.
  • I reviewed team health and delivery signals regularly, including blocked time, missed commitments, review latency, incident follow-ups, and participation across locations. When a process added overhead without improving outcomes, I simplified it with the team.

Result

Ownership became more distributed, handoffs were clearer, and fewer issues waited for a particular person or time zone. We also saw more engineers lead reviews and propose improvements, while retrospectives produced specific follow-up actions. I learned that remote accountability depends on clarity, trust, and visible work—not activity monitoring.

What interviewers listen for

  • You create clear ownership while delegating real authority.
  • You adapt communication to time zones and asynchronous work.
  • You build learning, inclusion, and blameless improvement into delivery.
BehavioralMediumZscalerEngineering Manager

4. Describe a time a direct report was underperforming.

The full question

Describe a time a direct report was underperforming. How did you identify the cause and support their improvement?

Model answer

Situation

In an example I would adapt to my own experience, a direct report was consistently missing delivery commitments and was quieter in design discussions than I expected for their level. The pattern affected a project with dependencies across two teams, but I did not want to jump from missed dates to a conclusion about motivation or capability. My responsibility was to understand the cause, protect the project, and give the person a fair, direct opportunity to improve.

Task

I needed to establish what was getting in the way, align on role expectations, and create a measurable support plan. I also had to keep partner teams informed without exposing private performance details.

Action

  • I gathered specific examples before the conversation: the agreed milestones, actual outcomes, review-cycle delays, and where estimates changed. I separated observable behavior from interpretation and checked whether unclear scope or dependencies contributed.
  • I held a private, candid one-on-one. I described the pattern and its impact, then asked open questions and listened. The person explained that they were unsure how to break down ambiguous work and were hesitant to surface uncertainty because they feared appearing inexperienced.
  • I clarified the expected outcomes and asked what support would help. Together we created a six-week plan with smaller milestones, early design reviews, and a short weekly check-in. I paired them with a senior engineer for decomposition—not to take ownership away, but to model the approach.
  • I made progress observable: milestone completion, risks raised early, and feedback from partner teams. I gave timely feedback when commitments were met and addressed slips immediately, asking what changed and adjusting the plan where new information justified it.
  • I kept the project moving by renegotiating one dependency and assigning a backup reviewer, while communicating only the delivery plan—not confidential performance details—to stakeholders.

Result

By the end of the plan, the report was meeting the smaller commitments, escalating risks earlier, and leading design discussions with less prompting. The project recovered its delivery plan, and we agreed on continued coaching around ambiguous work. I learned to combine empathy with clarity: support should be specific and time-bound, and expectations should not be lowered silently. If progress had not followed, I would have documented the gap and moved to the organization’s formal performance process.

BehavioralMediumZscalerGroup Product Manager

5. How do you gain respect from your team members?

Model answer

Situation

“When I took on [team or portfolio], I noticed that trust varied across functions. Product decisions were sometimes revisited late, and team members did not always see how their expertise influenced the direction. As the product leader, I knew respect would come from consistent behavior and sound judgment—not from my title.”

Task

“My goal was to build credibility with individual contributors while creating a team environment where people could disagree, understand decisions, and do their best work. I needed to balance listening with making timely calls when the group could not reach consensus.”

Action

  • “I started by learning the work: I met with engineers, designers, analysts, and operators to understand their customers, constraints, and definitions of quality. I asked where product decisions were helping or creating friction, then reflected back what I heard and followed up on specific issues.”
  • “I made the reasoning behind priorities visible. For example, when we chose [priority] over [competing request], I explained the customer evidence, expected impact, cost, and what would change my mind. That made disagreement about the decision possible without making it personal.”
  • “I showed respect for expertise by involving the right people early, crediting their contributions, and not presenting their work as my own. I also made decision ownership explicit so consultation did not become endless consensus-seeking.”
  • “When I made a mistake—such as [brief, genuine example]—I acknowledged it promptly, explained the correction, and changed [process or behavior]. Consistency after a mistake mattered more than trying to appear infallible.”
  • “I held the same standards for myself and the team: clear commitments, direct feedback, and follow-through. I tailored coaching to the person while keeping expectations equitable.”

Result

“Over [timeframe], [observable signal] improved—for example, fewer late escalations, stronger cross-functional feedback, or more decisions made at the team level. We also delivered [specific outcome], with contributors able to explain how their work connected to the customer goal. I learned that respect is earned repeatedly: by being prepared, fair, candid, and willing to change my mind when the evidence warrants it.”

What interviewers listen for

  • “Respect earned through actions, not authority.”
  • “Active listening, transparency, and appropriate credit.”
  • “Ability to handle disagreement while keeping decisions moving.”
BehavioralMediumZscalerEngineering Manager

6. Describe a time you had to present on a controversial topic.

The full question

Describe a time you had to present on a controversial topic. How did you handle it?

Model answer

Situation

At a previous company, I led the engineering organization responsible for a deployment system used by several dozen product teams. I presented a proposal to retire a popular self-managed tool and move teams to a shared platform. The topic was controversial: teams valued their autonomy, and some had invested months building workflows around the existing system.

Task

I needed to recommend a direction and earn a decision without dismissing legitimate concerns. The key tension was balancing team flexibility against reliability, security, and the operational cost of maintaining multiple implementations.

Action

  • I first met with affected team leads and platform engineers to understand what they feared losing. I separated evidence from assumptions and documented both the benefits of the current tool and its recurring failure modes.
  • I built a fact-based case using incident history, support hours, upgrade delays, and security findings. I also made the costs of migration visible rather than presenting the shared platform as free.
  • I structured the presentation around the decision to be made, the options considered, and the criteria: reliability, developer experience, security, and total ownership cost. I stated where the data was strong and where it was incomplete.
  • I invited a skeptical team lead to present the strongest case against the proposal. In response, I acknowledged that the platform did not yet support one critical workflow and proposed a time-bounded exception while we built it.
  • I recommended a staged migration: a volunteer pilot, published exit criteria, office hours, and a rollback path. I asked for questions before asking for a decision, and recorded open concerns with named owners.

Result

Leaders approved the pilot rather than forcing an immediate migration. Over the next quarter, the pilot met its reliability and adoption targets, and most teams chose to migrate; the remaining teams had clear, agreed exceptions. We reduced duplicated operational work and improved incident response. I learned that presenting a controversial recommendation is not about winning the room; it is about making the trade-offs explicit, showing respect for dissent, and creating a credible way to test the decision.

What interviewers listen for

  • Clear ownership and a decision-oriented narrative.
  • Evidence, empathy, and a fair account of opposing views.
  • Explicit trade-offs, meaningful stakeholder involvement, and measurable outcomes.
CodingEasyZscalerStaff Engineer

7. At 3:15, what is the angle between the hour and minute hands of an analog clock?

Model answer

function angleBetweenClockHands(hour, minute) {
  // Normalize the hour for a 12-hour clock.
  const hourPosition = (hour % 12) * 30 + minute * 0.5;
  const minutePosition = minute * 6;
  const difference = Math.abs(hourPosition - minutePosition);

  // Return the smaller angle between the hands.
  return Math.min(difference, 360 - difference);
}

console.log(angleBetweenClockHands(3, 15)); // 7.5
  • The minute hand moves 6° per minute; the hour hand moves 30° per hour plus 0.5° per minute.
  • At 3:15, the hour hand is at 97.5° and the minute hand is at 90°, so the smaller angle is 7.5°.

Complexity: O(1) time, O(1) space.

CodingMediumZscalerPrincipal EngineerVirtual onsite

8. Solve the Snake problem.

Model answer

class SnakeGame {
  constructor(width, height, food) {
    this.width = width;
    this.height = height;
    this.food = food;
    this.foodIndex = 0;
    this.score = 0;
    this.dead = false;

    // Ring buffer stores the body from tail to head.
    this.capacity = width * height;
    this.body = new Array(this.capacity);
    this.tailIndex = 0;
    this.headIndex = 0;
    this.body[0] = [0, 0];
    this.occupied = new Set([this.key(0, 0)]);

    this.directions = {
      U: [-1, 0],
      D: [1, 0],
      L: [0, -1],
      R: [0, 1],
    };
  }

  key(row, col) {
    return row * this.width + col;
  }

  move(direction) {
    if (this.dead) return -1;

    const delta = this.directions[direction];
    if (!delta) throw new Error(`Invalid direction: ${direction}`);

    const [headRow, headCol] = this.body[this.headIndex];
    const nextRow = headRow + delta[0];
    const nextCol = headCol + delta[1];

    // Hitting a wall ends the game.
    if (
      nextRow < 0 || nextRow >= this.height ||
      nextCol < 0 || nextCol >= this.width
    ) {
      this.dead = true;
      return -1;
    }

    const nextKey = this.key(nextRow, nextCol);
    const [tailRow, tailCol] = this.body[this.tailIndex];
    const tailKey = this.key(tailRow, tailCol);
    const eating =
      this.foodIndex < this.food.length &&
      this.food[this.foodIndex][0] === nextRow &&
      this.food[this.foodIndex][1] === nextCol;

    // The tail vacates its cell on a normal move, so moving into that
    // cell is legal. It does not vacate when the snake eats.
    if (this.occupied.has(nextKey) && (eating || nextKey !== tailKey)) {
      this.dead = true;
      return -1;
    }

    if (!eating) {
      this.occupied.delete(tailKey);
      this.tailIndex = (this.tailIndex + 1) % this.capacity;
    } else {
      this.score += 1;
      this.foodIndex += 1;
    }

    this.headIndex = (this.headIndex + 1) % this.capacity;
    this.body[this.headIndex] = [nextRow, nextCol];
    this.occupied.add(nextKey);

    return this.score;
  }
}

// Example:
// const game = new SnakeGame(3, 2, [[1, 2], [0, 1]]);
// game.move("R"); // 0
// game.move("D"); // 0
// game.move("R"); // 1
  • Keep the body in a fixed-size ring buffer and track occupied cells in a Set for constant-time updates.
  • Check collision before moving, but allow entering the current tail cell when it vacates on this move. Eating prevents that exception.
  • Return the score after a legal move and -1 after a wall/body collision; subsequent moves remain game over.

Complexity: O(1) time per move and O(width × height) space for the body buffer and occupancy set.

CodingMediumZscalerPrincipal Engineer

9. Write a decision-making routine that determines whether a service should route a request to the cache or the database.

Model answer

function chooseRequestRoute({
  method = "GET",
  cacheEnabled = true,
  cacheHealthy = true,
  cacheEntry = null,
  now = Date.now(),
  ttlMs = 30_000,
  consistency = "eventual"
}) {
  const verb = method.toUpperCase();
  const isRead = verb === "GET" || verb === "HEAD";

  // The database is authoritative for writes; invalidate only after commit.
  if (!isRead) {
    return {
      route: "database",
      cacheAction: cacheEnabled ? "invalidate-after-commit" : "none"
    };
  }

  // Strong reads bypass cache to avoid serving stale data.
  if (consistency === "strong" || !cacheEnabled || !cacheHealthy) {
    return { route: "database", cacheAction: "none" };
  }

  const ageMs = cacheEntry ? now - cacheEntry.cachedAt : Infinity;
  const isFresh = Number.isFinite(ageMs) && ageMs >= 0 && ageMs <= ttlMs;

  if (isFresh) {
    return { route: "cache", cacheAction: "none" };
  }

  // On a miss or stale entry, read the source of truth and refresh the cache.
  return { route: "database", cacheAction: "populate-after-read" };
}

// Example: fresh eventual-consistency read is served by the cache.
console.log(chooseRequestRoute({
  method: "GET",
  cacheEntry: { value: "item", cachedAt: Date.now() }
}));
  • Treat the database as the source of truth: writes go there, followed by cache invalidation after a successful commit.
  • Serve only fresh cache entries for eventual-consistency reads; route misses, expired entries, strong reads, and cache failures to the database.
  • In production, pair this policy with timeouts, bounded retries, observability, and protection against cache stampedes.

Complexity: O(1) time and O(1) extra space.

CodingMediumZscalerStaff Engineer

10. Given an integer, determine whether it is a palindrome without converting it to a string.

Model answer

function isPalindromeInteger(n) {
  // This implementation uses Number arithmetic and supports safe integers.
  if (!Number.isSafeInteger(n) || n < 0) return false;
  if (n !== 0 && n % 10 === 0) return false;

  let remaining = n;
  let reversedHalf = 0;

  // Reverse only half the digits to avoid building a full reversed number.
  while (remaining > reversedHalf) {
    reversedHalf = reversedHalf * 10 + (remaining % 10);
    remaining = Math.floor(remaining / 10);
  }

  // For odd digit counts, remove the middle digit from the reversed half.
  return remaining === reversedHalf || remaining === Math.floor(reversedHalf / 10);
}

console.log(isPalindromeInteger(1221)); // true
console.log(isPalindromeInteger(123));  // false
console.log(isPalindromeInteger(-121)); // false
  • Negative integers are not palindromes; nonzero integers ending in zero cannot be palindromes.
  • Reversing half the digits avoids string conversion and reduces overflow risk.

Complexity: O(log₁₀ n) time, O(1) space.

System designMediumZscalerEngineering Manager

11. How do proxy and VPN architectures differ, and what are the security and performance implications of each?

Model answer

1. Requirements & scale

  • Functional: Provide managed forward-proxy access and device-level VPN access; authenticate users/devices; enforce centralized egress policies; support audit, revocation, and regional failover.
  • Non-functional: Protect credentials and traffic, minimize latency, isolate tenants, sustain high availability, and make policy changes auditable. Be explicit that a VPN protects traffic between device and VPN gateway; it does not automatically make the destination trustworthy or hide traffic from the VPN operator.
  • Assumptions: 100,000 enrolled devices, 30,000 concurrent devices at peak, and 50 Kbps average egress per active device. Peak aggregate traffic is about 30,000 × 50 Kbps = 1.5 Gbps; provision several times that for bursts and uneven regional load. At 10,000 audit events/sec and 500 bytes/event, raw logs are about 432 GB/day before compression and indexes. Control-plane traffic is much smaller than data-plane traffic.

2. High-level architecture

flowchart TD
    subgraph Client["Client"]
        D["Managed device"]
        B["Browser or app"]
    end
    subgraph Edge["Edge/CDN"]
        E["Regional edge"]
        W["WAF and DDoS controls"]
    end
    subgraph LB["Load Balancer"]
        L["Regional load balancer"]
    end
    subgraph Services["API / Services"]
        A["Auth and enrollment"]
        P["Policy control plane"]
        G["VPN gateway"]
        X["Forward proxy"]
    end
    subgraph Cache["Cache"]
        C["Policy and session cache"]
    end
    subgraph DB["Datastores"]
        S["SQL policy and device store"]
        O["Object audit log store"]
    end
    subgraph MQ["Message Queue"]
        Q["Audit event stream"]
    end
    subgraph Workers["Workers"]
        R["Policy and log workers"]
    end
    T["Internet destinations"]
    D -->|"enrollment and policy HTTPS"| E
    E --> W --> L --> A
    A -->|"identity and policy reads"| C
    A -->|"durable writes"| S
    D -->|"encrypted VPN tunnel"| G
    D -->|"proxy request or CONNECT"| X
    G -->|"authorized egress"| T
    X -->|"authorized egress"| T
    G -->|"session audit"| Q
    X -->|"request audit"| Q
    P -->|"policy update"| C
    Q --> R --> O
    R -->|"aggregate metrics"| S
Diagram

The control plane authenticates devices and distributes policy. The data plane scales separately: VPN gateways terminate device tunnels; forward proxies handle explicit or transparently configured application requests. Both send decisions and audit events to a shared policy and logging system.

3. API design

  • POST /v1/devices/enroll — Register a device using an identity-provider token; return a short-lived enrollment result and device certificate or tunnel configuration.
  • GET /v1/devices/{deviceId}/policy — Retrieve a versioned, signed policy bundle.
  • POST /v1/devices/{deviceId}/revoke — Revoke credentials and invalidate active sessions.
  • GET /v1/sessions/{sessionId} — Inspect session status for support and administration.
  • Data plane protocols remain purpose-built: HTTPS proxy requests and CONNECT for tunnels; VPN gateways commonly use WireGuard or IKEv2 rather than an HTTP request per packet.

4. Data model & storage

  • SQL: Device(device_id, tenant_id, identity_id, status, cert_serial), Policy(tenant_id, version, rules, updated_at), and Session(session_id, device_id, region, expires_at). Use tenant_id for policy isolation and partition large device/session tables by tenant and time where appropriate.
  • Cache: Replicated Redis or local gateway caches keyed by (tenant_id, policy_version) and session/device ID. Attach policy versions and short TTLs; revocation must have a fast invalidation path.
  • Audit: Append events to a durable stream, then time-partition compressed object storage by tenant/region/day. Use a search index only for recent operational queries, not as the system of record.

5. Deep dive

The central design choice is where traffic is decrypted and what the operator can inspect. A VPN encrypts packets from the device to the gateway; after tunnel termination, the gateway routes traffic onward. A normal VPN does not require terminating a destination’s TLS, so HTTPS remains end-to-end between client and destination. A forward proxy can tunnel TLS with CONNECT, preserving end-to-end TLS while seeing connection metadata; TLS inspection requires installing a trusted enterprise root certificate and performing two TLS sessions. That enables content controls but creates a high-value key, privacy, and compliance risk. Make inspection opt-in by policy, exclude sensitive categories, audit access, and protect the CA key in an HSM.

sequenceDiagram
    participant D as Device
    participant G as Regional gateway
    participant P as Policy cache
    participant T as Destination
    participant Q as Audit stream
    D->>G: Authenticated tunnel or proxy request
    G->>P: Check device and destination policy
    P-->>G: Allow or deny with policy version
    alt Allowed
        G->>T: Forward packet or proxy request
        T-->>G: Response traffic
        G-->>D: Return through tunnel or proxy
    else Denied
        G-->>D: Policy denial
    end
    G->>Q: Asynchronous decision and session event
Diagram

Fail closed for high-risk destinations and identity failures, but define a controlled availability policy for cache outages. Keep packet forwarding off the synchronous logging path; buffer events locally and alert on dropped audit volume.

6. Scale, bottlenecks & trade-offs

  • Availability and placement: Run gateways in multiple regions and availability zones; use health-checked device failover and capacity headroom. Avoid a single global tunnel concentrator. Replicate policy read paths locally, while keeping policy writes strongly consistent in SQL.
  • Consistency: Policy distribution is eventually consistent across regions, but revocation needs bounded propagation—e.g., invalidate caches within
System designHardZscalerSenior Engineering Manager

12. How would you design a secure distributed system for storing and accessing secrets?

Model answer

1. Requirements & scale

Functional requirements

  • Store, version, rotate, revoke, and retrieve secrets such as API keys, database credentials, and certificates.
  • Authenticate workloads and people; authorize each secret operation with least privilege.
  • Provide audit history, access alerts, and controlled break-glass access.
  • Support automated rotation and integrations with cloud and on-premises workloads.

Non-functional requirements

  • Protect confidentiality and integrity even if an application server or database is compromised.
  • High availability for reads, strong consistency for writes and revocation, and low-latency regional access.
  • Prevent secret values from appearing in logs, traces, crash dumps, or analytics.
  • Define recovery objectives and meet regulatory retention and deletion requirements.

Example scale: 100,000 workloads, each making 10 secret reads per hour, is about 278 reads/second on average; plan for 10x bursts, or roughly 2,800 reads/second. At 1 KB per version and 10 versions per secret, 1 million secrets require about 10 GB raw, excluding replication and metadata. Audit events at 1 KB and 10 million events/day are about 10 GB/day raw; retention and indexes can make this much larger. Secret values should not be broadly replicated just to simplify analytics.

2. High-level architecture

flowchart TD
  subgraph Client
    A[Workload SDK]
    P[Admin Portal]
  end
  subgraph Edge/CDN
    E[Regional Gateway]
  end
  subgraph Load Balancer
    L[Service Load Balancer]
  end
  subgraph API / Services
    I[Identity Service]
    Z[Policy Service]
    V[Vault API]
    R[Rotation Service]
    U[Audit Service]
  end
  subgraph Cache
    C[Encrypted Read Cache]
  end
  subgraph Datastores
    D[(Metadata SQL)]
    K[(Key Management Service)]
    B[(Encrypted Secret Store)]
    O[(Audit Object Store)]
  end
  subgraph Message Queue
    Q[Rotation and Audit Events]
  end
  subgraph Workers
    W[Rotation Workers]
    X[Audit Consumers]
  end
  A -->|mTLS request| E
  P -->|admin request| E
  E -->|authenticated traffic| L
  L -->|API calls| I
  L -->|authorize and retrieve| V
  I -->|workload identity| Z
  V -->|policy check| Z
  V -->|metadata lookup| D
  V -->|decrypt data key| K
  V -->|ciphertext| B
  V -->|short-lived encrypted entry| C
  V -->|access event| Q
  R -->|rotation request| Q
  Q -->|jobs| W
  W -->|update secret version| V
  Q -->|audit records| X
  X -->|append immutable events| O
Diagram

3. API design

  • POST /v1/secrets — create a secret and initial version; value is sent over TLS and never returned in logs.
  • GET /v1/secrets/{id}/versions/{version} — retrieve a version if policy permits.
  • POST /v1/secrets/{id}/versions — add a version using an idempotency key.
  • POST /v1/secrets/{id}:rotate — schedule or initiate rotation.
  • POST /v1/secrets/{id}:revoke — disable access and invalidate cache entries.
  • GET /v1/audit-events — query metadata-only audit records with scoped permissions.

4. Data model & storage

  • SQL stores secret metadata: secret_id, tenant, owner, policy reference, current version, state, and timestamps. Use tenant plus secret ID for lookup and tenant-aware access controls.
  • Store each value as authenticated ciphertext, encrypted with a per-secret data-encryption key. Wrap that key with a KMS-managed key; keep key material out of application storage.
  • Store blobs in encrypted object or key-value storage, with version IDs and integrity tags. Use immutable audit events in append-only storage, partitioned by tenant and time.
  • Cache only ciphertext or tightly bounded plaintext in isolated memory where justified; use short TTLs, never shared cross-tenant cache keys, and invalidate on revocation.

5. Deep dive

Use envelope encryption: the service generates a data key, encrypts the secret locally with an authenticated cipher such as AES-GCM, and asks KMS to wrap the data key. On retrieval, authenticate the workload, authorize the exact secret and operation, fetch ciphertext and wrapped key, unwrap through KMS, decrypt in memory, and return over mutually authenticated TLS. Never put plaintext in queue messages. Bind tenant, secret ID, and version as authenticated encryption context to prevent ciphertext substitution.

sequenceDiagram
  participant W as Workload
  participant G as Gateway
  participant A as Auth and Policy
  participant V as Vault
  participant K as KMS
  participant S as Secret Store
  participant Q as Audit Queue
  W->>G: mTLS read secret
  G->>A: Verify identity and authorize
  A-->>G: Scoped decision
  G->>V: Authorized secret request
  V->>S: Fetch ciphertext and wrapped key
  S-->>V: Versioned encrypted record
  V->>K: Unwrap data key with context
  K-->>V: Data key
  V-->>W: Secret over TLS
  V->>Q: Metadata-only access event
Diagram

Make writes idempotent and versioned. Rotation is a state machine: create candidate, update downstream credential, verify health, promote new version, then revoke old version after a grace period. A failed downstream update must not silently revoke the working credential.

6. Scale, bottlenecks & trade-offs

  • Partition metadata by tenant; replicate read paths across regions, but define a home region or consensus-backed write path for version changes and revocation. Favor consistency for authorization changes over stale availability.
  • KMS is a latency and quota bottleneck. Use bounded connection pools, regional KMS keys, carefully scoped data-key caching, and circuit breakers. Any plaintext caching trades latency for exposure risk and needs explicit TTL and memory protections.
  • Use an asynchronous queue for audit delivery and rotation jobs, with durable retention, retries, dead-letter handling, and idempotent consumers. Secret retrieval should not wait on analytics ingestion, but must fail closed if the authorization decision cannot be established.
  • Avoid a single global policy service or key dependency by deploying red
System designHardZscalerEngineering Manager

13. Design a media hosting and delivery platform.

Model answer

1. Requirements & scale

Functional requirements

  • Accept uploads, validate ownership and metadata, and support resumable multipart transfer.
  • Store originals and deliver adaptive-bitrate video and audio to web and mobile clients.
  • Transcode media into multiple renditions, generate thumbnails and manifests, and expose processing status.
  • Support private media, signed access, deletion, moderation, and basic search or catalog browsing.

Non-functional requirements

  • Durable originals, highly available playback, fast startup, and smooth playback across variable networks and devices.
  • Secure upload and playback authorization; isolation between tenants; compliant deletion and retention.
  • Asynchronous processing with observable state, retryability, and bounded cost per media asset.

Back-of-the-envelope scale

Assume 100 million play starts/day, with an average five-minute session and 3 Mbps delivered bitrate. That is 500 million playback minutes/day and about 1 Tbps average egress: 100M × 300s × 3Mbps ÷ 86,400s; plan for roughly 3 Tbps peak. At 100,000 uploads/day and 200 MB average original, raw ingest is 20 TB/day. If encoded renditions average 3x the original, total new storage is about 80 TB/day, or 29 PB/year before replication and lifecycle policies. Playback API traffic averages about 1.2K starts/second; CDN, not the API tier, carries most bytes.

2. High-level architecture

Clients upload directly to object storage using short-lived multipart URLs; media bytes do not traverse application servers. An event starts an asynchronous workflow for validation, transcoding, packaging, and catalog publication. Playback APIs authorize access and return a manifest URL; the CDN serves manifests and segments close to users, with origin protection and signed tokens.

flowchart TD
  subgraph Client[Client]
    A[Web and Mobile Apps]
    B[Creator Upload SDK]
  end
  subgraph Edge[Edge and CDN]
    C[CDN and WAF]
  end
  subgraph LB[Load Balancer]
    D[API Load Balancer]
  end
  subgraph Services[API and Services]
    E[Upload API]
    F[Playback API]
    G[Catalog Service]
    H[Workflow Orchestrator]
    I[Authorization Service]
  end
  subgraph Cache[Cache]
    J[Catalog and Manifest Cache]
  end
  subgraph Stores[Datastores]
    K[(Media Metadata SQL)]
    L[(Object Storage Originals)]
    M[(Object Storage Renditions)]
    N[(Search Index)]
  end
  subgraph Queue[Message Queue]
    O[Media Events]
  end
  subgraph Workers[Workers]
    P[Validation Workers]
    Q[Transcode Workers]
    R[Packaging Workers]
  end
  A -->|play request| C
  B -->|create upload| C
  C -->|control request| D
  D -->|upload session| E
  E -->|session metadata| K
  B -->|multipart media bytes| L
  L -->|upload completed event| O
  O -->|ingest job| P
  P -->|validated asset| H
  H -->|transcode job| O
  O -->|profiles and source reference| Q
  Q -->|rendition files| M
  Q -->|encode complete event| O
  O -->|package job| R
  R -->|HLS or DASH output| M
  R -->|publish metadata| G
  G -->|asset state and metadata| K
  G -->|search update| N
  A -->|playback authorization| F
  F -->|catalog lookup| J
  F -->|ownership check| I
  I -->|policy lookup| K
  F -->|signed manifest URL| A
  A -->|manifest and segments| C
  C -->|cache miss fetch| M
Diagram

3. API design

  • POST /v1/uploads — create an asset and multipart upload session; return upload ID, part sizing, and short-lived signed URLs.
  • POST /v1/uploads/{id}:complete — verify uploaded parts and request processing; idempotent by upload ID.
  • GET /v1/media/{id}/status — return processing state and any user-actionable failure.
  • GET /v1/media/{id}/playback — authorize the viewer and return a signed HLS or DASH manifest URL.
  • DELETE /v1/media/{id} — mark the asset deleted, revoke playback, and enqueue asynchronous object removal.

4. Data model & storage

  • SQL holds Media(id, owner_id, state, visibility, created_at, metadata_version), Rendition(media_id, profile, object_key, bitrate, duration), and Upload(upload_id, owner_id, object_prefix, status). Partition large tables by media ID or tenant; index owner plus creation time and public catalog fields.
  • Object storage keeps originals and immutable rendition segments. Use lifecycle tiers for cold originals, replication for durability, and content hashes or versioned object keys to prevent accidental overwrite.
  • A search index serves discovery; it is rebuildable from metadata. Redis or an equivalent cache stores hot catalog entries and manifests, not authorization truth.
  • The queue contains durable state-transition events, not media bytes. Objects are large; events should contain IDs and references.

5. Deep dive

Upload completion and processing must tolerate duplicate events, worker crashes, and partial output. The upload API creates a state machine such as created → uploading → uploaded → processing → ready, with terminal failed and deleted states. Each event carries an asset ID, event ID, and expected state version. Workers claim work idempotently, write outputs under deterministic versioned keys, and conditionally advance the state so a retry cannot publish stale results. Validate MIME type from content, inspect file size and duration, scan where appropriate, and enforce codec and resource limits before running untrusted media through isolated transcoders.

sequenceDiagram
  participant U as Upload Client
  participant A as Upload API
  participant O as Object Storage
  participant Q as Event Queue
  participant T as Transcode Worker
  participant P as Packager
  participant D as Metadata Store
  U->>A: Create upload
  A-->>U: Upload ID and signed part URLs
  U->>O: Upload parts directly
  U->>A: Complete upload
  A->>O: Verify parts and object metadata
  A->>Q: Publish uploaded event
  Q->>T: Deliver ingest job
  T->>O: Read original and write renditions
  T->>Q: Publish encode complete
  Q->>P: Deliver packaging job
  P->>O: Write m
Diagram
System designHardZscalerPrincipal EngineerVirtual onsite

14. Design a movie ticket booking system.

Model answer

1. Requirements & scale

Functional requirements

  • Browse/search movies, theaters, showtimes, pricing, and seat availability.
  • Select seats, temporarily hold them, pay, confirm a booking, and retrieve or cancel a ticket.
  • Support high-demand on-sales, refunds, notifications, and theater/operator configuration.

Non-functional requirements

  • Never sell the same seat twice; a booking must be recoverable after retries or service failures.
  • Browsing should remain responsive under heavy read traffic, while seat selection needs clear hold/expiry behavior.
  • Payment and ticket issuance must be idempotent, auditable, and secure.

Back-of-the-envelope

  • Assume 20M users/month, with a peak of 100K browse requests/s during major releases.
  • A popular on-sale could produce 10K seat-hold attempts/s for a small number of showtimes; that hot-key contention is harder than total system throughput.
  • Assume 2M bookings/day at roughly 2 KB of booking and seat metadata each: about 4 GB/day before indexes, replicas, and retention. Ticket images or QR assets can live in object storage, not the relational core.

2. High-level architecture

Separate read-heavy catalog/search from authoritative seat inventory. Route every showtime’s seat mutations to one transactional inventory partition, with short-lived holds and explicit expiration.

flowchart TD
  subgraph Client
    App["Web and mobile apps"]
    Ops["Theater operator tools"]
  end
  subgraph Edge["Edge/CDN"]
    CDN["Static assets and cached catalog"]
  end
  subgraph LB["Load Balancer"]
    LB1["Regional API load balancer"]
  end
  subgraph API["API / Services"]
    API1["API gateway"]
    Catalog["Catalog and search service"]
    Inventory["Inventory and hold service"]
    Booking["Booking service"]
    Payment["Payment service"]
    Ticket["Ticket service"]
  end
  subgraph Cache["Cache"]
    ReadCache["Showtime and seat-map cache"]
    HoldCache["Hold lookup cache"]
  end
  subgraph DB["Datastores"]
    SQL["Booking and seat SQL"]
    Search["Search index"]
    Object["Ticket and audit object store"]
  end
  subgraph MQ["Message Queue"]
    Events["Booking and payment events"]
  end
  subgraph Workers["Workers"]
    Expiry["Hold expiry worker"]
    Notify["Email and push worker"]
    Recon["Payment reconciliation"]
  end
  App -->|"browse and booking requests"| CDN
  CDN -->|"dynamic API calls"| LB1
  Ops -->|"showtime configuration"| LB1
  LB1 --> API1
  API1 --> Catalog
  API1 --> Inventory
  API1 --> Booking
  API1 --> Payment
  Catalog --> Search
  Catalog --> ReadCache
  Inventory --> HoldCache
  Inventory -->|"atomic seat mutations"| SQL
  Booking -->|"booking state"| SQL
  Payment -->|"payment intent and status"| SQL
  Booking -->|"outbox events"| Events
  Events --> Notify
  Events --> Recon
  Events --> Object
  Expiry -->|"release expired holds"| Inventory
  Booking --> Ticket
  Ticket -->|"QR and ticket artifact"| Object
Diagram

3. API design

  • GET /v1/movies?city=&date= — browse available movies and showtimes.
  • GET /v1/showtimes/{id}/seats — seat map with availability version and prices.
  • POST /v1/holds — showtime, seat IDs, and idempotency key; returns hold ID and expiry.
  • POST /v1/bookings — hold ID, customer details, and idempotency key; begins checkout.
  • POST /v1/payments/{id}/confirm — payment-provider callback or client confirmation, verified server-side.
  • GET /v1/bookings/{id} and POST /v1/bookings/{id}/cancel — retrieve or cancel subject to policy.

4. Data model & storage

  • Relational database: Showtime(showtime_id, theater_id, starts_at, status), Seat(showtime_id, seat_id, status, hold_id, expires_at, booking_id, price), Hold(hold_id, user_id, status, expires_at, idempotency_key), Booking(booking_id, user_id, status, amount, payment_id), and a payment ledger/outbox. Enforce uniqueness on (showtime_id, seat_id) and use transactions for inventory transitions.
  • Partition inventory by showtime_id; distribute showtimes across shards, while recognizing that one blockbuster showtime is a hot partition. Do not split one seat’s ownership across independent writers.
  • Search index: movie, theater, location, and schedule discovery; it is a derived, eventually consistent read model.
  • Cache/CDN: catalog and seat-map snapshots, never authoritative availability. Show cache versions and revalidate when creating a hold.
  • Object storage: QR/ticket artifacts and long-lived audit exports. Keep payment tokens with the provider; avoid storing card data.

5. Deep dive

Seat holds and payment are the correctness boundary. For a requested set of seats, begin a database transaction, lock rows in deterministic seat-ID order (or use conditional updates), verify every seat is available, and set all to HELD with one hold ID and a short TTL, such as five minutes. If any seat is unavailable, roll back the whole transaction. A conditional update should require status = AVAILABLE or an expired hold; the unique seat key prevents duplicate inventory rows.

sequenceDiagram
  participant C as Client
  participant I as Inventory service
  participant DB as SQL database
  participant P as Payment provider
  participant B as Booking service
  C->>I: Request seats with idempotency key
  I->>DB: Transactionally claim all seats
  DB-->>I: Hold ID and expiry
  I-->>C: Hold confirmation
  C->>B: Checkout hold
  B->>P: Create payment intent with idempotency key
  P-->>B: Payment result
  B->>DB: Commit booking and held seats
  B-->>C: Confirmed ticket
Diagram

Create a payment intent using the hold/booking ID as the provider idempotency key. On verified success, transactionally change the hold to BOOKED, create the booking, and write an outbox event. On decline, release seats immediately. If payment is pending or the response is lost, reconcile by querying the provider; do not assume failure and release seats while a charge may have succeeded. An expiry worker releas

System designHardZscalerPrincipal Engineer

15. Design Uber.

Model answer

1. Requirements & scale

Functional requirements

  • Riders request quotes, see nearby drivers, request rides, track pickup/trip progress, pay, and rate.
  • Drivers go online, publish location, receive/accept offers, navigate, and complete trips.
  • Support cancellation, pricing, receipts, and operational support.

Non-functional requirements

  • Dispatch should be local and fast; location freshness matters more than perfect global consistency.
  • Ride lifecycle and payment transitions must be durable, auditable, and idempotent.
  • Isolate regions, protect personal/location data, and degrade gracefully when maps, payments, or dispatch are impaired.

Back-of-the-envelope

  • Assume 30M trips/day: about 350 trip starts/s on average; at 5× peak, about 1,750/s.
  • Assume 1M active drivers updating every 4 seconds: 250K location updates/s. At 100 bytes/update, raw ingress is about 25 MB/s before replication and protocol overhead.
  • Retain high-frequency location data briefly; 250K × 100 bytes × 86,400 seconds is about 2.2 TB/day raw, so do not store every update in the transactional database.

2. High-level architecture

Use regional cells so dispatch, location indexes, and active-trip state are close to users. Global services handle identity, configuration, and cross-region analytics; each trip has one authoritative region.

flowchart TD
  subgraph Client
    R["Rider app"]
    D["Driver app"]
  end
  subgraph Edge["Edge/CDN"]
    E["TLS, API routing, rate limits"]
  end
  subgraph LB["Load Balancer"]
    L["Regional gateway"]
  end
  subgraph API["API / Services"]
    G["API gateway"]
    T["Trip service"]
    M["Matching service"]
    P["Pricing service"]
    Pay["Payment service"]
    Loc["Location ingestion"]
  end
  subgraph Cache["Cache"]
    Geo["Regional geospatial index"]
    State["Active trip cache"]
  end
  subgraph DB["Datastores"]
    SQL["Trip and payment SQL"]
    Blob["Location history object store"]
  end
  subgraph MQ["Message Queue"]
    Q["Trip and location events"]
  end
  subgraph Workers["Workers"]
    N["Notifications and dispatch"]
    A["Analytics and fraud"]
  end
  R -->|"quote and ride requests"| E
  D -->|"location and availability"| E
  E -->|"regional traffic"| L
  L --> G
  G --> T
  G --> P
  G --> Pay
  G --> Loc
  T -->|"nearby driver query"| M
  Loc -->|"fresh positions"| Geo
  M -->|"candidate drivers"| Geo
  T -->|"active state"| State
  T -->|"durable lifecycle"| SQL
  Pay -->|"charges and ledger"| SQL
  T -->|"events"| Q
  Loc -->|"sampled history"| Q
  Q --> N
  Q --> A
  A --> Blob
Diagram

3. API design

  • POST /v1/quotes — pickup, drop-off, product; returns fare estimate and expiry.
  • POST /v1/rides — quote ID and idempotency key; creates a ride and starts matching.
  • POST /v1/rides/{rideId}/accept — driver accepts an offer using a version or offer token.
  • POST /v1/drivers/location — batched coordinates, timestamp, sequence number.
  • GET /v1/rides/{rideId} and GET /v1/rides/{rideId}/events — snapshot and live updates, using WebSockets or SSE.
  • POST /v1/rides/{rideId}/complete and POST /v1/rides/{rideId}/cancel — lifecycle transitions.

4. Data model & storage

  • SQL: Ride(ride_id, region_id, rider_id, driver_id, status, version, quote_id, timestamps), payment ledger, and idempotency records. Partition by region and time; shard large tables by ride ID. Use transactions for state transitions and the outbox pattern for reliable event publication.
  • Regional in-memory geo index: driver ID, latest coordinate, availability, and update time, partitioned by region plus H3/geohash cell. Expire stale drivers; do not treat this cache as the source of truth.
  • Object storage/data lake: sampled or compressed location history for support, safety, and analytics, with short retention and strict access controls.
  • Cache: quote and active-trip snapshots, with versioning and bounded TTLs.

5. Deep dive

Dispatch and ride lifecycle are the crux. The location service validates driver identity, timestamp, and monotonic sequence; it drops stale updates and updates the driver’s regional cell. The matching service queries nearby cells, expands the radius if necessary, and filters by availability, vehicle type, freshness, and estimated pickup time. Rank candidates using ETA and marketplace policy—not raw distance alone. Offer to a small set in sequence or a controlled batch; acceptance must atomically claim the ride so two drivers cannot both win.

sequenceDiagram
  participant R as Rider
  participant T as Trip service
  participant M as Matcher
  participant G as Geo index
  participant D as Driver
  participant S as SQL
  R->>T: Create ride with idempotency key
  T->>S: Commit REQUESTED ride and outbox event
  T->>M: Start matching
  M->>G: Query fresh nearby available drivers
  G-->>M: Ranked candidates
  M->>D: Send expiring offer
  D->>T: Accept offer token
  T->>S: CAS REQUESTED to DRIVER_ASSIGNED
  S-->>T: Assignment committed
  T-->>R: Ride assigned event
Diagram

Represent lifecycle transitions explicitly: REQUESTED → MATCHING → DRIVER_ASSIGNED → ARRIVING → IN_TRIP → COMPLETED, with cancellation and failure transitions. Use compare-and-swap on version, offer expiration, idempotency keys, and an outbox so retries cannot duplicate rides, assignments, or charges. Push updates over WebSockets; clients reconcile with a versioned snapshot after reconnecting.

6. Scale, bottlenecks & trade-offs

  • Partition location ingestion and matching by region/cell; replicate within a region and route each ride to one authoritative cell. Cross-region failover is possible, but active-trip writes need fencing to prevent split brain.
  • Location is eventually consistent: a slightly stale driver position is acceptable if freshness thresholds are enforced. Ride assignment and payment are strongly consistent per ride.
  • Keep hot location queries in memory; asynchronously stream sampled history to durab
TechnicalEasyZscalerEngineering Manager

16. What is the difference between HTTP and HTTPS, and how does the transition from HTTP to HTTPS affect network security appliances?

Model answer

1. Protocol difference

  • HTTP sends application data in plaintext. Anyone able to observe the network path may read or alter it, and the client has no built-in way to verify the server’s identity.
  • HTTPS is HTTP carried over TLS. TLS negotiates encryption keys, protects data integrity, and authenticates the server using a certificate. HTTPS typically uses TCP port 443; HTTP typically uses port 80. HTTP/3 carries HTTP over QUIC, which also uses TLS and commonly uses UDP port 443.
  • HTTPS protects traffic in transit, but it does not make a compromised endpoint, malicious application, or insecure server safe.

2. Effect on security appliances

flowchart LR
  C[Client] -->|TLS session| A[Security appliance]
  A -->|TLS session| S[HTTPS server]
  C -.->|Without inspection: encrypted payload| S
Diagram
  • Without TLS inspection, a firewall or IDS can generally inspect network metadata—such as IPs, ports, and connection timing—but not the encrypted HTTP paths, headers, or body. This can reduce the effectiveness of URL filtering, malware scanning, and application-layer rules.
  • With TLS inspection, a proxy or gateway terminates the client’s TLS connection, inspects the decrypted request, then establishes a separate TLS connection to the server. Managed clients must trust the enterprise inspection CA. The appliance needs adequate capacity, certificate and key management, and clear privacy controls.
  • Inspection can fail or cause application issues with certificate pinning, mutual TLS, unsupported TLS versions, or clients that do not trust the enterprise CA. Encrypted Client Hello can also limit visibility into the requested hostname. QUIC may bypass TCP-based inspection unless the appliance supports QUIC inspection or policy blocks it.
  • TLS inspection creates a sensitive plaintext boundary. I would define exceptions for regulated or sensitive traffic, restrict access to decrypted data, and monitor appliance CPU, memory, session capacity, and TLS handshake failures.

3. Transition considerations

  • Inventory applications, clients, certificates, and appliances; test representative traffic before changing policy.
  • Validate certificate trust, TLS versions, cipher support, SNI and DNS behavior, and fallback or exception policies.
  • Roll out by pilot group, monitor handshake errors, application failures, latency, and inspection capacity, then expand with a rollback plan.
  • Measure both security outcomes and user impact: blocked threats or policy violations, TLS failure rate, and p95 connection latency.
TechnicalEasyZscalerEngineering ManagerTechnical Interview (Round 1)

17. What is the lifecycle of a React class component?

Model answer

Lifecycle phases

A React class component moves through mounting, updating, and unmounting. Error boundaries also have lifecycle methods for handling errors in descendant components.

flowchart TD
  A[Construct] --> B[Render]
  B --> C[Commit to DOM]
  C --> D[componentDidMount]
  D --> E{Props or state change?}
  E -->|Yes| F[Update checks]
  F --> G[Render]
  G --> H[Commit update]
  H --> I[componentDidUpdate]
  I --> E
  E -->|No, component removed| J[componentWillUnmount]
Diagram

Main methods

  • Mounting: constructor initializes state and binds methods; static getDerivedStateFromProps can derive state from props; render returns the UI; componentDidMount runs after the component is in the DOM. Use componentDidMount for subscriptions, timers, and client-side requests.
  • Updating: static getDerivedStateFromProps may run; shouldComponentUpdate can skip rendering; render produces the next UI; getSnapshotBeforeUpdate reads the DOM before React commits changes; componentDidUpdate runs after the update. Clean up or adjust effects there, and guard state updates to avoid loops.
  • Unmounting: componentWillUnmount cleans up subscriptions, timers, and other resources.
  • Error boundaries: getDerivedStateFromError can update state to show fallback UI; componentDidCatch is typically used to log the error.

Practical guidance

I would avoid deprecated componentWillMount, componentWillReceiveProps, and componentWillUpdate methods; their UNSAFE_ variants remain only for legacy migrations. For new code, function components and hooks are usually preferred, but understanding class lifecycles is important when maintaining existing code. In development, Strict Mode can intentionally repeat certain lifecycle behavior to expose unsafe side effects, so lifecycle work should be safe to repeat where possible.

TechnicalEasyZscalerEngineering ManagerTechnical Interview (Round 1)

18. What is Redux, and how does its data flow cycle work?

Model answer

What Redux is

Redux is a predictable state-management library. It keeps shared application state in a store and changes that state through explicit actions handled by reducers. It is useful when state is shared across many parts of an application or when making changes traceable and testable matters; it is not necessary for every component's local state.

Data-flow cycle

flowchart LR
  A[UI event] --> B[Dispatch action]
  B --> C[Middleware]
  C --> D[Reducer]
  D --> E[Next store state]
  E --> F[Subscribers and selectors]
  F --> G[UI rerenders]
  G --> A
Diagram
  1. A UI event dispatches an action, usually an object such as { type: 'cart/itemAdded', payload: item }.
  2. Optional middleware can handle cross-cutting work, such as logging or asynchronous requests. A thunk, for example, can dispatch a request action and later a success or failure action.
  3. The reducer receives the current state and action, then returns the next state. Reducers should be pure: no network calls, mutations, or other side effects.
  4. The store publishes the new state to subscribers. UI selectors read the relevant slice, and the UI updates when selected data changes.

Important trade-offs and practices

  • Keep state as small and normalized as practical; avoid duplicating values that can be derived.
  • Use immutable updates so change detection and time-travel debugging work reliably. Redux Toolkit uses Immer to make immutable updates easier to write.
  • Keep local, short-lived UI state—such as whether a small popover is open—in the component unless it needs to be shared.
  • Treat async work as a workflow around the reducer, not inside it. Model loading, success, and failure explicitly.
  • Watch for overly broad subscriptions and expensive selectors; select only what a component needs and memoize costly derivations.
TechnicalEasyZscalerEngineering ManagerTechnical Interview (Round 1)

19. What is the event loop?

Model answer

Definition

The event loop coordinates JavaScript execution with asynchronous work. JavaScript runs one call stack at a time; the runtime schedules callbacks from queues when the stack is empty. In a browser, the runtime also coordinates rendering and browser APIs.

A simplified browser cycle

flowchart TD
  A[Run current JavaScript task] --> B{Call stack empty?}
  B -->|No| A
  B -->|Yes| C[Drain microtask queue]
  C --> D{More microtasks?}
  D -->|Yes| C
  D -->|No| E[Browser may render]
  E --> F[Pick next task]
  F --> A
Diagram

Queues and ordering

  • Tasks (often called macrotasks) include callbacks from timers, user events, and many browser APIs. A timer sets a minimum delay; it does not guarantee execution at that exact time.
  • Microtasks include promise reactions and queueMicrotask callbacks. After a task completes, the runtime drains microtasks—including microtasks queued by other microtasks—before moving to the next task or rendering opportunity.
  • Rendering may occur between tasks, but the browser can skip a render when it has nothing to display or is under pressure.

For example, if synchronous code schedules a timer and a resolved promise, the current code finishes first, then the promise callback runs before the timer callback. Exact behavior can depend on the host environment, so I would distinguish browser guarantees from Node.js event-loop details.

Why it matters

A long-running synchronous function blocks input handling and rendering because it occupies the main thread. Likewise, recursively queuing microtasks can starve tasks and delay rendering. I would break expensive work into chunks, move suitable CPU-heavy work to a Web Worker, and measure responsiveness using metrics such as interaction latency and long tasks.

TechnicalEasyZscalerEngineering ManagerTechnical Interview (Round 1)

20. What is a closure?

Model answer

Definition

A closure is a function together with access to the lexical environment in which it was created. It can keep using variables from an outer scope even after that outer function has returned.

function makeCounter() {
  let count = 0;

  return function increment() {
    count += 1;
    return count;
  };
}

const counter = makeCounter();
console.log(counter()); // 1
console.log(counter()); // 2

The returned increment function closes over count. That binding remains available because the closure still references it; it is not a snapshot of the value at function creation.

Why closures are useful

  • Encapsulation: keep state private while exposing a small function-based interface.
  • Callbacks: retain context for event handlers, timers, and asynchronous operations.
  • Function factories: configure behavior once and return a specialized function.

Practical pitfalls

  • A closure retains references to its environment. Long-lived callbacks can unintentionally keep large objects alive, so remove listeners or cancel work when it is no longer needed.
  • Closures capture bindings, not frozen values. In asynchronous code, a callback may observe a later value than expected; use a clear ownership model and verify whether the intended value should be captured or read at execution time.
  • In older JavaScript, loop callbacks using var shared one function-scoped binding. let creates a per-iteration binding and avoids that common issue.

At the manager level, I would expect engineers to use closures deliberately for local state and callbacks, while keeping lifetimes and captured data easy to reason about.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions