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 machine looks for the leftmost number that stands immediately to the right of a word and has not been moved before, and makes that number and that word trade places. A number moved in this way is never moved again, nothing else in the line shifts, and the machine stops when no such number is left.
Input: bajra 47 jowar 62 ragi 38 moong 15.
Which of the following is Step 3 of the above arrangement?

Competition practiceInput-Output
  • A47 bajra 62 jowar ragi 38 moong 15
  • B47 bajra 62 jowar 38 ragi moong 15
  • C47 bajra 62 jowar 38 ragi 15 moong
  • Dbajra 47 62 jowar 38 ragi 15 moong

Step-by-Step Solution

Step 1 makes 47 trade places with bajra: 47 bajra jowar 62 ragi 38 moong 15. Step 2 makes 62 trade places with jowar: 47 bajra 62 jowar ragi 38 moong 15. Step 3 makes 38 trade places with ragi: 47 bajra 62 jowar 38 ragi moong 15, the answer. "47 bajra 62 jowar ragi 38 moong 15" is Step 2 and "47 bajra 62 jowar 38 ragi 15 moong" is Step 4, the last step. "bajra 47 62 jowar 38 ragi 15 moong" takes the pairs from the right-hand end of the line instead of the leftmost one each time.
Answer: B) 47 bajra 62 jowar 38 ragi moong 15

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,…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.…A word-and-number arrangement machine, when given an input line of words and numbers,…