Practice30Create account

A word-and-number arrangement machine, when given an input line of words and two-digit numbers, rearranges it in steps. In each step the leftmost number having both its digits odd, among those not already shifted, is taken out and placed at the extreme right end of the line. All other numbers, and all the words, are never shifted; every other element keeps its relative position, and the machine stops once no such number is left.
Input: 72 banner 35 lamp 91 tulsi 58 17.
Which of the following is the last step of the above arrangement?

Competition practiceInput-Output
  • A72 banner lamp tulsi 58 17 35 91
  • B72 banner lamp tulsi 58 35 91 17
  • C72 banner lamp tulsi 58 17 91 35
  • D72 banner lamp tulsi 35 91 17 58

Step-by-Step Solution

Numbers with both digits odd are 35, 91 and 17, taken leftmost first. Step 1: 72 banner lamp 91 tulsi 58 17 35. Step 2: 72 banner lamp tulsi 58 17 35 91. Step 3 (last) moves 17, which must travel past 35 and 91 to reach the extreme right: 72 banner lamp tulsi 58 35 91 17. "72 banner lamp tulsi 58 17 35 91" is Step 2, stopping before 17 is shifted. "72 banner lamp tulsi 58 17 91 35" takes the three numbers rightmost first instead of leftmost first. "72 banner lamp tulsi 35 91 17 58" also shifts 58, whose digits are not both odd.
Answer: B) 72 banner lamp tulsi 58 35 91 17

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

An arrangement machine reorders an input line of words and numbers one step at a time.…An arrangement machine reorders an input line of words and numbers one step at a time.…An arrangement machine works on an input line of words and numbers in steps. In each…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,…