x
Info
x
Warning
x
Danger
 / 
 / 
 / 
20.2   Multiple Choice 1) A for loop controlled by a(n): A) iteration

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

Answer:  A

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

Answer:  B

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

Answer:  C

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++)

Answer:  C

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>

Answer:  C

6) In JavaScript, the plus sign means:

A) addition

B) add 1

C) concatenation

D) A or C

Answer:  D

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[5]

C) the first item in the array will be rows[0]

D) all of the above

Answer:  C

Explanation:  C) The first item will be rows[0] and the last item will be rows[4].

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

Answer:  D

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

Answer:  A

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

Answer:  B

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

A) group

B) index

C) array

D) loop

Answer:  C

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

Answer:  B

Solution
5 (1 Ratings )

Solved
English 2 Years Ago 381 Views
This Question has Been Answered!

Related Answers
Unlimited Access Free
Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Instant Access!
Ask an Expert
Our Experts can answer your tough homework and study questions
12971 English Questions Answered!
Post a Question