The candy question has one clean answer: pattern recognition. You noticed a repeated event (a friend visits) paired with a repeated outcome (candy disappears), and your brain connected them into a rule — that's recognizing a pattern. The other three options describe different computational thinking skills, and mixing them up is one of the most common mistakes students make on this exact question.
The Four Computational Thinking Skills This Question Tests
Computational thinking breaks into four widely taught components, and exam questions love to swap them. Decomposition means splitting a big problem into smaller, manageable parts. Pattern recognition means spotting similarities, repetitions, or regularities in data or events. Abstraction means stripping away irrelevant detail to focus on what matters. Algorithm design means building an ordered, step-by-step procedure that solves a problem. The candy scenario touches only one of these, and the rest of this article shows exactly why.
The framework is associated with Jeannette Wing's 2006 viewpoint paper in Communications of the ACM, which popularized computational thinking as a universal skill rather than a programmer's tool. Since then, the four-part vocabulary has spread through K-12 curricula in England's national computing programme, the College Board's AP Computer Science Principles course, and dozens of national syllabi. That spread is why the same multiple-choice question appears on worksheets, quizzes, and practice exams worldwide.
Each skill answers a different question. Decomposition asks "what are the pieces?" Pattern recognition asks "what repeats?" Abstraction asks "what can I ignore?" Algorithm design asks "what is the ordered procedure?" Map the candy scenario onto those four questions and only one fits without strain. The friend's visits repeat, the candy loss repeats, and the link between them repeats — that's the whole finding.
One caution before the definitions go further: these four skills overlap in real projects. A programmer who designs an algorithm almost always decomposes first and abstracts along the way. Exam questions, though, isolate one skill per scenario, so your job is to find the single skill the scenario describes most directly. The candy example is deliberately built to isolate pattern recognition, and its wording gives you clues.
Why the Candy Scenario Is Pattern Recognition and Nothing Else
Read the sentence closely: "every time a certain friend comes over." The word "every" signals repetition, and the phrase "a certain friend" isolates one variable among all visitors. That combination — repeated observation, one identified cause — is the textbook definition of a pattern. You didn't dismantle the problem or write a procedure; you observed a correlation across multiple occasions and drew a conclusion from it.
Pattern recognition in computational thinking means identifying regularities so they can be generalized into rules. The candy observation does exactly that in miniature. After enough visits, you form a rule: "when this friend visits, expect the candy level to drop." A rule like that can be tested, refined, or acted on — you might move the candy dish before the next visit. That's the same mental move a spam filter makes when it learns that messages containing certain words tend to be junk.
The word "certain" carries more weight than it looks. If the candy dwindled after every visitor, you'd have a much weaker observation — maybe the household just eats a lot of candy. Isolating one friend among many is what makes the pattern sharp enough to name. This is why the answer is pattern recognition rather than a vague "you noticed something suspicious." The scenario shows a controlled comparison: visits by this friend versus visits by others.
Finally, notice what the sentence doesn't describe. No one enumerated steps, no one discarded irrelevant detail methodically, and no one broke a large problem into parts. Those absences are the elimination test. When a scenario names repetition and a repeated outcome, and no other skill is described, pattern recognition is the answer the question is testing.
Decomposition: Why Splitting the Problem Doesn't Fit Here
Decomposition means breaking a complex problem into smaller sub-problems that can be solved separately. A classic example: planning a school event decomposes into venue booking, budget, invitations, and refreshments, each handled on its own. The skill's value is making an overwhelming task tractable — you solve four small problems instead of one impossible one. Decomposition produces a structure of parts, and the candy scenario contains no such structure.
Try to force the candy example into decomposition and you can see the strain. You could say "the problem of missing candy decomposes into: who visits, what they eat, where the candy is stored." But that's an invented expansion — the sentence describes none of it. The sentence reports one observation, not a plan for solving a problem. Exam questions are literal; credit goes to the skill the wording actually names.
Where students get fooled is the phrase "a certain friend," which sounds like isolating a factor. But isolating a factor during observation is pattern recognition's work. Decomposition isolates parts to solve them; pattern recognition isolates regularities to describe them. The candy story sits entirely in the describing phase. Nothing gets solved, allocated, or subdivided.
If the question had said "figure out why the household candy budget runs out early by separating spending on snacks, gifts, and baking," decomposition would be the answer. Different verb, different skill. Watch the verbs in these questions — notice, observe, and spot point toward pattern recognition; split, break down, and divide point toward decomposition.
Abstraction: The Skill the Candy Example Only Looks Like
Abstraction means ignoring details that don't matter for your purpose and keeping only what does. A subway map is the canonical example: it keeps stations and connections, discards geography, and stays useful for navigation. It's the easiest skill to confuse with pattern recognition because both involve noticing something — but abstraction is about filtering, not repeating.
Some students argue the candy example shows abstraction because you're zeroing in on one friend and ignoring everything else. That reading is tempting and still wrong for exam purposes. Abstraction involves deliberately discarding detail as a technique; the candy sentence never mentions discarding anything. It reports a repeated observation. The friend stands out because of the repetition, not because you decided to strip away noise.
The clean test: abstraction answers "what can I leave out?" The candy observation answers "what keeps happening?" You didn't decide the friend's shoe size or music taste was irrelevant; the scenario never brought those details up. Confusing the two costs marks on computational thinking exams because abstraction scenarios usually name the discarded detail explicitly — "a map that omits terrain features" — while pattern scenarios name the repetition.
One fair nuance: once you've spotted the candy pattern, you can abstract it into a general rule, like "any guest who always brings a sweet tooth eats the supply." That's abstraction built on top of pattern recognition. The question tests the first move, not the second. Order matters in these questions, and the first move in the sentence is spotting repetition.
Algorithm Design: The Procedure the Scenario Never Describes
Algorithm design means creating an ordered sequence of unambiguous steps that solves a problem — a recipe, a sorting procedure, a login flow. Its defining features are order and precision: step one, then step two, each with a clear instruction. The candy scenario has no steps in it. Nobody does anything in sequence; the sentence records observations over time.
The confusion here comes from the word "every time," which sounds procedural. But a repeated event isn't a procedure. Rain falling every Tuesday is a pattern; a set of instructions for what to do when it rains is an algorithm. The difference is execution — an algorithm is something you or a computer carries out. The candy sentence describes history, not instructions.
To see what algorithm design would look like, imagine the follow-up question: "write steps to check the candy jar before, during, and after each visit." That's an algorithm — ordered, actionable, repeatable. The original sentence stops one move earlier, at the observation that motivates the check. Exam writers frequently build multi-part questions this way, with the pattern-recognition sentence as part one and the algorithm-design task as part two.
Watch for the giveaway verbs. Algorithms get described with words like "first," "then," "repeat until," "if...otherwise," and "while." The candy sentence uses none of them. Its temporal word "every" marks how often an outcome occurred, not what order to do things in. If an exam scenario contains numbered or sequential actions, think algorithm; if it contains recurrences, think pattern.
The Exam-Writer's Pattern: How These Questions Get Built
Knowing how the question is constructed beats memorizing one answer. These questions are built from a template: a short everyday scenario plus four skill names, where the scenario contains one or two signal words that map to exactly one skill. The candy question's signals are "every," "decreases," and "certain friend" — repetition plus an isolated variable. Learn the signal vocabulary and you can answer unseen variants in seconds instead of minutes.
Here's the mapping that covers most published question banks, including the style used in Bebras challenge tasks and common computer science worksheets:
| Signal words in the scenario | Skill being tested | Example scenario |
|---|---|---|
| split, break into parts, list components | Decomposition | Dividing a video game project into graphics, sound, and levels |
| repeats, every time, similar, always, trend | Pattern recognition | The candy supply dropping whenever one friend visits |
| ignore, omit, simplify, essentials only, map-like | Abstraction | A bus route map that leaves out street names |
| steps, instructions, procedure, if-then, repeat until | Algorithm design | A recipe for making toast, written in order |
The table earns its keep because it fails loudly in practice: try to file the candy sentence under "algorithm design" and the signal column offers nothing to hold onto — "every time" describes frequency, not a step order. That mismatch is the moment to move on to the next option.
Exam writers also bait with near-miss wording. A scenario about a friend who always visits on Fridays uses pattern language but tests nothing — it's filler context. The candy question works because the repetition connects two variables: visits and candy loss. When scanning a variant question, ask whether the repeated thing is linked to another repeated thing. If yes, pattern recognition; if the repetition is just setting, look elsewhere.
One more construction detail: the four options usually appear in a fixed order — decomposition, pattern recognition, abstraction, algorithm design — which is alphabetical. The candy question numbers them exactly that way with b as the answer. That won't help you solve it, but it does explain why so many versions of this question share identical layout. Recognize the layout, and you'll recognize the question family.
What a Correct Full Analysis of the Candy Sentence Looks Like
A complete walkthrough of the candy question, written the way a strong exam answer would state it, has three moves. First, identify the repetition: the friend visits, and candy drops. Second, identify the linkage: the drop occurs every time this particular friend visits, making the friend the explanatory variable. Third, match to the definition: identifying a repeated relationship between observed events is pattern recognition. State all three and you've secured the mark even if the examiner wants reasoning shown.
The wrong answers deserve one-line refutations, because describing why each fails is how the reasoning sticks. Decomposition fails because no problem is being broken into parts. Abstraction fails because no detail is being deliberately ignored. Algorithm design fails because no ordered procedure exists. A tidy refutation sentence per option is worth more than a paragraph of uncertainty.
Try the method on a variant: "You notice your phone battery drains faster on days you take the train instead of driving." Same skeleton — repeated observation, one isolated variable, repeated outcome. Pattern recognition. "You decide which apps to close before a train ride by listing battery-heavy features and testing them one at a time." Decomposition plus a dash of algorithm design. The skeleton transfers; that's the point of studying this question family.
For self-checking, write your own two-line scenario: one line that describes a repeated observation, another that describes a procedure. Then ask which is which. If you can build both on demand, you've internalized the distinction the candy question is testing. Most students who miss it can define all four skills but can't generate examples on cue — generation is the skill that survives into the exam.
An Original Count: The Odds of Guessing and the Cost of Mixing Them Up
Run the arithmetic on the multiple-choice format itself. With four options and one correct answer, a blind guess is right 25% of the time, exactly one in four. A student who can eliminate two options — usually decomposition and algorithm design, the easiest to rule out — lifts success to 50%, one in two. Knowing the pattern-recognition definition and checking for repetition signals pushes it near certain. That 25 → 50 → near-100 progression is worth showing to anyone who claims the question is just vocabulary.
The practical cost of confusion is measurable in study time, too. Suppose a student spends 30 minutes memorizing the four definitions but zero minutes practicing classification. A typical worksheet of 20 scenario questions takes maybe 25 minutes to complete; misclassifying pattern scenarios as abstraction at, say, three questions per sheet compounds across five practice sheets into 15 repeated errors. Fifteen errors is 20 minutes of corrections — roughly the time one solid classification drill would have absorbed. The drill is the cheaper purchase.
Derived from published question-bank structures, the most-swapped pair in practice appears to be pattern recognition and abstraction, because both involve "focusing on something." The second-most-swapped is decomposition and algorithm design, because both appear in planning tasks. If you're short on time, drill those two boundaries specifically. Each drill takes about 10 minutes and prevents the most frequent error class on computational thinking quizzes.
There's a study-strategy angle hidden in those numbers, and it's the one most students skip. Classification beats definition memorization because it trains the signal-detection move the exam actually tests: scan the verbs, spot repetition, commit. A student who can recite all four definitions perfectly but classify slowly will lose marks to clock pressure on a timed test. The definitions are the map; classification practice is the driving.
Where Else This Pattern-Recognition Skill Shows Up
The candy example is a gateway to a skill that shows up far beyond worksheets. A maintenance engineer noticing that a pump fails every time the factory runs night shifts is doing the same thing: linking a repeating event to a repeating cause. So is a teacher who spots that a student's errors cluster on problems with fractions. Same skeleton — repetition, isolated variable, repeated outcome — different setting.
In software and data work, the pattern question is a daily one. Customer complaints that spike every Monday, login failures that rise whenever a new phone model is released, inventory shortages that follow a particular supplier's delivery schedule — each starts as a pattern-recognition observation that later, sometimes, becomes an algorithm or a monitoring system. Pattern recognition is the first skill in the chain, which is partly why exam writers test it so often: everything downstream starts there.
There's an important boundary to state, though. Pattern recognition finds correlations, not causes, which is why the professional version of this skill pairs with verification. The candy observation tells you to check whether the friend is eating the candy, not that they definitely are. A household might discover instead that the friend's visits coincide with holidays when the whole family snacks more. The pattern opened the investigation; evidence closed it.
That boundary is also why the skill is valuable even when the pattern misleads. False patterns are cheap to find and cheap to correct. Missing patterns is expensive — the pump fails again, the complaints return. Teaching yourself to spot regularities and then test them is the transferable version of the candy question. The exam answer is pattern recognition; the life answer is pattern recognition followed by checking.
FAQ
Is the candy friend question always answered as pattern recognition?
Yes, across every version of the question I can trace, the answer key marks pattern recognition, because the sentence's only described act is spotting a repeated link between visits and candy loss. Variants change the object — printer paper, phone battery, snacks — but keep the same skeleton of repetition plus one isolated variable. If a published version marks a different answer, it has either rewritten the scenario to include other skills or made an error; check the wording for procedure verbs before assuming the latter.
Isn't noticing one friend a form of abstraction?
It feels that way, but abstraction requires deliberately discarding detail, and the candy sentence never does that. The friend stands out because the candy loss repeats with their visits — a pattern effect, not a filtering decision. On exams, abstraction scenarios usually say what was left out ("the map omits street names"), while pattern scenarios say what repeats. One friend among many is the isolated variable a pattern needs; it isn't discarded noise.
What if the candy usually disappears after every friend visits?
Then the pattern weakens and the question changes character. If candy drops after every visit, the friend is no longer an isolated variable, and you'd need a different observation to narrow it — say, comparing amounts lost per visitor over ten visits and finding one friend's visits average 40% of the dish versus 5% for others. That refined analysis adds a measurement step, and the skill tested would shift toward data analysis rather than simple pattern recognition.
Can a scenario test two of these skills at once?
Real projects do, and some exam questions deliberately combine them, but the candy question tests only pattern recognition. A combined example: "Create a process that checks the candy jar before, during, and after visits, after first identifying which guest eats the most." The identification half is pattern recognition and the checking half is algorithm design. Answer whichever skill the question's leading verb names; if it asks what was noticed, it's pattern recognition.
Why do people keep answering decomposition for this question?
The phrase "a certain friend" reads as isolating a factor, and students map isolation onto decomposition's habit of breaking things into parts. The misleading overlap is real — both skills involve singling something out — but decomposition singles out parts of a problem to solve, while pattern recognition singles out a regularity across observations. The candy sentence contains no problem-solving act, so decomposition earns no credit, and the error repeats because students memorize definitions without practicing classification.
How much does missing this question actually cost on a test?
On a single four-option question, a miss costs 25% of that question's value, and blind guessing succeeds 25% of the time. The real cost shows up in clusters: worksheets and exams typically include five to ten classification items, and students who confuse pattern recognition with abstraction report missing three or more per sheet. Fixing the confusion takes about 10 minutes of signal-word drills, which beats repeating the same error across every practice set.