What are three common ways that the value of a loop control variable is changed during the loop's execution?

What will be an ideal response?


Within a correctly functioning loop's body, you can change the value of the loop control variable in a number of ways. Many loop control variable values are altered by incrementing, or adding to them. Other loops are controlled by reducing, or decrementing, a variable and testing whether the value remains greater than some benchmark value. Such a loop, for which the number of iterations is predetermined, is called a definite loop or counted loop. Often, the value of a loop control variable is not altered by arithmetic, but instead is altered by user input. For example, perhaps you want to continue performing some task while the user indicates a desire to continue. In that case, you do not know when you write the program whether the loop will be executed two times, 200 times, or not at all. This type of loop is an indefinite loop.

Computer Science & Information Technology

You might also like to view...

Which f the following JPA-related statements is false?

a. You can use EntityManager method getTransaction to get the Entity-Transaction that manages the transaction. b. You can use EntityTransaction method begin to start the transaction. c. You can use EntityManager method apply to insert a new entity into the database. d. You call EntityTransaction method commit to commit the changes to the database.

Computer Science & Information Technology

The default setting is to start each animation with a mouse click.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A(n) ____ allows you to capture video images using your computer.

A. Web cam B. digital media player C. digital camera D. All of the above.

Computer Science & Information Technology

VMs running under a Type 1 hypervisor are isolated from each other.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology