In 1 minute
- Agree on the goal and discuss decisions that change the contract.
- Rotate roles at clear checkpoints, summarizing changes, checks and open decisions.
- Resolve disagreements through observable consequences, examples and change cost.
A pair programming interview is a collaborative activity where you and another person share code, decisions and verification. This guide focuses on changing an existing codebase. You demonstrate how to understand conventions, propose an approach and incorporate observations instead of treating your partner merely as someone watching you type.
Compared with a session focused on solving a live coding problem, this format emphasizes joint work within an established context. Reading relevant code, agreeing on who drives and preserving existing behavior become part of the task. You need not master the entire project before contributing; find the affected path and learn enough to change it safely.
How pair programming works in an interview
Confirm the task, available time and each person's role. One person can type while the other follows hypotheses, test cases and consequences. Roles may rotate during the session; they are neither fixed positions nor measures of seniority. Ask how the editor is shared and whether there is an expected workflow for running and checking changes.
Start by stating what you understand and what remains unknown. If the interviewer knows the codebase, use that knowledge to locate entry points, but read relevant code before proposing edits. Specific questions support collaboration: asking whether a function serves another screen opens a concrete investigation, unlike requesting a tour of the entire project.
Reading code and agreeing on collaboration
Start from the requested behavior and follow the shortest path to its implementation. Read the entry component or function, its inputs and the nearest relevant test. Look for a similar change that reveals established conventions. Avoid browsing directories without a question. Initial reading should identify what must remain true after the edit.
- Find callers and the contract they expect to preserve.
- Observe local naming, missing-value handling and testing patterns.
- Confirm how to run a focused check before editing.
- Record one question at a time and share the evidence that can resolve it.
If an existing failure appears, distinguish it from the requested behavior. Reproduce enough to determine whether it blocks the task. For diagnosis, follow the live debugging approach. Do not turn the session into a general project repair without agreeing on the priority change with your partner.
Switching between driving and reviewing
When driving, explain the next small change and check shared understanding before moving far ahead. Every keystroke need not require permission, but contract changes deserve discussion. When reviewing, look for missing cases, inconsistencies and integration risks. Naming the example that confirms a rule contributes more than simply saying the code looks good.
Choose a checkpoint
Rotate at a clear checkpoint, such as after a passing test or a rejected hypothesis.
Summarize the handover
When handing over the keyboard, summarize changes, executed checks and the open decision.
Confirm on receiving
When receiving control, confirm that summary before continuing. This small transition prevents each person from working with a different understanding of the problem.

A small change with a preserved contract
Suppose the codebase calculates a deadline by adding minutes to a time and now needs to reject negative durations. First inspect callers and local error conventions. Assume this part of the project returns undefined for invalid input. The example follows that convention without introducing a new result mechanism or changing the output unit.
function deadlineAt(startMs: number, durationMinutes: number): number | undefined {if (!Number.isFinite(startMs) || !Number.isFinite(durationMinutes)) {return undefined;}if (durationMinutes < 0) return undefined;const deadline = startMs + durationMinutes * 60_000;return Number.isFinite(deadline) ? deadline : undefined;}console.assert(deadlineAt(1000, 0) === 1000);console.assert(deadlineAt(1000, 1) === 61000);console.assert(deadlineAt(1000, -1) === undefined);
Agree who adds the guard and who inspects callers. Zero must remain valid if immediate deadlines are allowed. Negative duration now follows the missing-result contract, so the display path must handle it. The snippet calculates milliseconds; it does not solve calendars, time zones or business hours. Keep claims within the discussed requirement.
After running relevant cases, inspect the diff together for accidental formatting, naming or adjacent rule changes. Interview code review helps turn that reading into actionable questions. Note unrelated improvements for later rather than automatically mixing them into the delivery.
Alternatives, disagreement and closing
Do
- When disagreeing, describe an observable consequence. 'This changes the return value another caller expects' can be investigated.
- Propose a test or short inspection to decide. If both options satisfy the contract, compare change cost and consistency with existing code.
Avoid
- Using 'I always do it differently' as an argument: it expresses only preference.
- Trying to win the discussion instead of comparing options.
If you misread a rule, acknowledge it and adjust the plan. Such collaboration can provide real examples for a behavioral interview, but the current priority is completing the task. Close with a shared summary of new behavior, verification and limits. Identify unresolved decisions and checks that could not run.
Frequently asked questions
How does a pair programming interview work?
You and the interviewer collaborate on a coding task through reading, implementation and review. You may rotate who types. Confirm the format and contribute through questions, tests and decisions as well as written code.
How does pair programming differ from live coding?
Names vary across processes. Here, pair programming emphasizes collaboration in an existing codebase; live coding emphasizes building a solution to a problem live. Ask what the actual activity involves because the label alone does not define the interaction.
What if I do not know the project's code?
Start with the requested behavior, follow callers and read a nearby test. Ask specific questions about contracts and conventions. Explain your findings and verify a small change before expanding to other areas.
How can I disagree during pair programming?
Describe the technical consequence and propose a way to check it. Listen to the constraint behind the other proposal. Follow existing conventions for preferences; use an example to decide functional risks with evidence.
Practice with real tests
Solve front-end exercises in the browser, with the same tests a reviewer would run.
See the exercises