Important Notice:

Practice-It will be discontinued as of November 1st, 2024. After this date, the website will remain online for a transitional period, but login will be restricted to University of Washington NetID authentication. This marks the next phase towards the platform's full retirement. Thank you for your use and support of the application over the years.

If you are looking for an alternative, a similar tool, CodeStepByStep, was developed independently by the original author of Practice-It, and is available at codestepbystep.com**

logo Practice-It logo

BJP4 Self-Check 2.36: loopTableConstant

Language/Type: Java for loops loop table
Author: Stefanie Hatcher (on 2016/09/08)

Assume that you have a variable called line that will take on the values 1, 2, 3, 4, and so on, and a class constant named SIZE that takes two values. You are going to formulate expressions in terms of line and SIZE that will yield different sequences of numbers of characters. The first row is filled in for you as an example. Fill in the solution boxes below, indicating an expression that will generate each sequence. Your answers must be in the exact format 'coefficient1 * line + (coefficient2 * SIZE + offset)' in that order to be counted as correct.

Problem # line value SIZE value Number of characters Expression
1, 2, 3, 4, 5, 6, ...
1, 2, 3, 4, 5, 6, ...
1
2
4, 6, 8, 10, 12, 14, ...
6, 8, 10, 12, 14, 16, ...
2 * line + (2 * SIZE)
1 1, 2, 3, 4, 5, 6, ...
1, 2, 3, 4, 5, 6, ...
3
5
13, 17, 21, 25, 29, 33, ...
19, 23, 27, 31, 35, 39, ...
2 1, 2, 3, 4, 5, 6, ...
1, 2, 3, 4, 5, 6, ...
4
9
10, 9, 8, 7, 6, 5, ...
20, 19, 18, 17, 16, 15, ...
1
2

You must log in before you can solve this problem.


Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.