Interviews › Computer Science › Questions

Oxford and Cambridge Computer Science interview questions

Ten practice questions in the style tutors use, for Oxford and Cambridge Computer Science and Oxford Computer Science and Philosophy. Each has a mark scheme, and a button to practise it out loud with the AI Interviewer.

These are our own questions, not past interview questions.

How to use these questions

Computer Science interviews test how you reason about problems, not whether you know a programming language. Expect puzzles about algorithms, procedures to trace by hand, counting, logic and games, where the tutor wants to hear you try small cases and explain why your answer is the best possible. Work each question on paper while talking out loud, then compare your reasoning with the mark scheme.

Counting and logic

Short problems where a clear argument matters more than a formula.

Question 1

A knockout tennis tournament has 100 players. Byes are allowed, so some players can skip a round. How many matches are played in total?

Show a hint

Think about what every match does to the number of players still in the tournament.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer avoids adding up rounds and instead notices that each match knocks out exactly one player.

  • Notes every match eliminates exactly one player
  • Notes the tournament ends when exactly one player is left, so 99 players must be eliminated
  • Concludes there are 99 matches, whatever the arrangement of byes
  • Generalises: n players need n − 1 matches

Not a complete list: other sound points also earn credit.

Question 2

How many strings of eight 0s and 1s contain no two 1s next to each other?

Show a hint

Count for lengths 1, 2 and 3, then think about how a valid string can end.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer finds a rule that builds each length from shorter ones and justifies it, rather than listing all 256 strings.

  • Finds 2 strings of length 1, 3 of length 2 (00, 01, 10), 5 of length 3
  • Explains the rule: a valid string ends in 0 (anything valid of length n − 1 before it) or in 01 (anything valid of length n − 2 before it), so count(n) = count(n − 1) + count(n − 2)
  • Builds 2, 3, 5, 8, 13, 21, 34, 55
  • States 55 strings of length 8
  • Recognises the Fibonacci pattern

Not a complete list: other sound points also earn credit.

Question 3

Each card has a letter on one side and a number on the other. The rule is: ‘If a card has a vowel on one side, it has an even number on the other.’ Four cards lie on the table showing A, D, 8 and 3. Which cards must you turn over to check the rule?

Show a hint

For each card, ask whether anything on its hidden side could break the rule.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science and Philosophy.
Mark scheme: what a strong answer covers

A strong answer treats the rule as ‘if P then Q’, sees that it is broken only by a vowel paired with an odd number, and checks exactly those cards that could show that pairing.

  • Turns A: an odd number on the back would break the rule
  • Turns 3: a vowel on the back would break the rule
  • Explains D need not be turned: the rule says nothing about consonants
  • Explains 8 need not be turned: a consonant behind it is allowed, since the rule does not say only vowels have even numbers
  • Links this to logic: ‘if P then Q’ is the same as ‘if not Q then not P’ (the contrapositive), which is why the odd card matters

Not a complete list: other sound points also earn credit.

Tracing a procedure

Follow the steps by hand, then say what the procedure really does.

Question 4

A procedure takes two positive whole numbers a and b. While b is not 0, it replaces the pair (a, b) with (b, the remainder when a is divided by b). When b reaches 0, it outputs a. Trace it for a = 252, b = 198. What does it compute, and why must it stop?

Show a hint

Write the pair after each step in a table.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer traces accurately, recognises the output as the highest common factor, and explains both why the answer is right and why the loop ends.

  • Traces (252, 198) to (198, 54) to (54, 36) to (36, 18) to (18, 0) and outputs 18
  • Identifies the output as the highest common factor of a and b (the largest number dividing both)
  • Explains why the common factors never change: anything dividing a and b also divides a minus a multiple of b, and the other way round
  • Explains why it stops: the remainder is always smaller than b, so b is a whole number that gets strictly smaller each step and must reach 0
  • Checks the answer directly: 252 = 18 × 14 and 198 = 18 × 11, and 14 and 11 share no common factor; may name it Euclid’s algorithm

Not a complete list: other sound points also earn credit.

Question 5

A function f is defined for whole numbers n ≥ 0. f(0) = 0. For n > 0, f(n) = f(n div 2) + (n mod 2), where ‘n div 2’ means n halved and rounded down, and ‘n mod 2’ is the remainder when n is divided by 2. Work out f(13). What does f count?

Show a hint

Work from f(13) down to f(0), then build the answer back up.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer traces the calls correctly, then connects halving and remainders to writing n in binary.

  • Unfolds f(13) = f(6) + 1, f(6) = f(3) + 0, f(3) = f(1) + 1, f(1) = f(0) + 1
  • Gets f(13) = 3
  • Notes that n mod 2 is the last binary digit of n and n div 2 removes that digit
  • Concludes f(n) counts the 1s in the binary form of n, and checks 13 = 1101 in binary has three 1s
  • Notes the function always stops because n gets smaller each call until it reaches 0

Not a complete list: other sound points also earn credit.

Algorithms

Find a method, then argue nothing can do better.

Question 6

You have 9 coins that look identical. One is slightly heavier than the rest. Using a balance scale, what is the smallest number of weighings that guarantees you find the heavy coin?

Show a hint

Count how many different outcomes a single weighing can have.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer gives a method that always works in two weighings and proves one weighing cannot be enough.

  • Gives the method: weigh 3 against 3; the heavy coin is in the heavier group, or in the 3 left off if they balance
  • Then weighs 1 against 1 from the group of 3 in the same way
  • Proves the lower bound: one weighing has only 3 outcomes (left heavier, right heavier, balance), which cannot tell apart 9 possibilities
  • States the answer is 2
  • Generalises: k weighings can handle up to 3k coins

Not a complete list: other sound points also earn credit.

Question 7

A list holds n different numbers. The only move allowed is to swap two neighbouring numbers that are in the wrong order. What is the largest number of swaps that could be needed to sort the list into increasing order?

Show a hint

Count the pairs of numbers that are in the wrong order, and ask how one swap changes that count.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer notices that each swap fixes exactly one out-of-order pair, finds the worst starting list, and gives the formula.

  • Defines an out-of-order pair: a larger number appearing before a smaller one anywhere in the list
  • Shows that swapping two neighbours in the wrong order reduces the number of out-of-order pairs by exactly 1
  • Notes the list is sorted only when there are no out-of-order pairs, so the swaps needed equal the starting count
  • Finds the worst case is a list in decreasing order, where every pair is out of order
  • Gives n(n − 1)/2, for example 10 swaps for 5 numbers

Not a complete list: other sound points also earn credit.

Question 8

I think of a whole number from 1 to 1000. You guess, and I say ‘higher’, ‘lower’ or ‘correct’. What is the smallest number of guesses that guarantees you get it?

Show a hint

Ask how many numbers you can be sure of handling with 1 guess, then 2, then 3.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science and Philosophy.
Mark scheme: what a strong answer covers

A strong answer describes halving the remaining range each time and proves that no strategy can always win in fewer guesses.

  • Describes the strategy: always guess the middle of the numbers still possible
  • Shows that with k guesses you can handle at most 1 + 2 + 4 + … + 2k−1, which adds up to 2k − 1 numbers
  • Calculates 29 − 1 = 511, which is less than 1000, and 210 − 1 = 1023, which is enough
  • States the answer is 10
  • Explains that 9 can never be enough whatever the strategy, since 9 guesses cannot separate more than 511 numbers

Not a complete list: other sound points also earn credit.

Two-player games

Work out who wins with perfect play, and how.

Question 9

There is a pile of 21 counters. Two players take turns to remove 1, 2 or 3 counters. Whoever takes the last counter wins. Would you rather go first or second, and how would you play?

Show a hint

Work backwards from small piles: which pile sizes are bad to face on your turn?

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science.
Mark scheme: what a strong answer covers

A strong answer finds the losing positions by working backwards, spots the pattern of multiples of 4, and gives a strategy that always wins from 21.

  • Works out that a pile of 4 is losing for the player to move: whatever they take, the opponent takes the rest
  • Generalises: multiples of 4 are losing positions, because whatever you take (1 to 3), the opponent can take enough to make 4 in total
  • Notes 21 is not a multiple of 4, so goes first
  • Strategy: take 1 to leave 20, then always take 4 minus whatever the opponent just took
  • Checks the strategy ends with you taking the last counter

Not a complete list: other sound points also earn credit.

Question 10

A rectangular chocolate bar is divided into squares, and the bottom-left square is poisoned. Players take turns choosing a remaining square and eating it together with every square above it and to its right. Whoever eats the poisoned square loses. Show that, for any bar bigger than a single square, the first player can always win.

Show a hint

Suppose the second player had a winning strategy, and see what happens if the first player opens by eating only the top-right square.

Try a question like this with the AI InterviewerSay your answer out loud. You get follow-up questions, then a report marked against the mark scheme, with a model answer. Course: Computer Science and Philosophy.
Mark scheme: what a strong answer covers

A strong answer uses a ‘strategy-stealing’ argument: it proves a winning strategy exists for the first player without saying what it is.

  • Notes the game must finish and cannot be drawn, so one of the two players has a winning strategy (a way to win whatever the opponent does)
  • Considers the first player eating only the top-right square
  • Argues: if the second player has a winning reply to that move, that reply also removes the top-right square, so the first player could have made that reply as their own first move and taken over the winning position
  • Concludes the second player cannot have a winning strategy, so the first player does
  • Comments on the philosophical point: we know a winning strategy exists without knowing what it is

Not a complete list: other sound points also earn credit.

Reading a mark scheme is not the same as answering out loud

In the interview, a tutor follows up on what you say. The AI Interviewer does the same: it asks you one question from your course, pushes back on your answer, then marks it against the mark scheme and shows a model answer.

Try one question with the AI Interviewer

The Interview Pack

One pack opens every course, Computer Science included. The student picks their course after buying.

Prices in
Other options

Just want the questions without the AI Interviewer?

Interview Pack Basic, £89 : every question with its mark scheme and model answer. You can add the AI Interviewer later for £60.

Sitting the TMUA or TARA as well?

The Applicant Pass, £219 : the Interview Pack with the AI Interviewer, both admissions test packs and the full Ceteris library, with access until 31 August 2028.

For a student under 18, we recommend a parent or guardian makes the purchase.

One payment; nothing renews. At checkout, enter the email address the student will sign in with: the pack opens on that account in Ceteris, Econ Coaching’s study app, straight after payment. See the terms.

Questions about these questions

Are these real Oxford or Cambridge interview questions?

No. They are our own questions, written in the style tutors use. Some are based on well-known types of question, but the wording is our own.

Where are the model answers?

The mark scheme for each question on this page is shown above. The ten questions are samples and are not in the Interview Pack. Every question in the Pack has its own mark scheme and a full model answer, and the AI Interviewer marks your spoken answer against it with immediate feedback.

What happens when I try a question with the AI Interviewer?

You choose your course and enter your email. The AI Interviewer asks you one question from your course out loud (not one of the questions on this page), follows up on what you say, then sends a full report with your marks and a model answer.