E ExamMaster

SSC CHSL · General Intelligence & Reasoning

Machine Input–Output

Name the hidden rewriting rule on a token line (arrangement, circular or block shift, or number operation) from two consecutive machine steps, then predict a later step or the…

Five concepts, one mango line. A PO-mains input-output set hands you 87 mango 61 grape 24 apple and two or three reprints from a hidden machine. Name the family from two consecutive steps — arrangement, shift, or number-op — then write a later step from the rule, not by grinding every reprint.

  • SSC CHSL
  • Medium level
  • 5 concepts
  • 16 practice questions

1Name the rule from two steps

A machine input-output question is a rewriting machine. It is given one line of tokens — words, numbers, or both — and it reprints that line after applying a hidden rule, then reprints it again. The paper shows you the input and two or three of those reprints, called Step I, Step II, Step III, and asks either what the rule is or what a later reprint looks like. We will keep one line for the whole topic: 87 mango 61 grape 24 apple. Every concept below is a different machine, or a different question, about that same mango line.

The first job is not to invent a clever rule from the input alone. The input is just the raw tokens. The rule lives in the difference between two consecutive reprints. Write the input on one row and Step I under it, token under token. Then write Step I and Step II the same way. Three things can have happened, and they name the three families this topic teaches. If some tokens have locked at an end and the rest kept their order, the machine is arranging. If every token slid one or two seats and the one that fell off one end reappeared at the other, the machine is shifting. If the words sat still and the numbers changed value — 87 becoming 88, or 87 becoming 78 — the machine is doing arithmetic on the numbers.

Comparing two consecutive steps names the rule; staring at the input does not. A solver who looks at 87 mango 61 grape 24 apple and invents 'smallest number to the left' has not used any evidence. On this particular line apple already sits at the right end, so Step I of word-left arrangement, mixed-left arrangement and a right circular shift of 1 are the same reprint: apple 87 mango 61 grape 24. One pair of rows is a candidate; the second pair is the confirmation. If the two pairs disagree, you do not have a rule yet.

Write the mango line, Step I and Step II as three rows, token under token. Step I is apple 87 mango 61 grape 24 under three different machines; Step II is what splits them. The family table in this concept lists those three Step IIs.

Order of attack

  1. Stack two pairsWrite Input against Step I, then Step I against Step II, token under token. Do not name a rule from the input row alone.
  2. Ask what movedDid values change (number-op), did every token slide and wrap (shift), or did one or two tokens lock at an end while the rest kept order (arrangement)?
  3. Confirm on the second pairPredict Step II from the candidate rule and check it. On the mango line, Step I is a three-way tie; only Step II names the machine.

Read the mango-line Step I apple 87 mango 61 grape 24 against each family's Step II. The second pair is the classifier.

Three families from two pairs
FamilyWhat changedMango-line Step II
Arrangement (word-left)Next word locks left; rest keep orderapple grape 87 mango 61 24
Arrangement (mixed-left)Next number locks at slot 2apple 24 87 mango 61 grape
Shift (right by 1)Every token slides; 24 wraps to slot 124 apple 87 mango 61 grape
Number-op (+1)Words sit; each number gains 188 mango 62 grape 25 apple at Step I already

The mango line's three-way Step I

Input: 87 mango 61 grape 24 apple. Step I: apple 87 mango 61 grape 24. Step II: apple 24 87 mango 61 grape. Name the machine.

  • Input vs Step I: apple to slot 1; rest keep orderword-left, mixed-left, or right-shift of 1
  • Step I vs Step II: 24 inserted at slot 2; apple staysnot a shift (would be 24 apple …)
  • Step II is not apple grape 87 mango 61 24not word-left
  • Odd step locked a word; even step locked a numbermixed-left arrangement

Pro tip. Apple sitting last is a gift to the examiner. Treat any Step I that only moves an end token as unfinished evidence.

Input: 87 mango 61 grape 24 apple. Step I: mango 61 grape 24 apple 87. The machine is
  1. word-left arrangement (next word locks left)
  2. circular left shift of 1
  3. each number increased by 1

Every token slid one seat left and 87 wrapped to the right end. Word-left Step I is apple 87 mango 61 grape 24. Number-op +1 is 88 mango 62 grape 25 apple. This pair is a left shift.

2Left / right arrangement

An arrangement machine does not change any token's value. It picks one token by a stated key — the alphabetically first remaining word, or the smallest remaining number — and moves that token to one end of the still-unarranged block. Everything it passes keeps the order it already had. The picked token is now locked: later steps do not touch it. The GIF on this card is that move on the mango line, with words locking at the left.

Run word-left on 87 mango 61 grape 24 apple. The remaining words in alphabetical order are apple, grape, mango. Step I pulls apple from the right end to slot 1; the rest keep order, so the reprint is apple 87 mango 61 grape 24. Step II pulls grape to slot 2: apple grape 87 mango 61 24. Step III pulls mango to slot 3: apple grape mango 87 61 24. That is the last step — the three words are locked and the numbers never moved relative to each other.

The rest of the line keeps its relative order. That is the whole method, and it is also the trap: a solver who sorts the leftover tokens, or who slides a word to the left end of the whole line after something is already locked, writes a line the machine never prints. The same pick-and-lock works at the other end (smallest number to the right) and is recorded in the end-choice table in this concept. One end, one key, one token per step.

Animation of the mango line 87 mango 61 grape 24 apple in six slots. Apple slides from slot 6 to slot 1 while the other tokens shift right, then grape slides to slot 2, then mango slides to slot 3, locking each word in green. The closing frame holds apple grape mango 87 61 24.
Each step one word slides to the leftmost open slot; the tokens it passes keep their order and the locked words stay put.

How one step locks

  1. Name the key and the endWhich token is selected (first remaining word, smallest remaining number) and which end of the unarranged block it locks at.
  2. Pull, do not re-sortRemove that token from its current seat and sit it at the named end. Every token it passed stays in the order it already had.
  3. Leave locked tokens aloneThe next step searches only among the still-unarranged tokens. Locked seats are not candidates and are not shuffled.

Each row is a different key-and-end pair on 87 mango 61 grape 24 apple. Step I is enough to see the end; later steps follow the same pick.

Same mango line, three one-end machines
Key and endStep ILast step
First word, leftapple 87 mango 61 grape 24apple grape mango 87 61 24
Smallest number, left24 87 mango 61 grape apple24 61 87 mango grape apple
Smallest number, right87 mango 61 grape apple 24mango grape apple 87 61 24

Word-left on the mango line

A machine arranges the mango line by moving the alphabetically first remaining word to the left of the unarranged block each step. What is Step II?

  • Remaining words in orderapple, grape, mango
  • Step I: apple to slot 1; rest keep orderapple 87 mango 61 grape 24
  • Step II: grape to slot 2; rest keep orderapple grape 87 mango 61 24

Pro tip. If you re-sorted the leftovers you would write apple grape 24 61 87 mango — that line never appears under word-left.

Word-left on 87 mango 61 grape 24 apple. Step II is
  1. apple grape 87 mango 61 24
  2. apple 87 grape mango 61 24
  3. grape apple 87 mango 61 24

Step I locks apple at slot 1. Step II pulls grape to slot 2 and the leftovers 87, mango, 61, 24 keep that order. apple 87 grape … re-sorted the middle; grape apple … unlocked apple.

3Positional shift

A shift machine does not pick a winner. Every token moves the same number of seats, in the same direction, and the tokens that fall off one end reappear at the other in the order they fell. Values do not change. Nothing locks. The mango line under a circular left shift of 1 becomes mango 61 grape 24 apple 87, then 61 grape 24 apple 87 mango, then grape 24 apple 87 mango 61. The GIF on this card is those three slides, with 87 riding an arc from slot 1 to slot 6 on the first step.

Because nothing locks, the line is periodic. A left shift of 1 on six tokens reprints the input as Step VI. A block shift of the first two tokens to the end — 87 mango moving together — has period 3 on this line: Step I is 61 grape 24 apple 87 mango, Step II is 24 apple 87 mango 61 grape, Step III is the input again. Read the size of the block from how many tokens vanish from one end and appear, in the same order, at the other.

Nothing locks — the same tokens will cycle back. That is how you tell a shift from an arrangement after two steps: an arrangement grows a locked prefix (or suffix) that never moves again; a shift keeps every token travelling. It is also why a later-step question on a shift is modular arithmetic, not a sort: Step k of a left shift of 1 is the input rotated left by k \bmod n seats.

Animation of the mango line in six slots. Every token slides one seat left while 87 rides an arc from slot 1 to slot 6, then mango wraps the same way, then 61 wraps. The closing frame holds grape 24 apple 87 mango 61 and notes that nothing is locked and the period is 6.
A left shift moves every token; the one that falls off the left end reappears at the right. No seat ever locks.

How to read a shift

  1. Watch both endsTokens that leave the left end must appear, in the same order, at the right end (a left shift), or the reverse for a right shift.
  2. Count the blockOne token wrapping is a shift of 1. Two tokens wrapping together, order preserved, is a block shift of 2.
  3. Use the periodA shift of 1 on n tokens returns at Step n. Step k is the input rotated by k \bmod n, not a sorted line.

Each row starts from 87 mango 61 grape 24 apple. Period is how many steps reprint the input.

Three shifts of the mango line
ShiftStep IPeriod
Left circular by 1mango 61 grape 24 apple 876
Right circular by 1apple 87 mango 61 grape 246
Block left by 261 grape 24 apple 87 mango3

Left shift of 1, two steps

The mango line is shifted circularly one seat left each step. What is Step II?

  • Step I: 87 wraps to the right endmango 61 grape 24 apple 87
  • Step II: mango wraps to the right end61 grape 24 apple 87 mango
  • Period on 6 tokensStep VI reprints the input

Pro tip. Right-shift Step I is apple 87 mango 61 grape 24 — the same as word-left Step I. Step II (24 apple …) is what proves it was a shift.

Circular left shift of 1 on 87 mango 61 grape 24 apple. After one step the right-end token is
  1. apple
  2. 87
  3. mango

The leftmost token wraps to the right end, so 87 sits at slot 6 and the line is mango 61 grape 24 apple 87. apple was already at the right end of the input; mango is the new left end.

4Number and word mixed

Most PO-mains machines run two keys on one line. Words have their own queue (alphabetical). Numbers have their own queue (ascending or descending). The machine interleaves the two queues: the usual exam pattern, and the one we keep on the mango line, locks the next word on an odd step and the next number on an even step, both at the left of the still-unarranged block. Words and numbers are two separate queues, not one alphabet.

On 87 mango 61 grape 24 apple the word queue is apple, grape, mango and the number queue is 24, 61, 87. Mixed-left therefore prints: Step I apple 87 mango 61 grape 24 (word), Step II apple 24 87 mango 61 grape (number), Step III apple 24 grape 87 mango 61 (word), Step IV apple 24 grape 61 87 mango (number), Step V apple 24 grape 61 mango 87 (word). The finished line is the two queues zipped: word, number, word, number, word, number.

The other common mixed pattern locks a number at the left and a word at the right in the same step. That is still two queues; only the ends differ. What it is not is a single sort of all six tokens, and it is not word-left with the numbers treated as extra words. If you alphabetise 24 next to apple you have merged the queues, and the options are built to reward that merge.

Figure. Two queues zip into the finished mango line: words take the first, third and fifth seats; numbers take the second, fourth and sixth.

How the two queues zip

  1. Split the queuesList remaining words alphabetically and remaining numbers in the stated numeric order. Never sort the two lists together.
  2. Read the interleaveOdd step takes the next word; even step takes the next number (mixed-left). Or one step takes both, one to each end.
  3. Pull from the current lineThe selected token leaves its present seat; leftovers keep their order. Locked seats from earlier steps stay put.

Mixed-left zips these two lists into apple 24 grape 61 mango 87. A left-and-right mixed machine would instead finish 24 61 87 mango grape apple.

Two queues on the mango line
QueueOrderMango-line members
WordsAlphabeticalapple, grape, mango
NumbersAscending24, 61, 87

Mixed-left Step III

The mango line runs mixed-left (odd step = next word left, even step = next number left). What is Step III?

  • Word queue / number queueapple, grape, mango / 24, 61, 87
  • Steps I–II place apple, then 24apple 24 87 mango 61 grape
  • Step III places grape; leftovers keep orderapple 24 grape 87 mango 61

Pro tip. apple 24 grape 61 87 mango is Step IV. Jumping a step is the usual mixed-line miss once the queues are known.

Mixed-left on 87 mango 61 grape 24 apple. Step III is
  1. apple 24 grape 87 mango 61
  2. apple 24 grape 61 87 mango
  3. apple grape mango 24 61 87

Three placements: apple, 24, grape. Leftovers 87, mango, 61 stay in input order, so the line is apple 24 grape 87 mango 61. The second option is Step IV. The third option merged the two queues into words-then-numbers.

5Last step and Step k

Once the rule is named, a later-step question is not an invitation to reprint every line. The last step is the finished order, not one more grind of every line. For mixed-left on the mango line the finished order is the zipped queues apple 24 grape 61 mango 87. That line first appears as Step V; Step VI would only reprint it. Write the finished line from the queues and stop.

A named earlier step is almost as cheap. After k mixed-left placements the first k tokens of the finished line are already locked, and every token that is not among those k is still sitting in its original relative order. Step III of the mango line is therefore apple 24 grape — the first three of the finished line — followed by the leftovers 87, mango, 61 in input order: apple 24 grape 87 mango 61. That is the leftover rule, and it is how you answer Step IV or Step V without writing Step I.

The same shortcut works for a one-end arrangement: word-left's finished line is apple grape mango 87 61 24, so its Step II is apple grape plus leftovers 87, mango, 61, 24. It does not work for a shift — a shift has no finished line, only a rotation — which is why naming the family in the first concept is not optional bookkeeping. If the options offer both the finished mixed line and the word-then-number merge apple grape mango 24 61 87, the merge is the trap, not a shortcut.

Take the finished mixed line apple 24 grape 61 mango 87, keep the first k tokens, and append every leftover token in the order it had on the input. Step III keeps apple 24 grape and appends 87 mango 61.

Jump, do not grind

  1. Write the finished lineZip the two queues (or lock every selected token at the named end). That string is the last step.
  2. Cut at kStep k is the first k tokens of that finished line, then every leftover token in its original input order.
  3. Refuse a shift shortcutIf the machine was a shift, rotate by k \bmod n instead. There is no sorted last step to write.

Finished line F = apple 24 grape 61 mango 87. Each row is F's prefix plus the leftovers of 87 mango 61 grape 24 apple.

Mango mixed-left by the leftover rule
AskedLocked prefix of FLine
Step IIIapple 24 grapeapple 24 grape 87 mango 61
Step IVapple 24 grape 61apple 24 grape 61 87 mango
Last stepall of Fapple 24 grape 61 mango 87

Step IV from the leftover rule

Mixed-left on the mango line. What is Step IV, without writing Steps I to III?

  • Finished line Fapple 24 grape 61 mango 87
  • First 4 of Fapple 24 grape 61
  • Leftovers in input order87, mango
  • Step IVapple 24 grape 61 87 mango

Pro tip. The last leftover number 87 is already at the right end of that line, so Step V only has to slide mango into slot 5. That is why the finished line first appears as Step V, not Step VI.

Mixed-left on 87 mango 61 grape 24 apple first shows the finished line at
  1. Step IV
  2. Step V
  3. Step VI

The finished line apple 24 grape 61 mango 87 is complete after five placements (apple, 24, grape, 61, mango). Step IV is still apple 24 grape 61 87 mango. Step VI would only reprint Step V.

Notes

  • A machine input-output item gives one input line of words and numbers and two or three reprints (Step I, Step II, Step III). The rule is named by what changed between two consecutive reprints, never by staring at the input alone.
  • Arrangement: each step one selected token locks at an end of the still-unarranged block; the rest keep their relative order. Words usually lock in alphabetical order, numbers in ascending or descending order.
  • Shift: every token slides the same number of seats and the ones that fall off one end reappear at the other. Nothing locks, so a left shift of 1 on n tokens reprints the input after n steps.
  • Number-op: the words sit still and the numbers change value (plus one, reverse digits, half). If a number's digits change, it is not an arrangement and not a shift.
  • Mixed lines run two queues on one reprint: odd steps often lock the next word, even steps the next number (or both ends move in one step). The last step is the finished interleaving; Step k is the first k tokens of that finished line plus the leftovers in their original order.

Formulas

  • A circular shift of 1 seat on n tokens has period n: Step n reprints the input.
  • A block shift of b seats on n tokens has period n / \gcd(b, n).
  • Word-left arrangement of w words finishes in w steps (the last leftover word is forced).
  • Mixed-left (odd step = next word, even step = next number) on w words and m numbers finishes in w + m - 1 steps: the last leftover token is already in the only open slot.
  • Step k of mixed-left = the first k tokens of the finished line, then every leftover token in its original input order.

Exam traps & shortcuts

  • Write Input, Step I and Step II as three rows, token under token, before naming anything. One pair of rows is a candidate; the second pair is the confirmation.
  • If the alphabetically first word happens to sit at the right end, Step I of word-left arrangement equals a right circular shift of 1. Only Step II splits them.
  • Once the rule is named, write the finished line from the two queues and jump. Do not reprint Step I through Step IV just to reach Step V.
  • If a number's value changed (87 to 88, or 87 to 78), stop looking for a permutation — it is a number-op.

Reference tables

Pick the family from two stacked pairs, then the key and the end, before computing a later step.

Input-output toolkit
What two steps showFamilyHow to jump
One or two tokens lock; rest keep orderArrangementWrite the finished lock order
Every token slides; ends wrapShiftRotate by k \bmod n
Numbers change value; words sitNumber-opApply the same arithmetic again
A word move then a number moveMixed arrangementZip the two queues, then cut at k

Recap

Read only this the night before.

Two pairs, not one
On the mango line, Step I apple 87 mango 61 grape 24 is shared by word-left, mixed-left and a right shift of 1. Step II names the machine.
Arrangement keeps leftover order
The selected token locks at one end of the unarranged block. Re-sorting the leftovers is a different machine.
Shift never locks
A left shift of 1 on n tokens has period n. Step k is a rotation, not a sort.
Two queues, not one alphabet
Mixed-left zips apple, grape, mango with 24, 61, 87 into apple 24 grape 61 mango 87.
Last step is the finished line
Write the zipped queues. Step k is that line's first k tokens plus leftovers in input order. Do not grind I through IV to reach V.

Practise Machine Input–Output

Reading is free and needs no account. Practice, mocks and progress live in the app.

  • 16 exam-style questions on this topic, with explanations
  • A 6-question practice set that ends the chapter
  • Timed mocks scored with the real marking scheme
  • Readiness tracked per topic, kept on your device
Continue with Google — freeNo card, no trial. Works offline once installed.