Practice30Create account

A word-and-number arrangement machine, when given an input line of words and numbers, rearranges it in steps. In each step the smallest perfect square among the numbers not already shifted is taken out and placed at the extreme left end of the line. Every other element keeps its relative position. Numbers that are not perfect squares are never shifted, and the machine stops as soon as no perfect square is left to shift.
Input: 48 palm 64 quill 36 ridge 81 stone 27.
How many steps are needed to complete the rearrangement of the above input?

Competition practiceInput-Output
  • A4
  • B5
  • C3
  • D2

Step-by-Step Solution

Of the five numbers only 36, 64 and 81 are perfect squares — 48 is not, and 27 is a perfect cube rather than a square. They are shifted smallest first. Step 1: 36 48 palm 64 quill ridge 81 stone 27. Step 2: 64 36 48 palm quill ridge 81 stone 27. Step 3: 81 64 36 48 palm quill ridge stone 27, after which no square is left and the machine halts. Three steps. Mistaking 27 for a square gives four, and shifting every number regardless gives five.
Answer: C) 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 arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…A word-and-number arrangement machine, when given an input line of words and numbers,…