Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
Given the following loop structure, how many times will the loop
iterate?
int x = 0; while(x<5) { //some king of
statement x++; }
|
|
2.
|
What is a loop?
a. | a powerful control structure in programming that allows a task to be repeated several
times. | c. | a simple way to turn a single line of code into a multiple instance of an
iteration. | b. | a programming technique that allows strings to loop over doubles to create a string
array. |
|
|
3.
|
Fill in the blank:
The ____________ of a loop process only happens ONCE
at the beginning.
a. | start | c. | increment | b. | stop | d. | stop |
|
|
4.
|
Given the start of a loop below, what two different ways a step of +2 can
be achieved: int x = 0;
a. | x += 2 | d. | a & c | b. | x++ | e. | a & b | c. | x = x +
2 | f. | a, b, and
c. |
|
|
5.
|
A common example of the beginning of a loop is:
a. | int x = 0; | c. | x++; | b. | x < 10; | d. | x < 0 >
x; |
|
|
6.
|
The three most commonly used loops are:
a. | for, do while, and while | c. | for, loopit and
iteration | b. | while, fore and do | d. | none of these. |
|