PwC coding round questions
Last updated 2026-11-19
PwC's Acceleration Centres in India hire technology graduates into roles that touch assurance, risk and data work. Its entry-level recruitment page describes an online assessment that, for technology roles, includes coding. Since a good share of what those teams build tests ledgers and payment files, this practice set borrows from audit routines: finding gaps in invoice numbers, spotting payments split to dodge a limit, and checking whether leading digits look natural.
The twelve problems are original practice and not a copy of any assessment. Use PwC interview questions for the interview side, and the percentages aptitude guide for the numerical section that sits beside the coding test.
| Reported coding load | Two coding problems for tech roles |
|---|---|
| Difficulty here | Easy to medium |
| Rule | PwC says generative AI is not permitted in assessments |
Think like a data auditor
Audit analytics asks the same few questions of any dataset. Is anything missing from a sequence? Is anything duplicated? Does any total fail to reconcile? Are there patterns that look too regular or too convenient? Each problem below is one of those questions in miniature, so after the set you will have a small toolbox you can apply to unfamiliar data in a test.
In a timed assessment the practical rule is to write the straightforward version first and keep it readable. Reviewers of audit scripts care that someone else can follow the logic and reproduce the result.
A reminder about the stated rules
PwC's own recruitment pages say that generative AI is not permitted during its assessments. Read the instructions in your invitation and treat them as binding. The purpose of this page is to build your own skill before the test, so you can solve these problems unaided.
Hiring status
No sourced PwC statement on fresher numbers or dates is held on this site, so none appear here. The ACs in India entry-level recruitment pages on PwC's own site are the place to confirm the process, including the stated rule above.
PwC coding round questions: questions with worked answers
1 SQL: total the unpaid invoices that were already past their due date at 31 March 2026, per vendor. Table invoices(id, vendor_id, due_date, paid_on, amount).
mediumKeep rows with no payment date, or a payment after the as-at date, and a due date before it. Group by vendor and sum the amount. Use an explicit as-at date instead of the current date so the result is reproducible for an audit. Common mistakes: testing paid_on = NULL, which never matches, and relying on CURRENT_DATE so that rerunning next month changes the answer.
sqlSELECT vendor_id, SUM(amount) AS overdue_total FROM invoices WHERE due_date < '2026-03-31' AND (paid_on IS NULL OR paid_on > '2026-03-31') GROUP BY vendor_id ORDER BY overdue_total DESC;2 SQL: total the journal postings for each month. Table journal(id, posted_on, amount) with ISO text dates.
easyCut the first seven characters of the ISO date to get the year-month, then group by that expression. Order the result by the same key so months come out chronologically. Common mistakes: grouping by the full date, and grouping by month number alone, which merges the same month from different years.
sqlSELECT SUBSTR(posted_on, 1, 7) AS month, SUM(amount) AS total FROM journal GROUP BY SUBSTR(posted_on, 1, 7) ORDER BY month;3 SQL: list invoices whose amount differs from the purchase order, and invoices with no purchase order at all. Tables purchase_orders(po_no, amount) and invoices(id, po_no, amount).
mediumLeft join invoices to purchase orders on the PO number. A NULL on the purchase-order side means no matching PO, and a non-NULL amount that differs is a price mismatch. Select both cases in one WHERE. Common mistakes: using an inner join, which hides invoices with no PO, and comparing with <> alone, which silently drops rows where the PO amount is NULL.
sqlSELECT i.id, i.po_no, i.amount AS invoiced, p.amount AS ordered FROM invoices i LEFT JOIN purchase_orders p ON p.po_no = i.po_no WHERE p.po_no IS NULL OR p.amount <> i.amount ORDER BY i.id;4 SQL: find invoices that were paid more than once. Table payments(id, vendor_id, invoice_no, amount).
easyGroup by vendor and invoice number and keep groups with more than one row. Including the vendor avoids false positives from two vendors that use the same invoice number. Sum the amount to show the exposure. Common mistakes: grouping by invoice number alone, and also grouping by amount, which would miss duplicates paid at different amounts.
sqlSELECT vendor_id, invoice_no, COUNT(*) AS times_paid, SUM(amount) AS total_paid FROM payments GROUP BY vendor_id, invoice_no HAVING COUNT(*) > 1 ORDER BY vendor_id, invoice_no;5 Find the gaps in a sequence of invoice numbers.
easySort the distinct numbers and compare each with the next. When the difference is more than one, the numbers in between are missing, so record that range. O(n log n) for the sort, O(g) for the output. Common mistakes: not removing duplicates first, and listing every missing number when a compact range is clearer for a report.
pythondef invoice_gaps(numbers): ordered = sorted(set(numbers)) gaps = [] for a, b in zip(ordered, ordered[1:]): if b - a > 1: gaps.append((a + 1, b - 1)) return gapsjavaimport java.util.*; class Gaps { static List<int[]> invoiceGaps(int[] numbers) { int[] s = Arrays.stream(numbers).distinct().sorted().toArray(); List<int[]> gaps = new ArrayList<>(); for (int i = 1; i < s.length; i++) if (s[i] - s[i - 1] > 1) gaps.add(new int[]{s[i - 1] + 1, s[i] - 1}); return gaps; } }6 Detect split payments: several payments to one vendor on one day, each under the approval limit, that together reach it.
mediumGroup payments by vendor and date. A group is suspicious when it has more than one payment, every payment is under the limit, and the total is at or above the limit. O(n) time, O(groups) space. Common mistakes: grouping by vendor only, which mixes days, and flagging single payments or groups that already contain a payment over the limit.
pythonfrom collections import defaultdict def split_payments(payments, limit): groups = defaultdict(list) for vendor, day, amount in payments: groups[(vendor, day)].append(amount) return sorted(key for key, amts in groups.items() if len(amts) > 1 and max(amts) < limit and sum(amts) >= limit)javaimport java.util.*; class Splits { static List<String> suspicious(String[] vendor, String[] day, long[] amount, long limit) { Map<String, List<Long>> groups = new TreeMap<>(); for (int i = 0; i < vendor.length; i++) groups.computeIfAbsent(vendor[i] + "|" + day[i], k -> new ArrayList<>()).add(amount[i]); List<String> out = new ArrayList<>(); for (Map.Entry<String, List<Long>> e : groups.entrySet()) { List<Long> a = e.getValue(); long max = Collections.max(a), sum = 0; for (long x : a) sum += x; if (a.size() > 1 && max < limit && sum >= limit) out.add(e.getKey()); } return out; } }7 Flag the proportion of journal amounts that are exact multiples of 1,000.
easyCount positive amounts divisible by 1,000 and divide by the number of positive amounts. A high share of suspiciously round numbers can indicate estimates or manual entries and deserves a closer look. O(n) time, O(1) space. Common mistakes: counting zero as round, and applying floating-point modulus to amounts stored as decimals instead of integer paise.
pythondef round_amounts(amounts, unit=1000): positive = [a for a in amounts if a > 0] flagged = [a for a in positive if a % unit == 0] share = len(flagged) / len(positive) if positive else 0.0 return flagged, sharejavaimport java.util.*; class Round { static double share(long[] amounts, long unit, List<Long> flagged) { int positive = 0; for (long a : amounts) { if (a <= 0) continue; positive++; if (a % unit == 0) flagged.add(a); } return positive == 0 ? 0.0 : (double) flagged.size() / positive; } }8 Count how often each leading digit 1 to 9 appears among a set of amounts, as percentages (a Benford check).
mediumConvert each non-zero amount to its absolute value, take the first character and count. Divide by the number of counted amounts. In many natural financial datasets digit 1 leads about 30 percent of the time; large departures are a prompt to investigate, not proof. O(n) time. Common mistakes: including zero, and counting the sign character of a negative amount.
pythondef leading_digits(amounts): counts = {d: 0 for d in range(1, 10)} total = 0 for a in amounts: if a != 0: counts[int(str(abs(a))[0])] += 1 total += 1 return {d: round(100 * c / total, 1) if total else 0.0 for d, c in counts.items()}javaclass Benford { static double[] leadingDigits(long[] amounts) { int[] counts = new int[10]; int total = 0; for (long a : amounts) { if (a == 0) continue; counts[Long.toString(Math.abs(a)).charAt(0) - '0']++; total++; } double[] pct = new double[10]; for (int d = 1; d <= 9; d++) pct[d] = total == 0 ? 0 : Math.round(1000.0 * counts[d] / total) / 10.0; return pct; } }9 Check whether two numbers differ only by one swap of adjacent digits, a common keying error.
mediumCompare the two numbers as strings. They must have equal length and differ in exactly two positions that are next to each other, with the characters swapped. A known shortcut says that such a pair differs by a multiple of 9, but the converse is not true, so use it only as a quick filter. O(n). Common mistakes: accepting any two numbers whose difference is divisible by 9, and ignoring the equal-length condition.
pythondef adjacent_swap(a, b): x, y = str(a), str(b) if len(x) != len(y) or x == y: return False diff = [i for i in range(len(x)) if x[i] != y[i]] return len(diff) == 2 and diff[1] == diff[0] + 1 and x[diff[0]] == y[diff[1]] and x[diff[1]] == y[diff[0]]javaimport java.util.*; class Swap { static boolean adjacentSwap(String x, String y) { if (x.length() != y.length() || x.equals(y)) return false; List<Integer> diff = new ArrayList<>(); for (int i = 0; i < x.length(); i++) if (x.charAt(i) != y.charAt(i)) diff.add(i); if (diff.size() != 2 || diff.get(1) != diff.get(0) + 1) return false; int i = diff.get(0), j = diff.get(1); return x.charAt(i) == y.charAt(j) && x.charAt(j) == y.charAt(i); } }10 Produce the year-end book values of an asset under the declining-balance depreciation method.
easyEach year the book value falls by a fixed percentage of the previous year's value. Multiply by (1 - rate/100) and round to two decimals at each reported step. O(years). Common mistakes: applying the rate to the original cost each year, which is straight-line, and rounding the rate rather than the money.
pythondef declining_balance(cost, rate_pct, years): book, out = cost, [] for _ in range(years): book = round(book * (1 - rate_pct / 100), 2) out.append(book) return outjavaimport java.util.*; class Depreciation { static List<Double> decliningBalance(double cost, double ratePct, int years) { List<Double> out = new ArrayList<>(); double book = cost; for (int y = 0; y < years; y++) { book = Math.round(book * (1 - ratePct / 100) * 100) / 100.0; out.add(book); } return out; } }11 Pick out the postings that fall on a Saturday or Sunday from a list of ISO dates.
easyParse each date and test its weekday. In Python weekday() returns 5 and 6 for Saturday and Sunday, and in Java getDayOfWeek() returns an enum to compare. O(n). Common mistakes: parsing by hand and getting leap years wrong, and treating a weekend posting as an error when it is only an item for review.
pythonfrom datetime import date def weekend_postings(iso_dates): return [d for d in iso_dates if date.fromisoformat(d).weekday() >= 5]javaimport java.time.*; import java.util.*; class Weekend { static List<String> weekendPostings(List<String> isoDates) { List<String> out = new ArrayList<>(); for (String d : isoDates) { DayOfWeek w = LocalDate.parse(d).getDayOfWeek(); if (w == DayOfWeek.SATURDAY || w == DayOfWeek.SUNDAY) out.add(d); } return out; } }12 List the amounts that sit just below an approval limit, between 95 and 100 percent of it.
easyKeep amounts a with 0.95 * limit <= a < limit. Using integer arithmetic (a * 100 >= limit * 95) avoids floating-point surprises. O(n). Common mistakes: including amounts equal to the limit, which needed approval, and using floats for money.
pythondef near_limit(amounts, limit): return [a for a in amounts if a * 100 >= limit * 95 and a < limit]javaimport java.util.*; class NearLimit { static List<Long> nearLimit(long[] amounts, long limit) { List<Long> out = new ArrayList<>(); for (long a : amounts) if (a * 100 >= limit * 95 && a < limit) out.add(a); return out; } }
Frequently asked questions
What does the PwC coding assessment include?
Reports describe two coding problems for technology roles, alongside other sections. PwC's recruitment pages are the authority on the process, so check them and your invitation.
Why are the problems here about audits?
PwC's technology work often involves analysing ledgers and payment data. Practising gap, duplicate and reconciliation checks builds skills that transfer to an unfamiliar dataset.
Do I need accounting knowledge?
No. Each problem explains its own rule, such as what an overdue invoice or a split payment is. A basic idea of debits and credits helps in later interviews but is not needed here.
Is generative AI allowed during the assessment?
PwC states on its own pages that it is not permitted. Follow the rules in your invitation.
How do I keep SQL answers portable?
Use ISO date strings, explicit as-at dates and standard functions such as SUBSTR, SUM and COUNT. Engine-specific date arithmetic is a common source of errors if the test platform uses a different database.
Sources
Related guides
More in Company Interview Questions
- PwC interview questions and answers
- Qualcomm Coding Round Questions with Solutions
- Qualcomm Interview Questions and Answers for India Software Roles
- Razorpay Coding Round Questions with Solutions
- Razorpay Interview Questions and Answers
- Salesforce Coding Round Questions with Solutions in Python and Java
- Salesforce Interview Questions and Answers for MTS and AMTS Roles
- Samsung Coding Round Questions with Solutions
- Samsung R&D Interview Questions and Answers for India Software Roles
- SAP Coding Round Questions with Solutions in Python and Java
- SAP Labs Interview Questions and Answers for Freshers and SDE Roles
- Sasken coding round questions