Machine Input-Output: Mixed Word and Number Arrangements
Bank-style input-output questions feed a line of mixed words and numbers into a machine that rearranges it step by step. In each step one word, one number, or one of each moves to a fixed place, and you must find a given step, the number of steps, or an element's position. With a clean method, these sets become quick marks rather than a time trap.
Asked in: GAT, HAT, NTS, ISSB, SSC CGL, IBPS PO, CAT
Read the rule as three parts
Every rule says what is picked (smallest number, word first in dictionary order, longest word, largest digit sum), where it goes (left end, right end, just after the elements already placed), and how often (one per step, or one word and one number per step).
Write the order of picking before you start. For example, list the words alphabetically and the numbers from largest to smallest; then Step k simply places the k-th item of each list.
Build each step from the previous one
Copy the arranged part, then copy the rest of the line in its old order after removing the moved elements. Never re-sort the unarranged part; the rule says all other elements keep their order.
When elements are placed at both ends, the words grow from the left and the numbers grow from the right, so the middle shrinks by two each step.
Counting the steps
The machine stops when the line is completely arranged. With one element placed per step, the last element is automatically in place, so n elements usually need n − 1 steps.
If some element is already in its final place before its turn, that turn changes nothing and is not counted. Always check whether the line is already complete before writing another step.
- Usual steps, one element per step = number of elements − 1
- Usual steps, one word and one number per step = larger of (words, numbers), minus 1 if the last pair falls into place by itself
Starting from a middle step
If a question gives Step 3 of a new input, the first three picks are already in place. Work out which elements those are, then apply the rule only to the rest.
You cannot work backwards to a unique input, because the unarranged part could have come from many different lines. Exams therefore only ask forward questions.
Keys other than dictionary order
Some machines sort words by length or by the letters they contain, and numbers by sum of digits, number of factors or being odd or even. Compute the key for every element first and write it next to the element.
Check for ties before you begin. A well-made question never has two elements with the same key.
Solved examples
- A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: lamp 52 vase 17 crown 86 orange 40. Write all the steps.
- Picking order: words crown, lamp, orange, vase; numbers 86, 52, 40, 17.
- Step 1: crown lamp 52 vase 17 orange 40 86.
- Step 2: crown lamp vase 17 orange 40 52 86.
- Step 3: crown lamp orange vase 17 40 52 86.
- After Step 3 only vase and 17 are left, and they are already in place, so the machine stops.
Answer: 3 steps; last step: crown lamp orange vase 17 40 52 86 - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: apple 59 kite 71 ink 24 bottle 38. How many steps are needed, and what is the last step?
- Numbers smallest first: 24, 38, 59, 71. Words latest in dictionary order first: kite, ink, bottle, apple.
- Placing order: 24, kite, 38, ink, 59, bottle, 71, apple.
- Step 1: 24 apple 59 kite 71 ink bottle 38.
- Step 2: 24 kite apple 59 71 ink bottle 38.
- Step 3: 24 kite 38 apple 59 71 ink bottle.
- Step 4: 24 kite 38 ink apple 59 71 bottle.
- Step 5: 24 kite 38 ink 59 apple 71 bottle.
- Step 6: 24 kite 38 ink 59 bottle apple 71.
- Step 7: 24 kite 38 ink 59 bottle 71 apple.
- Once seven elements are placed, apple is automatically last, so no Step 8 is needed.
Answer: 7 steps; last step: 24 kite 38 ink 59 bottle 71 apple - A machine works as follows. In each step, the longest word not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the number with the largest sum of digits not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: window 62 sun 18 basketball 43 milk 95. Find Step 2 and the number of steps.
- Word lengths: basketball 10, window 6, milk 4, sun 3.
- Digit sums: 95 gives 14, 18 gives 9, 62 gives 8, 43 gives 7.
- Picking order: basketball with 95, window with 18, milk with 62, sun with 43.
- Step 1: basketball window 62 sun 18 43 milk 95.
- Step 2: basketball window 62 sun 43 milk 18 95.
- Step 3: basketball window milk sun 43 62 18 95.
- After Step 3, sun and 43 are already in place, so the arrangement is complete.
Answer: Step 2: basketball window 62 sun 43 milk 18 95; 3 steps in all - A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. For a new input, Step 2 is: bat cat 29 rose 64 dog 12 owl 87 95. What is Step 4?
- In Step 2, bat and cat are placed at the left and 87 and 95 at the right.
- Remaining words in order: dog, owl, rose. Remaining numbers, largest first: 64, 29, 12.
- Step 3: bat cat dog 29 rose 12 owl 64 87 95.
- Step 4: bat cat dog owl rose 12 29 64 87 95.
- This line is complete, so Step 4 is also the last step.
Answer: bat cat dog owl rose 12 29 64 87 95 - Using the steps of the previous alternating machine (Input: apple 59 kite 71 ink 24 bottle 38), in Step 4 which element is fourth from the right, and how many elements are between kite and apple?
- Step 4 is 24 kite 38 ink apple 59 71 bottle.
- From the right: bottle, 71, 59, apple. So apple is fourth from the right.
- Kite is second from the left and apple is fifth, so 38 and ink lie between them: 2 elements.
Answer: apple; 2 elements - A machine gives this illustration. Input: mat 33 bus 70 rope 15 egg 58. Step 1: bus mat 33 rope 15 egg 58 70. Step 2: bus egg mat 33 rope 15 58 70. Step 3: bus egg mat rope 15 33 58 70. Find the rule.
- Step 1 brings bus to the extreme left and 70 to the extreme right.
- Step 2 adds egg after bus and 58 before 70; Step 3 adds mat and 33.
- Words are being placed in dictionary order from the left and numbers from the largest, growing inward from the right; other elements keep their order.
Answer: Each step: next word in dictionary order to the left block, next largest number to the right block
Exam shortcuts
- Before Step 1, write the full picking order, such as apple, dream, kite and 82, 63, 47. Every later step is then mechanical.
- Position questions: count from the stated end only, and remember that the first element is first from the left, not zero.
- For a which-step question, count how many elements are already arranged at the ends; that number tells you the step.
- If two steps look identical, the later one is not counted. The machine stops at the first complete line.
- In mixed rules, keep words and numbers in two separate lists so you never compare a word with a number.
Common mistakes
- Re-sorting the unarranged middle part instead of keeping its original order.
- Counting a final step that changes nothing.
- Placing a new element at the extreme end instead of just inside the elements already arranged.
- Mixing dictionary order with word length when the rule changes between machines.
- Reading the position from the wrong end of the line.
Practice MCQs
- A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: tiger 47 apple 82 mango 15 kite 63 dream 29. How many steps are needed to complete the arrangement?
A) 5
B) 3
C) 6
D) 4
Answer: D) 4 — Step 1 places apple and 82, Step 2 dream and 63, Step 3 kite and 47, and Step 4 mango and 29. After Step 4 the line is apple dream kite mango tiger 15 29 47 63 82, which is already complete, so the machine stops. 5 would count a step that changes nothing, and 3 or 6 miscount the moves. - A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: tiger 47 apple 82 mango 15 kite 63 dream 29. Which of the following is Step 2?
A) apple dream kite tiger mango 15 29 47 63 82
B) apple dream tiger 47 mango 15 kite 29 63 82
C) apple dream tiger 47 mango 15 kite 63 29 82
D) dream apple tiger 47 mango 15 kite 29 63 82
Answer: B) apple dream tiger 47 mango 15 kite 29 63 82 — Step 1: apple tiger 47 mango 15 kite 63 dream 29 82. Step 2 moves dream next to apple and 63 next to 82: apple dream tiger 47 mango 15 kite 29 63 82. The line with kite and 47 already placed is Step 3; the line ending 63 29 82 leaves 63 unplaced; and dream cannot come before apple. - A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: tiger 47 apple 82 mango 15 kite 63 dream 29. In Step 3, which element is fifth from the left?
A) mango
B) tiger
C) kite
D) 15
Answer: A) mango — Step 3 is apple dream kite tiger mango 15 29 47 63 82. Counting from the left: apple, dream, kite, tiger, mango, so mango is fifth. Kite is third, tiger is fourth and 15 is sixth. - A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: 25 green night candle window 18 91 field 72 57 bank 36 44 ocean. In Step 4, which element is seventh from the left?
A) night
B) 25
C) window
D) 18
Answer: C) window — Step 1: bank 25 green night candle window 18 field 72 57 36 44 ocean 91. Step 2: bank candle 25 green night window 18 field 57 36 44 ocean 72 91. Step 3: bank candle field 25 green night window 18 36 44 ocean 57 72 91. Step 4: bank candle field green 25 night window 18 36 ocean 44 57 72 91. The seventh element in Step 4 is window. Night is sixth, 25 is fifth and 18 is eighth. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: bread 13 river 64 cloud 76 sugar 58 plant 31. How many steps are needed to complete the arrangement?
A) 10
B) 8
C) 9
D) 5
Answer: C) 9 — There are 10 elements, placed one per step in the order 13, sugar, 31, river, 58, plant, 64, cloud, 76, bread. No element is already in its final place early on, so 9 steps are needed; once nine are placed, the tenth (bread) is automatically last. 10 counts that free placement as a step, 8 stops one short, and 5 treats each step as placing a pair. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: bread 13 river 64 cloud 76 sugar 58 plant 31. Which of the following is Step 4?
A) 13 sugar 31 river bread 64 cloud 76 58 plant
B) 13 sugar 31 river 58 bread 64 cloud 76 plant
C) 13 sugar 31 bread river 64 cloud 76 58 plant
D) 13 river 31 sugar bread 64 cloud 76 58 plant
Answer: A) 13 sugar 31 river bread 64 cloud 76 58 plant — Step 1 brings 13 to the front, Step 2 places sugar (last in dictionary order), Step 3 places 31 and Step 4 places river, giving 13 sugar 31 river bread 64 cloud 76 58 plant. The line with 58 already placed is Step 5, the line with bread before river is Step 3, and river cannot come before sugar because sugar is later in dictionary order. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: bread 13 river 64 cloud 76 sugar 58 plant 31. In Step 6, how many elements are there between river and cloud?
A) 3
B) 5
C) 2
D) 4
Answer: D) 4 — Step 6 is 13 sugar 31 river 58 plant bread 64 cloud 76. Between river and cloud stand 58, plant, bread and 64, which is 4 elements. 3 and 5 miscount the run, and 2 would be true only if bread and 64 were already placed elsewhere. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: bread 13 river 64 cloud 76 sugar 58 plant 31. In which step does the line read: 13 sugar 31 river 58 bread 64 cloud 76 plant?
A) Step 4
B) Step 5
C) Step 6
D) Step 7
Answer: B) Step 5 — The arranged part at the left is 13 sugar 31 river 58, which is five elements, so five steps have been done. Step 4 has only four elements fixed (58 not yet placed), Step 6 would also have plant after 58, and Step 7 would have 64 next. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. Input: bread 13 river 64 cloud 76 sugar 58 plant 31. In the last step, which element is third from the right end?
A) 64
B) 76
C) plant
D) cloud
Answer: D) cloud — The last step is 13 sugar 31 river 58 plant 64 cloud 76 bread. From the right: bread, 76, cloud, so cloud is third. 76 is second from the right, 64 is fourth and plant is fifth. - A machine works as follows. In each step, the longest word not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the number with the largest sum of digits not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: 97 pen 34 elephant 51 desk 85 garden 26 butterfly. Which of the following is Step 2?
A) butterfly elephant pen 34 51 desk garden 26 85 97
B) butterfly elephant garden pen 34 51 desk 26 85 97
C) butterfly elephant pen 34 51 desk garden 26 97 85
D) butterfly elephant pen 34 51 desk 85 garden 26 97
Answer: A) butterfly elephant pen 34 51 desk garden 26 85 97 — Word lengths: butterfly 9, elephant 8, garden 6, desk 4, pen 3. Digit sums: 97 gives 16, 85 gives 13, 26 gives 8, 34 gives 7, 51 gives 6. Step 1 places butterfly and 97; Step 2 places elephant and 85 (just left of 97): butterfly elephant pen 34 51 desk garden 26 85 97. The line with garden placed is Step 3, 97 must stay at the extreme right, and the line with 85 still in the middle has not moved it. - A machine works as follows. In each step, the longest word not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the number with the largest sum of digits not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: 97 pen 34 elephant 51 desk 85 garden 26 butterfly. In the final arrangement, which element is immediately to the right of pen?
A) 34
B) 51
C) 26
D) 97
Answer: B) 51 — The final line is butterfly elephant garden desk pen 51 34 26 85 97. The numbers sit with the smallest digit sum nearest the words: 51 (sum 6), 34 (7), 26 (8), 85 (13), 97 (16). So 51 is right after pen. 34 and 26 come later, and 97 is at the extreme right. - A machine works as follows. In each step, the longest word not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the number with the largest sum of digits not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: 97 pen 34 elephant 51 desk 85 garden 26 butterfly. In Step 3, how many elements are between garden and 85?
A) 4
B) 6
C) 5
D) 3
Answer: C) 5 — Step 3 is butterfly elephant garden pen 34 51 desk 26 85 97. Between garden and 85 are pen, 34, 51, desk and 26, which is 5 elements. 4 and 6 miscount, and 3 counts only the numbers. - A word and number arrangement machine works as follows. In each step, the word that comes earliest in dictionary order among the words not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the largest number not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. For a different input, Step 2 is: apple bank 39 mirror 15 lemon 52 tulip garden 61 84 96. Which of the following will be Step 4?
A) apple bank garden lemon 39 mirror 15 tulip 52 61 84 96
B) apple bank garden lemon mirror 15 tulip 39 52 61 84 96
C) apple bank garden 39 mirror 15 lemon 52 tulip 61 84 96
D) apple bank garden lemon mirror tulip 15 39 52 61 84 96
Answer: A) apple bank garden lemon 39 mirror 15 tulip 52 61 84 96 — Step 3 places garden after bank and 61 before 84 (already there): apple bank garden 39 mirror 15 lemon 52 tulip 61 84 96. Step 4 places lemon and 52: apple bank garden lemon 39 mirror 15 tulip 52 61 84 96. The line with mirror and 39 placed is Step 5, the line with lemon still unplaced is Step 3, and the line with tulip placed is the final arrangement, Step 6. - A machine arranges a line of words and numbers one element per step, building the arranged part from the left. In odd-numbered steps (1, 3, 5 and so on) the smallest number not yet arranged is placed just to the right of the elements already arranged (in Step 1, at the extreme left). In even-numbered steps the word that comes last in dictionary order among the words not yet arranged is placed just to the right of the elements already arranged. All other elements keep their order, and the machine stops when the arrangement is complete. For a different input, Step 3 is: 19 water 27 cup mango 45 63 lion table 81 house. In Step 6, which element will be sixth from the left?
A) cup
B) 63
C) lion
D) mango
Answer: D) mango — Step 4 places table (last in dictionary order among cup, mango, lion, table and house): 19 water 27 table cup mango 45 63 lion 81 house. Step 5 places 45: 19 water 27 table 45 cup mango 63 lion 81 house. Step 6 places mango: 19 water 27 table 45 mango cup 63 lion 81 house. Sixth from the left is mango. Cup is seventh, 63 eighth, and lion is not placed until Step 8. - A machine works as follows. In each step, the longest word not yet arranged is placed just to the right of the words already arranged at the left end (in Step 1, at the extreme left), and the number with the largest sum of digits not yet arranged is placed just to the left of the numbers already arranged at the right end (in Step 1, at the extreme right). All other elements keep their order, and the machine stops when the arrangement is complete. Input: 45 61 hat tablet 19 80 77 33 computer river rain. How many steps are needed to complete the arrangement?
A) 6
B) 5
C) 4
D) 3
Answer: B) 5 — Words by length: computer 8, tablet 6, river 5, rain 4, hat 3. Numbers by digit sum: 77 (14), 19 (10), 45 (9), 80 (8), 61 (7), 33 (6). Each step places one word and one number, and none of them is already in its final place early. After Step 5 all words are placed and five numbers are fixed, so the last number, 33, is automatically in place: computer tablet river rain hat 33 61 80 45 19 77. 6 counts an empty step, and 4 or 3 stop before hat is placed.
Questions
What does just to the right of the elements already arranged mean?
The arranged block grows inward. In Step 1 the element goes to the extreme left; in Step 2 the next one goes second, right after the first, and so on.
Can I find the input from a later step?
Not uniquely. Many different inputs lead to the same later step, so exams ask only about later steps or about counts and positions.
How do I save time in a set of five questions on one machine?
Write all the steps once, neatly, and answer every question from that table instead of recomputing for each question.