Practice30Create account

A word-and-number arranging machine rearranges an input line step by step. In each step it shifts the alphabetically-earliest word that is not yet arranged to the left (placing it just after any words already arranged) and shifts the lowest number not yet arranged to the right (just before any numbers already arranged); the other elements keep their relative order. Input: cow 45 bat 12 dog 78 ant 30. Which step is the last step of the arrangement?

Competition practiceInput-Output
  • AStep 2
  • BStep 4
  • CStep 5
  • DStep 3

Step-by-Step Solution

Step 1: ant cow 45 bat dog 78 30 12; Step 2: ant bat cow 45 dog 78 30 12; Step 3: ant bat cow dog 78 45 30 12 — fully arranged, so Step 3 is the last step.
Answer: D) Step 3

Master this topic in 30 minutes a day.

Don't just memorise the answer — build a daily practice habit.

Practice 5 Similar Questions Free →

All Input-Output practice questions

More Input-Output practice

A word-and-number arranging machine rearranges an input line step by step. In each step…A word-and-number arranging machine rearranges an input line step by step. In each step…Statements: No dependable machine is cheap. Some of the machines in this workshop are…A word-and-number arrangement machine rearranges any input line in steps. In each step…A word-and-number arrangement machine rearranges any input line in steps. In each step…