978-0133577396 Chapter 20

subject Type Homework Help
subject Pages 8
subject Words 555
subject Authors Lawrence Snyder

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
Fluency with Information Technology, 6e (Snyder)
Chapter 20 Iteration Principles: Once Is Not Enough
20.1 True/False Questions
1) The control specification of the for loop includes three operations: <initialization>,
<continuation>, and <next iteration>.
2) A for loop continues as long as the <continuation> test is true.
3) It is possible to set up a for loop that never iterates.
4) The starting point of a for loop is always 0.
5) The step size of a for loop is always 1.
6) Loops cannot count backwards.
7) Iteration variables must be only single-letter identifiers.
8) The current loop iteration completes the entire body before the next iteration starts.
9) The iteration variable is often used in computations in the <statement list>.
10) Iteration variables should be declared with iter instead of var, because they are special
variables.
page-pf2
11) All for loops should have a <continuation> test.
12) The only way to stop an infinite loop is to restart the computer.
13) You can put a loop inside another loop.
14) An array index must be a non-negative integer.
15) The continuation operation of a for loop has the same form as the predicate in a conditional
statement.
16) Off-by-One Error is an uncommon error in computing.
17) Image prefetching can be performed at any time prior to the start of the associated animation.
18) If the loop initialization makes the continuation test false, the loop body will only execute
once.
19) A World-Famous Iteration (WFI) loop which has n iterations generates exactly all the legal
subscripts for an array of size n.
20) Anything you can do by modifying the DOM, you could alternatively do with the
document.write() function.
1) Which particularly controls the number of iterations of for loop?
A) iteration variable
B) function
C) iteration
D) initialization
2
page-pf3
page-pf4
2) How many iterations will occur in this loop?
for (again = 0; again < 5; again = again + 1) {…}
A) four
B) five
C) six
D) none of the above
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 = 0; i <10; i = i + 1)
D) none of the above
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++)
5) What must be the step size of the loop below, to ensure that it repeats exactly 5 times?
for(c=3; c<13; ____)
A) c++;
B) c = c + 2;
C) c = c + 3;
D) c = c + 4;
6) Which of the following is the correct way to declare an array?
A) var = new var(10);
B) var = new Array(10);
C) var myArray = new (10);
D) var myArray = new Array(10);
page-pf5
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
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
9) For the elements of the array to store images, they must each 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) 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
12) A nested loop structure where the outside loop runs five times and the inside loops runs
seven times would execute the statements of the inside loop:
A) 5 times
B) 7 times
C) 12 times
D) 35 times
page-pf6
13) In JavaScript, the plus sign means:
A) addition
B) add 1
C) concatenation
D) A or C
14) On a Web page, images can be loaded and stored in a(n):
A) image object
B) image array
C) form load
D) pic array
15) Browsers store the images they display in an array named:
A) src
B) images
C) pictures
D) content
1) In programming, ________ means looping through a series of statements to repeat them.
3) The main iteration statement in JavaScript is the ________ loop.
4) A(n) ________ test is the proper programming term for what is usually called the
<continuation> test of a loop.
5) The amount an iteration variable is changed after each cycle of a loop is known as a(n)
________.
6) In JavaScript, '\n' is the ________ symbol.
7) The point at which array indexing begins, i.e., the least index, is the ________.
page-pf7
8) A(n) ________ is an indexed base name.
9) The index origin in JavaScript is ________.
10) An array index is also called a(n) ________.
11) The proper programming term for continuation test is ________ test because it checks to see
if the loop should terminate.
12) In animation, one of many images rapidly redrawn that creates the illusion of motion is a(n)
________.
13) i++ is an example of ________ notation, and it means the same as i = i + 1.
14) Loading images ahead of time is called ________.
15) The number of elements in an array is referred to as the array ________.
16) A(n) ________ is the common name for the repetition of a block of programming code.
17) A(n) ________ is a single still image in a series of rapidly moving still images.
18) In JavaScript programming, timers ________ a thousand times per second.
19) ________ (code) allows you to reference the array of images stored by the browser.
20) The event handler is specified by using the ________ attribute of the image tag.
21) If an arr is an array of length 10, the largest subscript is ________ .
22) A JavaScript program can change the contents of a page which is already displayed by
changing the ________ .
7
page-pf8
23) The the timed event code which displays an animation must update the displayed frame, and
finally set the ________ so the next frame will be displayed
24) A JavaScript variable which is declared outside any function or form is a ________ .

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.