Skip to main content

Section 12.13 Unit 2b Subgoal Labeled Puzzles for Toggle Code

These are copies of the Loops Mixed Up Code Practice puzzles with subgoal labels added. The Loops Toggle Code Practice page uses them as the Get Help puzzles for its write code problems. Each loop header and its opening brace are one block, so one label sits on each loop.

Activity 12.13.1.

The following program segment should print out all the values from 20 to 30 (20, 21, 22, … 30). But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.2.

The following program segment should print a countdown from 15 to 0 (15, 14, 13, … 0). But the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.3.

The main method in the following class should print up from 0 to 50 by 5 (0, 5, 10, 15 … 50). But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.4.

The main method in the following class should print out the values from 0 to 100 by 20’s (0, 20, 40, .. 100). But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.5.

The main method in the following class should print out the values from 100 to 0 by 10’s (100, 90, 80, … 0). But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.6.

The main method in the following class should print 3 rows with 6 *’s in each row. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.7.

The main method in the following class should print 1 (followed by a newline), then 22 (followed by a newline), and then 333 (followed by a newline). But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.8.

The main method in the following class should print 11111, 22222, 33333, 44444, and 55555. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.9.

The main method in the following class should print 11111, 2222, 333, 44, 5. But, the blocks have been mixed up and include extra blocks that are not needed in a correct solution. Drag the needed blocks from the left and put them in the correct order on the right. Click the Check button to check your solution.

Activity 12.13.10.

The even_div(s, n) method in the NumWorker class should return the number of digits in s (a string representation of a number) that are evenly divisible by n. For example, even_div("6892",3) should return 2 since both 6 and 9 are evenly divisible by 3. The blocks have been mixed up and include extra blocks that are not needed in a correct solution.
You have attempted of activities on this page.