/
/
/
20.2   Multiple Choice 1) A for loop controlled by a(n): A) iteration
Not my Question
Flag Content

# Question : 20.2   Multiple Choice 1) A for loop controlled by a(n): A) iteration : 1907260

20.2   Multiple Choice

1) A for loop is controlled by a(n):

A) iteration variable

B) function

C) iteration

D) initialization

Explanation:  A) The for loop is controlled by changes in the iteration variable.

2) How many iterations will occur in this loop?

for (again = 1; again <=5; again = again + 1) {…}

A) four

B) five

C) six

D) none of the above

Explanation:  B) The will be five iterations.

3) Which of the following iterates 10 times?

A) for (i = 1; i = 10; i = i + 1)

B) for (i = 0; i <=10; i = i + 1)

C) for (i = 1; i <=10; i = i + 1)

D) none of the above

Explanation:  C) The loop starts at 1 and stops at 10.

4) Which of the following is an infinite loop?

A) for (k = 0; k <= 10; k = k + 1)

B) for (j = 1; j < 3; j++)

C) for (i = 1; i <= 4; i = i - 1)

D) for (k = 1; k < = 4; k++)

Explanation:  C) The loop never increments so it repeats infinitely.

5) A nested loop:

A) is not allowed in JavaScript

B) refers to two separate loops used in different parts of the same program

C) requires that the inner and outer loops must use different iteration variables

D) will always result in at least two iterations of the inner loops’ <statement list>

6) In JavaScript, the plus sign means:

C) concatenation

D) A or C

Explanation:  D) The plus sign, depending on how it is used, means either addition or concatenation.

7) In the following line:

var rows = new Array(5);

A) the array will have six items

B) the last item in the array will be rows

C) the first item in the array will be rows

D) all of the above

Explanation:  C) The first item will be rows and the last item will be rows.

8) The function clearTimeout is used to:

A) restart the timer

B) reset the interval of the timer

C) reset the number of times the timer runs

D) cancel the timer

Explanation:  D) clearTimeout cancels the timer.

9) For the elements of the array to store an image, they must be initialized to a(n):

A) image object

B) gifpix object

C) prefetch object

D) src object

10) In a for loop, the operation that sets the variable's value for the first iteration of the loop is the:

A) iteration

B) initialization

C) condition

D) test

11) In programming, an indexed base name is called a(n):

A) group

B) index

C) array

D) loop

12) The World-Famous Iteration (WFI) has this standard form:

A) for ( j=1; j<n; j++) { . . . }

B) for ( j=0; j<n; j++) { . . . }

C) for ( j=0; j<=n; j++) { . . . }

D) none of the above