HP JBT common mistakes
HP JBT · Understand the traps and how to avoid them.
When evaluating a post-increment inside a larger expression, the candidate applies the increment before using the variable's value (treating i++ as ++i), then predicts the wrong printed result.
The difference between value-of-then-increment and increment-then-value is only one evaluation-order rule, and under time pressure candidates pattern-match on the symbol rather than tracing the sequence point. Mixed pre/post increments in the same expression are also undefined behaviour in C, which candidates conflate with a defined left-to-right rule.
What to do instead
Trace expressions line by line on paper, writing the variable's value in a column after each subexpression is evaluated. Practise five expressions that mix i++ and ++i and state the value at each step. Separately memorise that modifying a variable twice between sequence points is undefined, so any question relying on it has no guaranteed answer.
The candidate computes the time complexity of a nested loop by multiplying the bounds mechanically (e.g. calling a loop that halves its counter O(n)) instead of counting how many times the inner body actually executes.
The multiply-the-loops shortcut works for simple nested loops, so candidates stop checking whether the inner bound depends on the outer index or shrinks geometrically. Logarithmic loops look structurally identical to linear ones.
What to do instead
For every loop, write the sequence of counter values for n=8 and n=16 and count iterations. If doubling n adds a constant number of iterations, it is logarithmic; if it doubles, linear. Also state the recurrence for divide-and-conquer code and solve it with the master theorem rather than guessing.
When asked for a hash table's worst-case lookup, the candidate answers O(1) because that is the average case they memorised, without noting the collision scenario that degrades it to O(n).
Average-case complexity is taught first and repeated most often, so it becomes the default answer. Candidates also assume the question is asking about a well-distributed hash function when it does not say so.
What to do instead
For every data structure, keep a two-column table of average and worst case for search, insert, and delete, and write the worst-case trigger next to it (all keys colliding into one bucket, unbalanced tree, etc.). Read the question for the words 'worst case' before answering.
The candidate answers a SQL question with a WHERE clause on an aggregate (e.g. WHERE COUNT(*) > 5) or puts a filter on the wrong side of a LEFT JOIN, silently turning it into an inner join.
WHERE feels like the natural place for all filtering, and the logical order of execution (FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY) is rarely rehearsed. The LEFT JOIN filter error is invisible because the query still runs and returns rows.
What to do instead
Memorise the clause execution order and use HAVING for any condition on an aggregate. For outer joins, decide explicitly whether the filter belongs in ON (preserves unmatched rows) or WHERE (removes them), and test with a row that has no match to confirm NULLs survive.
The candidate treats a TCP three-way handshake or a DNS resolution as a single step and mislabels which side sends SYN, SYN-ACK, and ACK, or claims the recursive resolver returns the answer directly from the root server.
These protocols are learned as diagrams rather than as sequences with an initiator and a responder, so directionality is lost. DNS hierarchy is compressed into 'the resolver asks the root' without the referral steps.
What to do instead
Write each protocol as an ordered list naming the sender for every message: client SYN, server SYN-ACK, client ACK. For DNS, list root referral, TLD referral, authoritative answer, then caching at the resolver. Rehearse by reciting the list aloud without notes.
The candidate picks the testing level or test type by keyword association, labelling a test of one function's return value an integration test, or calling a check of internal branch coverage an acceptance test.
The terms unit, integration, system, and acceptance are defined by scope and by who owns them, not by the technique used, and candidates match on words like 'test' rather than on what is under test and who runs it.
What to do instead
Before answering, ask two questions: what is the smallest thing under test, and who decides pass/fail? One function in isolation with a developer's assertion is unit; several real components together is integration; the whole system against requirements is system; the customer's business criteria is acceptance. Classify ten short scenarios this way.
In quantitative aptitude, the candidate sets up a percentage-change or successive-discount problem as a simple addition (20% increase then 20% decrease = no change) and commits to the first plausible option.
Additive intuition is fast and feels right, and successive percentage changes are multiplicative. Candidates also skip the estimation step that would expose the error, then run out of time to check.
What to do instead
Always convert successive changes to multipliers (1.2 x 0.8 = 0.96, a 4% net decrease) and compute with round numbers before touching the options. Sanity-check the direction of the answer: a rise then an equal fall must end below the start. Do three such problems with a calculator check until the multiplier habit is automatic.
On seating-arrangement or blood-relation puzzles, the candidate builds the arrangement mentally, reaches a contradiction at the third clue, and restarts from scratch instead of recording partial constraints.
Working memory is overloaded by holding several positional constraints at once, and the first clue is treated as fixed fact rather than as one of several possible cases. Restarting feels productive but burns the clock.
What to do instead
Draw the seats or family tree on paper and mark each clue with a tick as it is placed. When a clue creates two possibilities, branch into Case 1 and Case 2 and eliminate the case that contradicts a later clue. Never erase; strike through and note why the case failed.
In reading comprehension, the candidate answers from prior knowledge or personal opinion about the passage's topic rather than from what the passage states, choosing an option that is true in the world but unsupported by the text.
Familiar subject matter triggers background assumptions, and answer options are deliberately written to sound authoritative. Candidates also pick an option because it repeats words from the passage, even when the relationship is reversed.
What to do instead
For each option, locate the exact line in the passage that supports or contradicts it and mark the line number beside the option. Eliminate any option with no matching line, however plausible. Watch for reversed causation and swapped quantities, which are the two most common traps.
The candidate answers operating-systems questions about virtual memory or process states by assuming pages are loaded on demand at the moment of first access, and describes a process as moving directly from running to ready only on a timer interrupt, missing blocking transitions.
Paging and scheduling are taught as definitions rather than as event sequences, so the trigger for each transition is not stored. The page-fault path is compressed to 'the page is loaded' without the trap, the OS handler, and the restart of the instruction.
What to do instead
Draw the five-state process diagram with an arrow label for every transition and its cause (dispatch, time slice expiry, I/O request, I/O completion, termination). Write the page-fault sequence as numbered steps ending in the instruction restart. Recite both from a blank page.