Chapter 4 Flashcards

1
Q

A portion of a program that repeats a statement or group of statements is called a

A

loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The statement or group of statements to be repeated in a loop is called the

A

body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Each repetition of the loop body is called ___ of the loop

A

iteration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

___ statement repeats its action again and again as long as a controlling boolean expression is true.

A

while

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or false, A while Loop Can Perform Zero Iterations

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A loop is always executed at least once.

A

do-while loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A loop that iterates its body repeatedly without ever ending is called

A

infinite loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What kind of loop enables you to easily write a loop that is controlled by some sort of counter

A

for-loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the part of for loop called? for (___ ; ____; ____ ) Body

A

(Initializing_Action; Boolean_Expression; Update_Action)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A semicolon by itself is considered a statement that does nothing, it is called an empty statement or

A

null statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The portion of a program in which a variable has meaning is known as the variable’s

A

scope

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

We use a comma, not a semicolon, to separate the initialization actions, such a comma is called?

A

comma operator.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A loop typically involves three elements:

A

the initializing statements, the loop body, and the mechanism for ending the loop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The two most kind of loop errors are

A

1- unintended infinite loop 2- off by-one error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What kind of loop error is this “ This error causes your loop to repeat its body either one too many times or one too few times” ?

A

off by-one error “ Off-by-one errors are caused by an incorrect boolean expression”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True or False; Tracing variables means watching the variables change value while the program is running.

A

True

17
Q

What does the method drawString do?

A

The method drawString is similar to the methods for drawing ovals, but drawString displays text rather than a drawing.