In short
An input-output question gives a "machine" that takes one row of words, numbers or letters (the input) and rearranges or operates on it in a fixed, unstated way, producing Step I, Step II, Step III… until the arrangement is complete (the output). The student is shown one solved example and must deduce the hidden rule, then apply it to a fresh input. It is a high-weight set in Indian bank and insurance recruitment — IBPS PO/Clerk Mains, SBI PO/Clerk Mains, RBI Grade B and Assistant, NABARD, LIC AAO and IBPS SO — where one set normally carries 5 questions, and it also appears in the logical sections of campus aptitude tests and in coaching-style placement screens. There is no official syllabus text that codifies the patterns; the formats are set by examiners and change from year to year, so the skill examined is pattern inference under time pressure, not memorised rules. The same thinking (trace a sorting algorithm, read a pipeline stage by stage) is what interviewers probe when they ask you to dry-run code on paper.
Explained
How a set is framed, and what you are really being asked
- The paper gives a worked input with all its steps, then says "If the input is X, answer the following" — the rule is identical for both; only the data changes.
- Three things must be identified before answering anything: what moves or changes, in what order it is selected, and where it is placed.
- Count the elements. A row of 8 elements that is being sorted one element per step will take at most 7 steps; a row where *every* element changes each step is an operation machine, not a shifting machine.
- Compare the input with the last step first. The last step is the finished arrangement and tells you the target (numbers ascending left, words alphabetical right, and so on). Working from the target backwards is faster than reading forward blindly.
- Never assume the rule from the first step alone — one step is consistent with many rules. Confirm it on at least two steps, and ideally on the step that uses an even/odd or left/right alternation.
Type 1 — shifting and arrangement machines (one element per step)
The commonest type. One element is picked each step and inserted next to an already-arranged block; the remaining elements keep their relative order.
- Selection keys used by examiners: alphabetical order of a word; reverse alphabetical order; number value (smallest first / largest first); number of letters in the word; first letter being a vowel or consonant; digit sum of a number; odd before even.
- Placement patterns: (a) all to the left end; (b) all to the right end; (c) alternate ends — odd steps to the left, even steps to the right; (d) two blocks — numbers collect at one end, words at the other.
- Key property: after Step *k*, exactly *k* elements are in final position. So if a question gives you Step III of a new input, you can always go forward; you usually cannot go fully backward.
- Stopping rule: the machine stops the moment the whole row is in final order. Steps = (n − 1) minus the number of largest/last elements that already stand correctly at the far end of the input. If the input is already arranged, there are zero steps.
- This machine is literally selection sort or insertion sort executed one pass at a time — a point worth making in an interview.
Type 2 — operation machines (every element changes each step)
- Each step transforms all elements by an arithmetic or digit rule: halve if even and 3n+1 if odd; add the digit sum; multiply by the position number; square and subtract a constant; alternate +2, −2.
- Digit-level machines: rearrange the digits of each number in ascending/descending order; interchange first and last digits; add or multiply the digits; replace a 3-digit number by (sum of digits × product of digits).
- A mixed form is very common: Step I is a digit operation, Step II rearranges the resulting numbers, Step III operates again. Example rule, applied to input *537 284 916 475 628*:
- Step I — digits of each number in descending order:
753 842 961 754 862 - Step II — these numbers in descending order from the left:
961 862 842 754 753 - Step III — first and last digits interchanged:
169 268 248 457 357
- Step I — digits of each number in descending order:
- These machines *look* fully reversible, but only a one-to-one operation really is — add or subtract a constant, multiply by a constant, interchange or reverse digits. Information-losing rules (digit sum, sorting the digits, or a conditional halve-if-even / 3n+1-if-odd) have several possible predecessors, so the input cannot be pinned down. Type 1 fails backwards because positions are lost; Type 2 fails only when the operation itself is many-to-one.
Type 3 — box, column, rotation and shuffle machines
- Box/column machines: the input is given as two or three rows (or boxes I, II, III); each step moves elements between rows by a rule — top row shifts right, bottom row shifts left, corner elements swap diagonally.
- Rotation machines: the row is rotated by one or two places each step; after n steps (n = number of elements) the input returns. Ask "what is Step 25?" and answer with modulo arithmetic.
- Shuffle machines: swap adjacent pairs; reverse the whole row; reverse each half; interchange first half with second half. These often form a cycle of short period (commonly 2, 3, 4 or 6), which is the whole point of the question.
- Letter–number machines: each word is replaced by a code built from its letters' positions (A = 1 … Z = 26) and then the codes are sorted — a hybrid with coding-decoding, but the shifting logic stays the same.
The solving method, step by step
- Number the positions of the input (1, 2, 3…) and of the last step. Mark which elements are already arranged at either end.
- Compare the last step with the input to read off the final target (ascending/descending, words/numbers, which end).
- Compare Step I with the input: how many elements changed position? One → Type 1. All → Type 2.
- Identify the selected element in each step and list the selection order: 14, 27, 36, 52 means "smallest number first"; brave, flake, guard means "alphabetically first".
- Check the ends. If Step I changed the left and Step II changed the right, it is an alternate-end machine — then odd steps and even steps must be handled separately.
- Apply to the new input and write out every step; do not try to jump to "Step IV" mentally, because one slip in Step II corrupts everything after it.
- Answer all five questions from your written steps. Writing the steps once costs 2 minutes; answering five questions off them costs seconds each.
Question formats, including the backward trap
- Which step is this arrangement? — match the given row against your written steps.
- How many steps are needed to complete the arrangement? — apply the stopping rule; do not blindly answer n − 1.
- What is the element third from the left / second from the right in Step III? — count from the correct end; "from the right" is the standard careless-error trap.
- Which element is exactly between X and Y in the last step?
- How many elements lie between P and Q in Step II? — "between" excludes both endpoints.
- A step is given; find the input. For a Type 1 shifting machine the answer is normally "cannot be determined", because the elements already shifted could have occupied any position in the input. For a Type 2 operation machine the input can be determined only if every operation is one-to-one; digit-sum, digit-sorting or conditional rules are not invertible, so there too the answer is "cannot be determined".
- A step is given; find the next step or the last step. Always answerable, for both types — move forward, never backward.
- Cyclic machines: "which step will be the same as the input?" — the period, or a multiple of it.
Scoring and timing in Indian exams
- Typical weight: 5 questions per set, 1 mark each, with negative marking of 0.25 per wrong answer in IBPS/SBI pattern papers (confirm against the current notification, as marking schemes are revised).
- Budget 4 to 5 minutes for the whole set, not per question — the rule is deduced once and reused five times, so the set is all-or-nothing. If the rule has not emerged in 2 minutes, leave it and return.
- Difficulty has shifted over recent years from plain alphabetical shifting towards mixed digit-plus-rearrangement and box machines in Mains-level papers; prelims rarely carry input-output.
- It does not appear in GATE; GATE's General Aptitude uses numerical and verbal reasoning instead. CAT/XAT and some campus tests use the related "pattern completion" idea rather than the machine format.
Key points
- Input - the original unarranged row; Step - one application of the hidden rule; last step / output - the finished arrangement.
- One element per step - shifting machine (Type 1); all elements change - operation machine (Type 2). Decide this from Step I versus input.
- Relative order rule - in a shifting machine the unarranged elements never change their order among themselves; only the selected element jumps.
- After Step k - exactly k elements of a Type 1 machine are in final position; the rest are still raw.
- Selection key - alphabetical, reverse alphabetical, numeric value, word length, digit sum, vowel/consonant, odd/even.
- Alternate ends - odd steps arrange at the left, even steps at the right; handle the two sequences independently.
- Maximum steps - n − 1 for a one-element-per-step machine on n elements; fewer if the tail of the input is already in final order.
- Backward question - input from an intermediate step is "cannot be determined" for shifting machines, and also for any operation that loses information (digit sum, digit sorting, halve-or-3n+1); only one-to-one operations can be inverted.
- Forward is always safe - the next step and the last step can be found from any given step.
- Cycle machines - swap/reverse/rotate machines repeat with a short period; use step number mod period.
- Two-block output - numbers at one end in order and words at the other end in dictionary order is the most frequent final target.
- Mixed machines - digit operation first, rearrangement second; check each step for a different operation rather than assuming one rule throughout.
- Verify on two steps - a rule that explains only Step I is unproven; the alternation usually shows up at Step II or III.
- Write every step - mental jumps are the single biggest source of lost marks in this set.
- Algorithmic parallel - Type 1 is selection/insertion sort traced pass by pass; Type 3 rotations are modular arithmetic.
- Timing - one set, 4-5 minutes, five marks; abandon it if the rule does not surface quickly.
Formulas and examples
Actual steps = n − 1 − t, where t = number of final-position elements already standing in order at the far end of the input (the end away from where the machine places)
Elements arranged after Step k = k; elements still unarranged = n − k
Cyclic machine: Step m ≡ Step (m mod p), where p = period of the cycle; m mod p = 0 means the arrangement equals the input
Adjacent-sum (pyramid) machine with n numbers a₀…a(n−1): steps = n − 1, final value = Σ C(n−1, i) × aᵢ
Position from the right = n + 1 − (position from the left), for a row of n elements
(Symbols: n = count of elements in the row, k = step number, p = cycle period, C(n, r) = binomial coefficient. These are counting relations, so they are pure numbers with no units.)
Example 1 — alphabetical shifting machine (Type 1, left end). Input: pencil guard flake ozone brave melon (n = 6) Rule deduced: in each step the word that comes earliest in dictionary order among the not-yet-arranged words moves to the immediate right of the arranged block; the others keep their order.
- Step I:
brave pencil guard flake ozone melon - Step II:
brave flake pencil guard ozone melon - Step III:
brave flake guard pencil ozone melon - Step IV:
brave flake guard melon pencil ozone - Step V:
brave flake guard melon ozone pencil— complete.
Answers: steps needed = 5 (= n − 1 = 6 − 1, since the input's last word *melon* is not the largest, so t = 0). Which step is brave flake guard pencil ozone melon? → Step III. Third from the left in Step IV → guard. Second from the right in Step II → ozone (position 6 + 1 − 2 = 5). If only Step II were shown, the input cannot be determined, because *brave* and *flake* could have come from any position.
Example 2 — alternate-end machine with words and numbers (Type 1). Input: 48 prize 15 mango 32 cobra (n = 6) Rule deduced: odd steps send the smallest unarranged number to the extreme left; even steps send the last-in-dictionary unarranged word to the right end of the unarranged portion.
- Step I:
15 48 prize mango 32 cobra - Step II:
15 48 mango 32 cobra prize - Step III:
32 15 48 mango cobra prize - Step IV:
32 15 48 cobra mango prize - Step V:
48 32 15 cobra mango prize— complete: numbers descending from the left, words alphabetical at the right.
Answers: steps = 5. Element third from the left in Step III → 48. Number of elements between 48 and prize in Step II → 3 (*mango*, *32*, *cobra*). Which step first has all three words together? → Step III (mango cobra prize occupy positions 4-6; they are only in dictionary order from Step IV).
Example 3 — operation machine, every element changes (Type 2). Input: 42 17 63 28 55 Rule deduced: each number is halved if even, and replaced by 3n + 1 if odd.
- Step I: 42→21, 17→52, 63→190, 28→14, 55→166 →
21 52 190 14 166 - Step II: 21→64, 52→26, 190→95, 14→7, 166→83 →
64 26 95 7 83 - Step III: 64→32, 26→13, 95→286, 7→22, 83→250 →
32 13 286 22 250
Answers: sum of Step II = 64 + 26 + 95 + 7 + 83 = 275. Largest in Step III = 286. Difference between the largest and smallest of Step II = 95 − 7 = 88. Going forward is always safe, but this input cannot be recovered from Step I: the 52 could have come from 17 (3n + 1) or from 104 (halving), so the rule is many-to-one. Only a one-to-one operation — "add 2", "interchange the first and last digits" — can be run backwards.
Example 4 — adjacent-sum pyramid machine, with the binomial shortcut. Input: 8 15 6 21 4 (n = 5) Rule: each step writes the sums of adjacent pairs, so the row shortens by one element each time.
- Step I: 8+15, 15+6, 6+21, 21+4 →
23 21 27 25 - Step II: 23+21, 21+27, 27+25 →
44 48 52 - Step III: 44+48, 48+52 →
92 100 - Step IV: 92+100 →
192
Check with the formula: C(4, 0…4) = 1, 4, 6, 4, 1 → (1×8) + (4×15) + (6×6) + (4×21) + (1×4) = 8 + 60 + 36 + 84 + 4 = 192 ✓. Steps = n − 1 = 4. The shortcut answers "what is the last step?" in one line, without writing the pyramid.
Example 5 — cyclic shuffle machine and modulo. Input: P Q R S T U Rule: odd steps swap adjacent pairs (1↔2, 3↔4, 5↔6); even steps reverse the whole row.
- Step I:
Q P S R U T - Step II:
T U R S P Q - Step III:
U T S R Q P - Step IV:
P Q R S T U— identical to the input, so the period p = 4.
Answers: Step 23 → 23 mod 4 = 3, so it equals Step III = U T S R Q P. Step 40 → 40 mod 4 = 0, so it equals the input. First step at which the row is exactly reversed → Step III.
| Feature | Type 1 shifting/arranging | Type 2 operation/digit | Type 3 box, rotation, shuffle |
|---|---|---|---|
| What changes per step | One element's position | All elements' values | Positions of several elements |
| Element count per row | Constant | Constant (shrinks in pyramid machines) | Constant |
| Steps to finish | n − 1 at most | Fixed by the question (usually 3-4) | Repeats with period p |
| Can the input be found from a middle step? | Usually no — "cannot be determined" | Only if every operation is one-to-one | Yes, by applying the inverse shuffle |
| Typical selection key | Alphabet, value, length, digit sum | Even/odd, digit sum, digit order | Row/column position, parity of step |
| Algorithm analogue | Selection / insertion sort | Map function over a list | Permutation, modular arithmetic |
Where it is used
- Bank, insurance and regulator recruitment: IBPS PO/Clerk/SO Mains, SBI PO and Clerk Mains, RBI Grade B and Assistant, NABARD, LIC AAO/ADO — set as one 5-question block in the reasoning section.
- Campus placement logical rounds and coaching screens: Wipro, Capgemini, Accenture, Infosys and bank-aspirant batteries use shifting and operation machines; many companies pick them from standard reasoning banks.
- Test and assessment design: item writers at IBPS, TCS iON, AMCAT, eLitmus and private assessment firms build these as machine-generated, auto-scorable items with controlled difficulty.
- Software roles — dry-running code: interviewers ask you to trace bubble, insertion or selection sort pass by pass; a shifting machine is the same trace written in English.
- Data engineering and RPA: an ETL or UiPath/Power Automate pipeline is literally Step I → Step II → Step III over a row of records; debugging means identifying which stage transformed the data and how — the same backward reasoning.
- Banking operations and audit on the job: reconstructing how a record reached its current state from a sequence of system entries, and spotting the step where it went wrong.
Interview questions
- Q: What is an input-output reasoning question? A: A fixed hidden rule converts an input row into successive steps; you infer the rule from one solved example and apply it to a new input.
- Q: How do you decide in ten seconds whether it is a shifting or an operation machine? A: Compare Step I with the input — if only one element has moved and nothing's value changed, it is a shifting machine; if every element's value changed, it is an operation machine.
- Q: Why is the answer often "the input cannot be determined"? A: In a shifting machine the already-arranged elements have lost their original positions, so many different inputs produce the same intermediate step.
- Q: For a machine that arranges one element per step, what is the maximum number of steps for 8 elements? A: Seven — after seven placements the eighth element is automatically in position; it can be fewer if the input's tail is already in order.
- Q: Which sorting algorithm does a typical shifting machine imitate? A: Selection sort when the smallest/largest remaining element is picked each pass, and insertion sort when each element is inserted into an ordered left block.
- Q: What does "after Step III" tell you about the row? A: Three elements are in their final positions and the remaining n − 3 still hold their original relative order.
- Q: How do you answer "what will Step 29 look like?" without writing 29 steps? A: Find the cycle period p of the shuffle and compute 29 mod p; the arrangement repeats, and a remainder of 0 means it equals the input.
- Q: Input 8 15 6 21 4 goes through an adjacent-sum machine — what is the final value, without drawing the pyramid? A: 192, from the binomial weights 1, 4, 6, 4, 1 applied to the five numbers.
- Q: When can you work an operation machine backwards? A: Only when each step is one-to-one, such as adding a constant or swapping two digits; digit sums, digit sorting and halve-or-3n+1 rules have several possible predecessors.
- Q: Why check the rule against two steps rather than one? A: A single step is consistent with several rules; alternating or two-block rules reveal themselves only at the second or third step.
- Q: How would you code such a machine? A: Represent the row as a list, write a function that selects the next element by the key and inserts it at the block boundary, and print the list after each call until it is sorted.
- Q: You have four minutes and the rule has not appeared in two. What do you do? A: Leave the set and return at the end — the five questions stand or fall together, so partial guessing with negative marking is a poor trade.
Common mistakes
- Deducing the rule from Step I only, then applying it to Step II onwards — alternate-end and mixed machines break immediately.
- Trying to reconstruct the input from a middle step of a shifting machine instead of recognising "cannot be determined".
- Assuming every operation machine can be inverted; a digit-sum or digit-sorting step destroys the information needed.
- Counting positions from the wrong end; "second from the right" in a row of 8 is position 7 from the left.
- Treating "between X and Y" as inclusive, which inflates the count by two.
- Mentally jumping to Step III or IV without writing Step I and II, so one early slip wrongs all five answers.
- Assuming the step count is always n − 1, when the machine stops early because the input's tail is already arranged.
- Mixing the selection key with the placement rule — for example sorting by word length but placing alphabetically.
Related topics
Number and letter series · Coding-decoding · Seating arrangement and puzzles · Non-verbal reasoning: figures and patterns · Data sufficiency · Inequalities