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: 63 anchor 81 birch 27 cedar 49 dogwood 18.
In the last step of the above arrangement, which element is fourth from the left end?

Competition practiceInput-Output
  • A63
  • Banchor
  • Cbirch
  • D27

Step-by-Step Solution

Only 81 and 49 are perfect squares here; 63, 27 and 18 are not, so the machine makes just two shifts. Step 1: 49 63 anchor 81 birch 27 cedar dogwood 18. Step 2 (last): 81 49 63 anchor birch 27 cedar dogwood 18. Counting from the left: 81, 49, 63, anchor — so anchor is fourth. Stopping a place short gives 63, going a place past gives birch, and counting from the right end instead gives 27.
Answer: B) anchor

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,…