Skip to content

Input and Output

Machine input rearranged step by step, and finding the rule. Open a topic to read its notes and practise it, then take the mixed tests: each question shows whether you were right and why, as soon as you answer.

Topics: notes and practice

Reading the step pattern15 questions

A machine changes a line of words, numbers or both by one fixed rule in each step. The question gives the input and the first one or two steps. You find the rule from them and use it to write a later step or answer a question about a step.

The questions after the steps are of five kinds: write out a step in full; name the element at a place; count the elements in the same place in two steps; add the numbers at two places; find the step in which an element first reaches a place.

Nearly every machine uses one rule from this table, or two together, in every step or in alternate steps.

Rule What happens in each step
Selection The smallest, largest, alphabetically first or last element of the unarranged part goes to the left or right end, next to those placed
Shifting The first or last element, or a fixed number of elements, moves to the other end
Arithmetic Numbers change by a fixed amount, or become a digit sum or product
Reversal, interchange The line is written backwards, or neighbouring pairs swap
Alternating, mixed Two rules in turn, or one rule for words and one for numbers

The unarranged part is the part no earlier step has fixed. Elements already placed at an end do not move again.

The method:

  1. Write the input and each step in a column, elements lined up.
  2. Compare the input with Step I. See which elements moved and whether numbers changed.
  3. Compare Step I with Step II. The same move again gives the rule. A different move means the rule alternates, so check Step III.
  4. Test the rule on the last step shown, then write out every step up to the one asked.

A rule seen once is a guess. The same elements appear in every step unless arithmetic changes the numbers, and a fixed addition or subtraction repeated n times has n times the effect.

Problem 1. Input: 18 40 27 35. Step I: 21 43 30 38. What is Step III? (a) 24 46 33 41 (b) 27 49 36 44 (c) 30 52 39 47 (d) 21 43 30 38

Answer: (b) 27 49 36 44

Each number in Step I is 3 more than in the input, so 3 is added in every step. After three steps the change is 3 × 3 = 9: 27, 49, 36, 44. Option (c) is Step IV.

Problem 2. Input: tent bell rope arch. Step I: arch tent bell rope. Step II: arch bell tent rope. What is Step III?

Answer: arch bell rope tent

Step I moved arch, the alphabetically first word, to the left end. Step II moved bell, the first of the rest, beside it. Of tent and rope, rope comes first, since r comes before t. Step III: arch bell rope tent.

Problem 3. Input: 45 12 78 21 60 33. Step I: 78 45 12 21 60 33. Step II: 78 45 21 60 33 12. Step III: 78 60 45 21 33 12. Which number is third from the right end in Step IV? (a) 21 (b) 33 (c) 45 (d) 60

Answer: (b) 33

The steps alternate: the largest remaining number goes to the left end, then the smallest remaining goes to the right end. Step III moved 60 left, so Step IV sends the smallest of 45 21 33, which is 21, to the right end of the unarranged part, next to 12. Step IV: 78 60 45 33 21 12. From the right: 12, 21, 33.

Practise this topic15 questions, each with its solution

Shifting machines15 questions

A shifting machine moves elements to one side without arranging them by size. The usual rules are:

  • The first element goes to the right end each step, so the line turns one place left.
  • The last element goes to the left end each step.
  • The first two or last two elements move together, keeping their order.
  • The element in a named place, such as the second, goes to an end.
  • Elements of one kind move: the first number to the right end, the last word to the left end, or all the words to one side in a single step.
  • Two rules in turn, such as first element to the right end in odd steps and last element to the left end in even steps.

When one element leaves its place, the others close up. In a mixed line, "the first number" means the left-most number, whatever words stand before it.

Shifting repeats. A line of n elements turned one place per step is back to the input after n steps. Turned two places per step in a line of six, it returns after three steps, and moving the third element to the front repeats after three steps. For a far step such as Step VII, find the length of the repeat, divide, and use the remainder. Two opposite rules in alternate steps, first to the end then last to the front, undo each other, so every even step equals the input.

In a circular shift of k places per step, an element's place changes by k each step: it falls by k for a left turn and rises by k for a right turn, with n added or taken off when it passes the end of the line. This fails when elements move by kind or size, so write those steps out.

Problem 4. Input: 6 19 33 8 25. In each step the first number goes to the right end. What is Step II?

Answer: 33 8 25 6 19

Step I sends 6 to the end: 19 33 8 25 6. Step II sends 19 to the end: 33 8 25 6 19.

Problem 5. Input: pin 31 hat 18 mug 45. In each step the right-most number goes to the left end of the line. What is Step II?

Answer: 18 45 pin 31 hat mug

Step I: 45 goes to the front: 45 pin 31 hat 18 mug. In that line the right-most number is 18, even though mug stands after it, since mug is a word. Step II: 18 goes to the front.

Problem 6. Input: 9 hen 14 cow 22 ant. In odd steps the last element goes to the left end. In even steps the first number goes to the right end. What is Step III?

Answer: 9 ant hen 14 cow 22

Step I: ant goes to the front: ant 9 hen 14 cow 22. Step II: the first number, 9, goes to the right end: ant hen 14 cow 22 9. Step III: the last element, 9, goes to the front.

Practise this topic15 questions, each with its solution

Arranging machines15 questions

An arranging machine puts the line in order one element per step: ascending or descending for numbers, dictionary order for words. Each step fixes one element from the unarranged part next to those already placed. The picks are:

  • Smallest to the left end, or largest to the right end, for ascending order.
  • Largest to the left end, or smallest to the right end, for descending order.
  • Alphabetically first to the left end, or last to the right end, for words.
  • Two picks in one step, such as smallest to the left and largest to the right.
  • Odd steps to one end and even steps to the other.
  • Another measure for words: fewest letters first, most letters first, or the last letter.
  • Neighbour comparison: in each step compare pairs from the left and interchange when the left number is larger, continuing from that point, so each step is one full pass.

Words are compared letter by letter from the left. "Cup" comes before "pen" because c comes before p, and a shorter word comes before a longer word that starts with the same letters, so "plan" comes before "plane". When words tie on number of letters, the question says how to break the tie, usually alphabetical order.

Neighbour comparison carries the larger number along until a larger one stops it. Example: 42 17 35 8 29 51 becomes 17 35 8 29 42 51 in Step I, since 42 passes 17, 35, 8 and 29 and stops before 51. Step II is 17 8 29 35 42 51, since 35 passes 8 and 29 and stops before 42. Other sort keys appear too: even numbers before odd, by digit sum, or words by their vowels or second letter.

After k steps of one pick each, k elements are placed. The machine finishes when another step would change nothing, and a line of n elements needs at most n − 1 steps, fewer if the line falls into order early. Two picks per step need about half as many.

Problem 7. Input: pen cup bag ink map fan. Step I: bag pen cup ink map fan. Step II: bag cup pen ink map fan. What is Step III? (a) bag cup fan pen ink map (b) bag cup fan ink pen map (c) bag cup pen fan ink map (d) bag fan cup pen ink map

Answer: (a) bag cup fan pen ink map

Each step moves the alphabetically first word of the unarranged part to the left end, next to those placed. After Step II, "bag cup" are placed. Of pen ink map fan, the first is fan, which takes the third place.

Problem 8. Input: 64 18 91 37 52 29. Step I: 18 64 91 37 52 29. Step II: 18 29 64 91 37 52. What is the sum of the third and fifth numbers from the left in Step III?

Answer: 128

Each step moves the smallest number of the unarranged part to the left end. After Step II, 18 and 29 are placed. The smallest of 64 91 37 52 is 37. Step III: 18 29 37 64 91 52. The third number is 37 and the fifth is 91, and 37 + 91 = 128.

Problem 9. Input: 52 83 29 71 46 18. Step I: 52 29 71 46 18 83. Step II: 52 29 46 18 71 83. Which number is fourth from the right end in Step III?

Answer: 18

Each step moves the largest number of the unarranged part to the right end. After Step II, 71 and 83 are placed. The largest of 52 29 46 18 is 52, which goes to the fourth place from the right. Step III: 29 46 18 52 71 83. From the right: 83, 71, 52, 18.

Practise this topic15 questions, each with its solution

Arithmetic operation steps15 questions

In an arithmetic machine the numbers change in every step. The changes are:

  • A fixed number is added or subtracted, or the numbers are multiplied or divided.
  • The change applies only to certain places, such as the odd places.
  • Odd steps use one operation and even steps another, for example add 5, then subtract 2.
  • Each number is replaced by the sum of its digits, or the product of its digits.
  • Each number is combined with a neighbour, such as the number on its right.
  • The line is also interchanged or reversed after the arithmetic.

Shortcuts. A change repeated every step is multiplied by the number of steps: adding 3 in each step adds 15 in five steps. For alternating operations, find the net change of a pair of steps and multiply by the number of pairs. A change confined to the odd places never touches the even places. When every number gains k each step and neighbouring pairs swap, the pairs are back in their first places after an even number of steps, each number raised by k per step.

Digit sums and products settle fast. A single digit is its own sum and product, so once every number is a single digit the line stops changing. A product with a zero digit becomes 0 and stays 0.

To find the input from a later step, undo the operations in reverse order, last step first.

Problem 10. Input: 58 74 39. In each step every number is replaced by the sum of its digits. What is Step II?

Answer: 4 2 3

Step I: 5 + 8 = 13, 7 + 4 = 11, 3 + 9 = 12. Step II: 1 + 3 = 4, 1 + 1 = 2, 1 + 2 = 3.

Problem 11. Input: 25 40 17 52. Step I: 29 40 21 52. Step II: 33 40 25 52. What is the sum of the first and the third numbers from the left in Step V?

Answer: 82

In each step the numbers in odd positions (1st and 3rd) rise by 4, and the even positions stay. After five steps the odd-position numbers have gained 5 × 4 = 20. The first is 25 + 20 = 45 and the third is 17 + 20 = 37. The sum is 82.

Problem 12. Input: 24 51 17 38 62 40. Step I: 51 22 38 15 40 60. Step II: 22 49 15 36 60 38. Which number is third from the right end in Step IV?

Answer: 34

To find the rule, compare the input with Step I. Input 24 51 17 38 62 40: subtract 2 from the 1st, 3rd and 5th to get 22 51 15 38 60 40, then interchange pairs to get 51 22 38 15 40 60, which is Step I. Check on Step II: 49 22 36 15 38 60 becomes 22 49 15 36 60 38. The rule fits. So each step subtracts 2 from the odd positions (1st, 3rd, 5th) and then interchanges positions 1 and 2, 3 and 4, 5 and 6. Step III: subtract to get 20 49 13 36 58 38, then interchange to get 49 20 36 13 38 58. Step IV: subtract to get 47 20 34 13 36 58, then interchange to get 20 47 13 34 58 36. From the right: 36, 58, 34.

Practise this topic15 questions, each with its solution

Step number questions15 questions

Some questions ask which step gives a line, or which is the last or second-last step. The answer comes from writing out the steps and watching the pattern.

The last step of a sorting machine is the first step after which the line is fully in order. Another step would change nothing, so it is not counted. One pick per step needs at most n − 1 steps, fewer when the line falls into order early. The second-last step is the one before it.

For "the first time an element reaches a place", write the steps in order and stop at the earliest line that fits. Later steps may also fit, so the first time is what counts.

For shifting machines, use the repeat. A line turned one place per step is back to the input after n steps. A line turned two places per step in a line of eight returns after four.

For arithmetic machines, use an equation. If a number rises by k each step, the steps needed to go from a to b is (b − a) ÷ k. If odd steps add p and even steps subtract q, then after 2m steps the change is m(p − q), and after 2m + 1 steps it is m(p − q) + p. Try odd and even step numbers separately and discard the one that does not give a whole number.

If a step changes nothing while the line is still out of order, the rule has been misread.

The reverse type gives a late step or the final output and asks for the input or the step number. For a shifting or selection machine, undo the moves from the last step back, putting the moved element back in its original place. For example, if the first number goes to the right end each step and Step II is 33 8 25 6 19, undo Step II by moving 19 to the front, then Step I by moving 6 to the front, giving the input 6 19 33 8 25. To state the step number of a given line, count how many elements are already placed: in Problem 13, the line 16 35 58 49 72 has 16 and 35 placed, so it is Step II. For a fully sorted line, the step number is the number of picks that were needed, as in Problem 13.

Problem 13. Input: 58 49 16 35 72. In each step the smallest number of the unarranged part goes to the left end. How many steps are needed to arrange the line? (a) 2 (b) 3 (c) 4 (d) 5

Answer: (b) 3

Step I: 16 58 49 35 72. Step II: 16 35 58 49 72. Step III: 16 35 49 58 72, which is in order. Another step would change nothing. Five numbers could need 4 steps at most, but this line needs 3.

Problem 14. Input: 12 18 25. In each step 7 is added to every number. In which step does the second number become 60?

Answer: Step VI

The second number must rise from 18 to 60, a gain of 42. Each step adds 7, so the number of steps is 42 ÷ 7 = 6.

Problem 15. Input: 50 72 36 29 44 23. In odd steps the smallest number of the unarranged part goes to the left end. In even steps the largest goes to the right end. What is the second-last step?

Answer: 23 29 50 36 44 72

Step I: 23 50 72 36 29 44. Step II: 23 50 36 29 44 72. Step III: 29 goes beside 23: 23 29 50 36 44 72. Step IV: 50 goes to the right of 44: 23 29 36 44 50 72, which is in order. Step IV is the last step, so Step III is second-last.

Practise this topic15 questions, each with its solution

Mixed rules and miscellaneous15 questions

In a mixed line, one rule works on the numbers and another on the words, or the two kinds take turns. Compare each step with the one before to see which group moved or changed. A step may also do both parts together, such as sending the smallest number to the left end and the alphabetically last word to the right end.

Rules for words, besides moving them, include writing each word backwards, moving its first letter to the end, interchanging its first and last letters, or taking the words in reverse order while the numbers stay in their places. A letter rule repeats. Writing a word backwards twice returns it. Moving the first letter to the end returns a three-letter word after three steps and a four-letter word after four.

Rules for numbers include a fixed addition, doubling, halving the even numbers and raising the odd ones by 1, reversing the digits, and replacing a number by its digit sum.

Predicting the output of a new input. The question shows one input with its step, then a second input and asks for a step of that. Find the rule from the first line and apply it to the new elements. Do not copy place numbers: if the demonstration moved the number in the third place, find what kind of number it was, such as the smallest, and look for that kind in the new line.

When a step has two parts, such as "reduce the largest number by 4 and move it to the left end", do both, in the order stated.

Problem 16. In Step I of a machine the smallest number goes to the left end and the alphabetically last word goes to the right end. Input: 73 ram 29 oak 56 ink. What is Step I?

Answer: 29 73 oak 56 ink ram

The smallest number is 29, which goes to the left end: 29 73 ram oak 56 ink. The alphabetically last word is ram, which goes to the right end: 29 73 oak 56 ink ram.

Problem 17. Input: 15 owl 23 sun. In each step every number is doubled and the first letter of every word goes to the end. What is Step II?

Answer: 60 low 92 nsu

Step I: 30 wlo 46 uns. Step II: the numbers become 60 and 92. In wlo the first letter w goes to the end, giving low. In uns the u goes to the end, giving nsu.

Problem 18. Input: stone go morning cup garden lamp. Step I: go stone morning cup garden lamp. Step II: go stone cup garden lamp morning. How many words are in the same position in Step I and Step IV?

Answer: 2

The steps alternate: the word with the fewest letters goes to the left end ("go" in Step I), then the word with the most letters goes to the right end ("morning" in Step II). Step III moves "cup" to the left: go cup stone garden lamp morning. Step IV moves "garden" to the right: go cup stone lamp garden morning. Compared place by place with Step I, only the 1st place (go) and the 5th place (garden) match.

Practise this topic15 questions, each with its solution

Quick revision
  • Compare input with Step I, then Step I with Step II. The same move twice is the rule. A different move means the rule alternates.
  • Placed elements at the ends never move again.
  • Words are compared letter by letter. A shorter word comes before a longer one that starts with the same letters.
  • A sorting machine with one pick per step needs at most n − 1 steps and stops when another step would change nothing.
  • A shift of one place per step repeats after n steps.
  • A change repeated each step is multiplied by the number of steps. For alternating changes, take the net of a pair.
  • Digit sums and products settle at single digits.
  • To find an input, undo the steps from the last to the first.
  • For a new input, find the kind of element the rule moves, not its place number.
Common mistakes
  • Taking the rule from the input and Step I alone. Check it on the next step too, since the rule may alternate.
  • Moving an element to the far end of the whole line instead of next to the elements already placed.
  • Counting places from the wrong end, or forgetting that every word and number takes one place.
  • Sorting words by length or by the last letter when the rule says alphabetical order.
  • Treating a repeated arithmetic change as a single change, or applying an odd-place change to the even places.
  • Skipping steps. Write each step out and read the answer from the last line.

By ICE Academy · Updated 4 Dec 2026 · Found a mistake? Write to info@iceacademy.in

Mixed tests

All 165 questions of this chapter on paper, with the answer key and solutions. Free: the first download asks for your name, phone number and email.

Exams that test this chapter