Input-Output and Machine Arrangement

This chapter answers the Input-Output (machine arrangement) items of the Reasoning test (Reasoning Ability and Computer Aptitude in the SBI Mains papers; Reasoning in the IBPS Mains and RRB papers), a set that appears in IBPS PO, IBPS Clerk and IBPS RRB Mains and in SBI Clerk and SBI PO Mains as a short, high-scoring puzzle. The IBPS and SBI notifications give no topic-level syllabus, so the pattern here follows the question types candidates report in the Mains papers. A machine takes an input line of words, numbers or both and rearranges or transforms it in numbered steps by a fixed rule. The chapter teaches how to read a machine, the three arrangement patterns, spotting a rule from two steps, working backwards from a later step, operation-based machines, alphanumeric and letter-shift machines, and a speed method. Every worked example is recomputed step by step; every question states its own rules and full input.

How to Read a Machine

An input-output question gives an input line and shows some steps. Each step applies one rule to the line produced by the step before it. The rule is never changed halfway unless the stem says so. Your job is one of three:
(1) trace forward to a stated step,
(2) identify the rule from the steps shown and then apply it to a new line, or
(3) work backwards from a later step to the input. Every question in this chapter states its rule in the stem, because the app shuffles questions; in the exam the rule is usually hidden in the first one or two steps.

  • Count the positions first. Number the places 1 to n from the left. Rules such as "the second place from the right" are position rules, and confusing the left and right ends is the most common slip.
  • Change only what the rule changes. Copy the rest of the line unchanged. Write each step on a new line, in a column, so that you can compare it with the line above.
  • Words and numbers use different orders. Words follow the dictionary (alphabetical) order or their number of letters; numbers follow ascending or descending value. A rule says which one applies.
⚠️ The step the machine stops at
Some stems say "the machine stops when the numbers are in ascending order". Then the count of steps ends at the first line that satisfies this, even if the pattern could carry on. A number that is already in its final place does not add a step, so look at the line, not at the number of items.

Arrangement Machines: Shift and Alternating Patterns

In an arrangement machine the items are not changed, only moved. The two commonest patterns are shown with a full trace. Pattern 1, selection shift: in step k the k-th smallest number is brought to the k-th place from the left and the others shift right, keeping their order. Input 52 17 38 9 24 gives the lines below.

Selection shift, ascending, trace of 52 17 38 9 24
LineNumbersWhat moved
Input52 17 38 9 24-
Step I9 52 17 38 249, smallest, to place 1
Step II9 17 52 38 2417 to place 2
Step III9 17 24 52 3824 to place 3
Step IV9 17 24 38 5238 to place 4: sorted, stop

For n numbers this machine needs at most n − 1 steps, because once n − 1 places are right the last one is right too. Here n = 5 and it took 4 steps.

Pattern 2, alternating ends: step I brings the largest to the left end, step II sends the smallest to the right end, step III brings the second largest to place 2 from the left, step IV sends the second smallest to place 2 from the right, and so on. Input 34 71 18 52 9 63:

Alternating ends, trace of 34 71 18 52 9 63
LineNumbers
Step I (largest 71 to the left end)71 34 18 52 9 63
Step II (smallest 9 to the right end)71 34 18 52 63 9
Step III (63 to place 2 from the left)71 63 34 18 52 9
Step IV (18 to place 2 from the right)71 63 34 52 18 9
Step V (52 to place 3 from the left)71 63 52 34 18 9

The same patterns work on words once the order is fixed. If the order is the number of letters, input loan fee interest cheque deposit (4, 3, 8, 6, 7 letters) under Pattern 2 gives Step I interest loan fee cheque deposit, Step II interest loan cheque deposit fee, Step III interest deposit loan cheque fee and Step IV interest deposit cheque loan fee.

🧠 Shift, not swap
When an item is brought to a place, the items it jumps over each move one place and keep their relative order. A swap would send the displaced item to the vacated place instead. Check which one the stem says: "shifted" or "interchanged".

Spotting the Rule from Two Steps

In the exam you are shown the input and two steps and must find the rule yourself. Compare each step with the line above and ask: which item moved, to which end, and what is special about it (largest, smallest, first alphabetically, longest, odd, even)? Then test your guess on the second step. A guess that fits only step I is not yet a rule.

Clues that identify the pattern
What you seeLikely rule
One item jumps to the left end each step, results grow from the leftSelection shift (largest or smallest first)
Step I changes the left end, step II the right endAlternating ends
Each step changes the numbers' values but the places stayAn operation on every item
A step reverses the whole lineA reversal step, as in the next section
Even and odd numbers separate to different sidesGrouping rule: evens first, odds last, each group ordered
⚠️ Test the rival rules
Input 27 62 9 40 15 turns into 62 27 9 40 15 (step I) and 62 27 40 15 9 (step II). "Largest first, then largest next, and so on" gives 62 40 27 9 15 at step II, which does not match, so the rule is alternating ends: largest to the left, then smallest to the right. Always check the second step against every rule you are considering.

Working Backwards: Finding the Input

To find the input from a later step, undo the steps in the reverse order, and undo each step by its inverse. Add becomes subtract, multiply becomes divide, a reversal of the line is undone by reversing again. For a line that was only rearranged, the input is not unique unless the stem fixes it, so backward questions use operations.

Example 1. Step I: add 4 to every number. Step II: double every number. The output is 30 18 40. Undo Step II first (halve): 15 9 20. Then undo Step I (subtract 4): 11 5 16. Check forwards: 11 + 4 = 15, ×2 = 30; 5 + 4 = 9, ×2 = 18; 16 + 4 = 20, ×2 = 40.

Example 2, a conditional rule that can be undone. Step I: an odd number is doubled and an even number is increased by 1. Step II: the line is reversed. Output: 21 10 13 14. Undo the reversal: 14 13 10 21. Now undo Step I by the parity of each output: an even output came from doubling an odd number, so halve it (14 → 7, 10 → 5); an odd output came from adding 1 to an even number, so subtract 1 (13 → 12, 21 → 20). The input is 7 12 5 20. Forward check: 7 → 14, 12 → 13, 5 → 10, 20 → 21, reversed 21 10 13 14.

🎯 Why the order of undoing matters
Steps do not commute: add 4 then double is not the same as double then add 4 (for 5 these give 18 and 14). So the last step must be undone first, exactly as you take off a coat before a shirt.

Operation-Based Machines

An operation-based machine changes values. The rule can act on every item, on items at chosen positions, or on items that meet a condition. A step may also be a plain rearrangement, so a full question often mixes both kinds.

Three kinds of operation rule, each traced
RuleInput and stepsResult
Positional: interchange first and last, then add 5 to numbers at even places12 7 20 9 → 9 7 20 12 → 9 12 20 17Then ascending: 9 12 17 20
Conditional: a multiple of 3 is divided by 3, any other number gets 4 added15 22 9 40 18 → 5 26 3 44 6Descending: 44 26 6 5 3
Grouping: evens first ascending, then odds descending, then subtract 2 at odd places23 18 41 6 35 12 → 6 12 18 41 35 23 → 4 12 16 41 33 23Sum of last three: 97
⚠️ Places versus values
"Places" are counted from the left unless the stem says otherwise, and they refer to the line at that moment. After a rearrangement the number at place 2 is a different number. In the grouping row, the places for the subtraction are 1, 3 and 5 of the new line, which hold 6, 18 and 35, not the original numbers.

In a mixed word-number machine the rules name the type. Input tax 47 bond 15 draft 62. Step I: the smallest number goes to the left end. Step II: the word that comes last in the dictionary goes to the right end. Step III: the largest number goes to place 2 from the left. The lines are: Step I 15 tax 47 bond draft 62; Step II 15 47 bond draft 62 tax (tax is last alphabetically); Step III 15 62 47 bond draft tax.

Alphanumeric and Letter-Shift Machines

Some machines work on letters through their positions: A = 1, B = 2, … Z = 26. Two facts are worth memorising. The letter and its mirror letter (A and Z, B and Y) add up to 27. Shifting past Z wraps to A, so with a shift of 2, Y becomes A and Z becomes B.

Example 1, letter sum. Step I: replace each letter of DRAFT by its position and add them: 4 + 18 + 1 + 6 + 20 = 49. Step II: reverse the digits: 94.

Example 2, shift then reverse. Step I: move every letter 2 places forward in the alphabet. Step II: reverse the order of letters. Input LOAN: L → N, O → Q, A → C, N → P, so Step I is NQCP and Step II is PCQN. A trap is to stop at Step I, or to shift backwards (giving JMYL and then LYMJ).

🧠 A quick alphabet anchor
Remember E = 5, J = 10, O = 15, T = 20, Y = 25. Any letter is at most two steps from an anchor, so you never count from A.

Speed Method and Step Counts

A machine set with a six-item line usually carries four to five questions, so the work done once is reused. Trace the whole machine to its last step on rough paper, then answer every question from that column. Do not trace separately for each question.

Step-count facts for distinct items
FactStatement
Maximum steps, selection shift or alternating ends, n itemsn − 1
After step k, selection shiftThe k smallest (or largest) items stand at places 1 to k in order
Which step finally places a given item (alternating ends)Rank the item: the step number is its place in the order largest, smallest, second largest, second smallest, …

Worked example. For input 14 63 27 8 41 36 under alternating ends, the lines are 63 14 27 8 41 36; 63 14 27 41 36 8; 63 41 14 27 36 8; 63 41 27 36 14 8; 63 41 36 27 14 8. The last line is the sorted descending order, reached at step V, so n − 1 = 5 steps. The number 36 reaches its final place 3 only in step V, because at step IV it stood at place 4.

⚠️ Four slips that cost marks
(1) Counting places from the wrong end.
(2) Answering for the step before or after the one asked.
(3) Forgetting that the lines are cumulative, so each step starts from the previous output, not from the input.
(4) Applying an operation to the input values after a rearrangement instead of to the new line.

Key takeaways

  • Read the rule, number the places from the left, and write each step as a new line built from the line above.
  • Selection shift and alternating ends need at most n − 1 steps; the items jumped over keep their order.
  • Identify an unknown rule from two steps and test it on the second step against every rival rule.
  • To find the input, undo the steps from the last to the first, each by its inverse; use parity of the output for conditional rules.
  • Positions in an operation rule refer to the line at that step, not to the input.
  • In letter machines A = 1 to Z = 26, mirror letters sum to 27, and a shift wraps from Z to A.

Practice questions (17)

Attempt each one before opening the answer. Every explanation names the tempting wrong option as well as the right one, because that is where marks are lost.

  1. A machine rearranges a line of numbers in steps. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. Input: 52 17 38 9 24. What is Step III?

    1. 9 17 52 38 24
    2. 9 17 24 38 52
    3. 9 17 24 52 38
    4. 9 24 17 52 38
    Show answer

    Answer: C — 9 17 24 52 38

    Step I: 9 52 17 38 24. Step II: 9 17 52 38 24. Step III brings 24 to place 3: 9 17 24 52 38. The line 9 17 24 38 52 is Step IV, where 38 is placed; stopping one step late is the tempting error.
  2. A machine works in steps on a line of numbers. Step I: the largest number goes to the left end. Step II: the smallest number goes to the right end. Step III: the second largest goes to place 2 from the left. Step IV: the second smallest goes to place 2 from the right. Step V: the third largest goes to place 3 from the left. The other numbers shift but keep their order. Input: 14 63 27 8 41 36. What is Step IV?

    1. 63 41 14 27 36 8
    2. 63 41 36 27 14 8
    3. 63 41 27 14 36 8
    4. 63 41 27 36 14 8
    Show answer

    Answer: D — 63 41 27 36 14 8

    Step I: 63 14 27 8 41 36. Step II: 63 14 27 41 36 8. Step III: 63 41 14 27 36 8. Step IV sends 14, the second smallest, to place 2 from the right: 63 41 27 36 14 8. The line 63 41 14 27 36 8 is Step III and 63 41 36 27 14 8 is Step V.
  3. A machine works on words by their number of letters. Step I: the longest word goes to the left end. Step II: the shortest word goes to the right end. Step III: the second longest goes to place 2 from the left. The other words shift but keep their order. Input: loan fee interest cheque deposit. What is Step III?

    1. interest loan cheque deposit fee
    2. interest deposit loan cheque fee
    3. interest deposit cheque loan fee
    4. interest deposit fee loan cheque
    Show answer

    Answer: B — interest deposit loan cheque fee

    Lengths: interest 8, deposit 7, cheque 6, loan 4, fee 3. Step I: interest loan fee cheque deposit. Step II: interest loan cheque deposit fee. Step III moves deposit to place 2: interest deposit loan cheque fee. The line interest deposit cheque loan fee is Step IV.
  4. A machine arranges numbers in steps. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. The machine stops as soon as the numbers are in ascending order. Input: 61 18 45 27 72. In how many steps does it stop?

    1. 4
    2. 5
    3. 3
    4. 2
    Show answer

    Answer: C — 3

    Step I: 18 61 45 27 72. Step II: 18 27 61 45 72. Step III: 18 27 45 61 72, which is ascending, so the machine stops after 3 steps. The answer 4 comes from counting n − 1 for five numbers, but 72 is already in place and the stop rule ends the run earlier.
  5. A machine works in two steps on a line of numbers. Step I: an odd number is doubled and an even number is increased by 1. Step II: the order of the line is reversed. The output is 21 10 13 14. What was the input?

    1. 7 12 5 20
    2. 20 5 12 7
    3. 14 13 10 21
    4. 7 12 5 21
    Show answer

    Answer: A — 7 12 5 20

    Undo the reversal: 14 13 10 21. Then undo Step I by parity: even 14 came from odd 7, odd 13 from even 12, even 10 from odd 5, odd 21 from even 20. The input is 7 12 5 20. The line 14 13 10 21 is the result after Step I, and 20 5 12 7 comes from forgetting that the order matters.
  6. A machine works in two steps on three numbers. Step I: 4 is added to every number. Step II: every number is doubled. The output is 30 18 40. What was the input?

    1. 13 7 18
    2. 11 5 16
    3. 26 14 36
    4. 15 9 20
    Show answer

    Answer: B — 11 5 16

    Undo the last step first: halve to get 15 9 20; then undo Step I by subtracting 4 to get 11 5 16. Forward check: (11 + 4) × 2 = 30, (5 + 4) × 2 = 18, (16 + 4) × 2 = 40. The line 13 7 18 comes from subtracting 4 before halving, which undoes the steps in the wrong order.
  7. A machine works in three steps on numbers. Step I: the first and last numbers are interchanged. Step II: every number at an even place from the left is increased by 5. Step III: the numbers are arranged in ascending order. Input: 12 7 20 9. What is the second number from the right in Step III?

    1. 12
    2. 20
    3. 14
    4. 17
    Show answer

    Answer: D — 17

    Step I: 9 7 20 12. Step II adds 5 to places 2 and 4: 9 12 20 17. Step III: 9 12 17 20. The second number from the right is 17. The answer 20 is the first from the right, and 14 would result if places were counted from the right in Step II (9 7 20 12 becomes 14 7 25 12, then 7 12 14 25).
  8. A machine works in two steps on numbers. Step I: a multiple of 3 is divided by 3, and every other number has 4 added to it. Step II: the numbers are arranged in descending order. Input: 15 22 9 40 18. What is the sum of the first and fourth numbers of Step II?

    1. 49
    2. 29
    3. 47
    4. 52
    Show answer

    Answer: A — 49

    Step I: 15 → 5, 22 → 26, 9 → 3, 40 → 44, 18 → 6, giving 5 26 3 44 6. Step II in descending order: 44 26 6 5 3. The first and fourth numbers are 44 and 5, so the sum is 49. The value 29 results from reading the line in ascending order (3 and 26).
  9. A machine arranges a line of distinct numbers. In each step the smallest number not yet placed is brought to the next place from the left, and the others shift right keeping their order. Which of the following is NOT true for a line of 6 distinct numbers?

    1. At most 5 steps are needed to reach ascending order
    2. After step 3 the three smallest numbers stand at places 1 to 3 in ascending order
    3. The numbers are always in ascending order only after 6 steps
    4. The numbers that are jumped over in a step keep their relative order
    Show answer

    Answer: C — The numbers are always in ascending order only after 6 steps

    The maximum is n − 1 = 5 steps, because when 5 places are correct the sixth is forced. So the claim of exactly 6 steps is false (an input that is already sorted needs none). The other three statements are properties of the shift rule.
  10. A machine works on a mixed line. Step I: the smallest number goes to the left end. Step II: the word that comes last in dictionary order goes to the right end. Step III: the largest number goes to place 2 from the left. Other items shift but keep their order. Input: tax 47 bond 15 draft 62. What is Step III?

    1. 15 47 62 bond draft tax
    2. 15 62 47 bond draft tax
    3. 15 62 47 tax bond draft
    4. 15 tax 62 47 bond draft
    Show answer

    Answer: B — 15 62 47 bond draft tax

    Step I: 15 tax 47 bond draft 62. Step II: tax is last alphabetically (t after d and b), so 15 47 bond draft 62 tax. Step III puts 62 at place 2: 15 62 47 bond draft tax. Leaving 62 where Step II had it, or sending tax to the end before moving the number, gives the other lines.
  11. Input 34 71 18 52 9 63 is changed by a machine. Step I gives 71 34 18 52 9 63 and Step II gives 71 34 18 52 63 9. The machine follows one fixed rule in which the third step brings the second largest number to place 2 from the left, the fourth step sends the second smallest to place 2 from the right, and so on in the same pattern. What is Step III?

    1. 71 63 52 34 18 9
    2. 71 34 63 18 52 9
    3. 71 63 34 52 18 9
    4. 71 63 34 18 52 9
    Show answer

    Answer: D — 71 63 34 18 52 9

    The second largest is 63. Bringing it to place 2 from 71 34 18 52 63 9 shifts the numbers it jumps over and gives 71 63 34 18 52 9. The line 71 63 52 34 18 9 is the final sorted line, tempting but not yet reached, and 71 63 34 52 18 9 is Step IV.
  12. Input 27 62 9 40 15 becomes 62 27 9 40 15 in Step I and 62 27 40 15 9 in Step II. Which rule produced these two steps?

    1. Each step brings the next largest number to the next place from the left
    2. Largest to the left end, then smallest to the right end, rest unchanged
    3. Each step brings the next smallest number to the next place from the left
    4. Each step reverses the order of the whole line
    Show answer

    Answer: B — Largest to the left end, then smallest to the right end, rest unchanged

    Step I moves 62 to the left end and Step II moves 9 to the right end, which is the alternating-ends rule. The next-largest rule would give 62 40 27 9 15 at Step II, which does not match, and the other two rules fail at Step I.
  13. A machine works on a word in two steps. Step I: every letter is moved 2 places forward in the English alphabet. Step II: the order of the letters is reversed. Input: LOAN. What is the output of Step II?

    1. NQCP
    2. LYMJ
    3. PCQN
    4. PQCN
    Show answer

    Answer: C — PCQN

    Step I: L → N, O → Q, A → C, N → P gives NQCP. Reversing gives PCQN. The line NQCP is only Step I, and LYMJ results from moving the letters backwards instead of forwards.
  14. A machine works on a word in two steps. Step I: each letter is replaced by its position in the English alphabet (A = 1 to Z = 26) and the positions are added. Step II: the digits of the sum are written in reverse order. Input: DRAFT. What is the output of Step II?

    1. 94
    2. 49
    3. 13
    4. 76
    Show answer

    Answer: A — 94

    D = 4, R = 18, A = 1, F = 6, T = 20 add up to 49 in Step I. Reversing the digits gives 94 in Step II. The value 49 is the Step I result and 13 is the digit sum, a different operation.
  15. A machine works in two steps. Step I: the even numbers are placed first in ascending order, followed by the odd numbers in descending order. Step II: every number at an odd place from the left is decreased by 2. Input: 23 18 41 6 35 12. What is the sum of the last three numbers of Step II?

    1. 99
    2. 95
    3. 97
    4. 93
    Show answer

    Answer: C — 97

    Step I: 6 12 18 41 35 23. Step II reduces places 1, 3 and 5 (6, 18, 35) by 2: 4 12 16 41 33 23. The last three are 41, 33 and 23, which add up to 97. The value 99 is the sum before Step II is applied.
  16. A machine works on a line of numbers. Step I: the largest goes to the left end. Step II: the smallest goes to the right end. Step III: the second largest goes to place 2 from the left. Step IV: the second smallest goes to place 2 from the right. Step V: the third largest goes to place 3 from the left. Other numbers shift but keep their order. Input: 14 63 27 8 41 36. In which step does 36 reach the place it holds in the final line?

    1. Step III
    2. Step IV
    3. Step II
    4. Step V
    Show answer

    Answer: D — Step V

    The lines are 63 14 27 8 41 36; 63 14 27 41 36 8; 63 41 14 27 36 8; 63 41 27 36 14 8; 63 41 36 27 14 8. The final line is 63 41 36 27 14 8, so 36 belongs at place 3. It stands at place 5 in Step II, place 5 in Step III and place 4 in Step IV, and reaches place 3 only in Step V.
  17. In a machine, one step adds 3 to each number of a line. Consider these statements. P: the step can be undone by subtracting 3 from each number. Q: it can be undone by dividing each number by 3. R: if it is followed by doubling, the pair is undone by halving first and then subtracting 3. S: if it is followed by doubling, the pair is undone by subtracting 3 first and then halving. Which statements are correct?

    1. P and S only
    2. P and R only
    3. Q and R only
    4. Q and S only
    Show answer

    Answer: B — P and R only

    Adding 3 is undone by subtracting 3, so P is right and Q is wrong. For add-3-then-double, the last step (doubling) must be undone first by halving, then 3 is subtracted, so R is right. Statement S reverses the correct order: for input 5, the output is 16, halving gives 8 and subtracting 3 gives 5, whereas subtracting first gives 13 and halving gives 6.5.