Deck 5: Looping

ملء الشاشة (f)
exit full mode
سؤال
You begin a for statement with the keyword ____ followed by a set of parentheses.

A) while
B) do
C) repeat each
D) for
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
A loop for which the number of iterations is predetermined is called a(n) ____ loop.

A) indefinite
B) infinite
C) counted
D) definite
سؤال
The ____ loop checks a Boolean expression at the "top" of the loop before the body has a chance to execute.

A) do
B) repeat
C) switch
D) while
سؤال
Many loop control variable values are altered by ____ (or adding to) them.

A) comparing
B) reducing
C) expanding
D) incrementing
سؤال
When loop structures are nested, the inner loop must be entirely contained within the outer loop; loops can never overlap.
سؤال
A Boolean expression is evaluated within every while loop to determine whether the loop body will execute.
سؤال
The do  loop is a(n) ____ loop.

A) intest
B) pretest
C) posttest
D) fortest
سؤال
You can improve loop performance by using prefix incrementing.
سؤال
Often, the value of a loop control variable is not altered by arithmetic, but instead is altered by user input. This type of loop is a(n) ____ loop.

A) definite
B) indefinite
C) sentinel
D) infinite
سؤال
The ____ loop checks a Boolean expression at the "bottom" of the loop after each repetition has occurred.

A) do
B) for
C) switch
D) while
سؤال
Statements in a for loop body cannot be blocked.
سؤال
One execution of any loop is called a(n) ____.

A) lap
B) iteration
C) path
D) round
سؤال
With a ____ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place.

A) for
B) do
C) repeat
D) while
سؤال
When loops are nested, each pair contains a(n) ____ loop and an outer loop.

A) posttest
B) pretest
C) inner
D) for
سؤال
You cannot use a while loop for indefinite loops.
سؤال
Some loops are controlled by ____ (or reducing) a variable and testing whether the value remains greater than some benchmark value.

A) incrementing
B) comparing
C) decrementing
D) expanding
سؤال
A while loop is a(n) ____ loop.

A) posttest
B) pretest
C) intest
D) fortest
سؤال
If you ever find yourself in the midst of executing an infinite loop, you can break out by holding down the ____ key and pressing the C key or the Break (Pause) key.

A) Esc
B) Ctrl
C) Shift
D) Alt
سؤال
The block of statements executed in a loop is known as the ____.

A) loop body
B) iteration block
C) loop header
D) loop block
سؤال
A(n) ____ loop is one in which the loop control variable is tested after the loop body executes.

A) posttest
B) intest
C) fortest
D) pretest
سؤال
Why is it important to initialize an accumulator variable?
سؤال
Often, totals are ____; that is, summed one at a time in a loop.

A) decremented
B) incremented
C) derived
D) accumulated
سؤال
The expressions in each part of an AND or OR expression use ____ evaluation; that is, they are evaluated only as much as necessary to determine whether the entire expression is true or false .

A) while
B) stopwatch
C) short-circuit
D) loop
سؤال
Loop ____ is the technique of combining two loops into one.

A) pretesting
B) short-circuiting
C) accumulation
D) fusion
سؤال
You can use a(n) ____________________ loop to execute a body of statements continuously as long as some condition continues to be true .
سؤال
Event-driven GUI programs sometimes require fewer coded loops than their counterpart console applications because some events are determined by the ____ when the program is running.

A) user's actions
B) loop performance
C) GUI's properties
D) loop nesting
سؤال
A value that a user must supply to stop a loop (for example, 'Y' or 'N' ) is called a(n) ____________________ value.
سؤال
Statements in a while loop or for loop body can be blocked. Write a for loop that displays "Hello" and "Goodbye" four times each using a blocked loop body.
سؤال
When a variable is declared inside a loop, it can be referenced only for the duration of the loop body. Once the loop finishes execution, the variable is out of ____________________, which means it is not usable because it has ceased to exist.
سؤال
When you use a loop within a loop, you should always think of the ____ loop as the all-encompassing loop.

A) inner
B) outer
C) while
D) for
سؤال
A(n) ____________________ is a structure that allows repeated execution of a block of statements.
سؤال
When writing a while loop, how can you ensure that it will end correctly?
سؤال
Suppose a loop should execute while x is less than the sum of two integers, a and b . The loop could be written as:
while (x
// loop body
Although this code fragment will run, it is not particularly efficient. In what way is it inefficient, and how could you improve the loop's performance?
سؤال
Write two code segments that print the integers 1 through 10. One segment should use a while loop and the other should use a for loop.
سؤال
Because you need definite loops so frequently when you write programs, C# provides a shorthand way to create such a loop. This shorthand structure is called a(n) ____________________ loop.
سؤال
What tasks can be performed in the three sections of a for loop in addition to initializing a single variable, testing the variable, and incrementing it?
سؤال
Briefly describe the structure of a for loop.
سؤال
An accumulator variable must be set to ____ before it is used to accumulate a total.

A) 1
B) false
C) true
D) 0
سؤال
Write a short program that prints "Hello" on the console four times using a while loop.
سؤال
What are three common ways that the value of a loop control variable is changed during the loop's execution?
سؤال
When a loop might execute many times, it becomes increasingly important to consider the number of evaluations that take place. How can considering the order of evaluation of short-circuit operators affect the performance of a loop?
سؤال
Match between columns
A loop that never ends
infinite loop
A loop that never ends
for loop
A loop that never ends
step value
A loop that never ends
counted loop
A loop that never ends
outer loop
A loop that never ends
do loop
A loop that never ends
garbage
A loop that never ends
loop control variable
A loop that never ends
empty body
The value of an uninitialized variable
infinite loop
The value of an uninitialized variable
for loop
The value of an uninitialized variable
step value
The value of an uninitialized variable
counted loop
The value of an uninitialized variable
outer loop
The value of an uninitialized variable
do loop
The value of an uninitialized variable
garbage
The value of an uninitialized variable
loop control variable
The value of an uninitialized variable
empty body
Another name for a definite loop
infinite loop
Another name for a definite loop
for loop
Another name for a definite loop
step value
Another name for a definite loop
counted loop
Another name for a definite loop
outer loop
Another name for a definite loop
do loop
Another name for a definite loop
garbage
Another name for a definite loop
loop control variable
Another name for a definite loop
empty body
The amount by which a loop control variable changes on each cycle
infinite loop
The amount by which a loop control variable changes on each cycle
for loop
The amount by which a loop control variable changes on each cycle
step value
The amount by which a loop control variable changes on each cycle
counted loop
The amount by which a loop control variable changes on each cycle
outer loop
The amount by which a loop control variable changes on each cycle
do loop
The amount by which a loop control variable changes on each cycle
garbage
The amount by which a loop control variable changes on each cycle
loop control variable
The amount by which a loop control variable changes on each cycle
empty body
Checks at the "bottom" of the loop after the first iteration
infinite loop
Checks at the "bottom" of the loop after the first iteration
for loop
Checks at the "bottom" of the loop after the first iteration
step value
Checks at the "bottom" of the loop after the first iteration
counted loop
Checks at the "bottom" of the loop after the first iteration
outer loop
Checks at the "bottom" of the loop after the first iteration
do loop
Checks at the "bottom" of the loop after the first iteration
garbage
Checks at the "bottom" of the loop after the first iteration
loop control variable
Checks at the "bottom" of the loop after the first iteration
empty body
Contains an inner loop when loops are nested
infinite loop
Contains an inner loop when loops are nested
for loop
Contains an inner loop when loops are nested
step value
Contains an inner loop when loops are nested
counted loop
Contains an inner loop when loops are nested
outer loop
Contains an inner loop when loops are nested
do loop
Contains an inner loop when loops are nested
garbage
Contains an inner loop when loops are nested
loop control variable
Contains an inner loop when loops are nested
empty body
A variable that controls the execution of a while loop
infinite loop
A variable that controls the execution of a while loop
for loop
A variable that controls the execution of a while loop
step value
A variable that controls the execution of a while loop
counted loop
A variable that controls the execution of a while loop
outer loop
A variable that controls the execution of a while loop
do loop
A variable that controls the execution of a while loop
garbage
A variable that controls the execution of a while loop
loop control variable
A variable that controls the execution of a while loop
empty body
A shorthand structure for programming a definite loop
infinite loop
A shorthand structure for programming a definite loop
for loop
A shorthand structure for programming a definite loop
step value
A shorthand structure for programming a definite loop
counted loop
A shorthand structure for programming a definite loop
outer loop
A shorthand structure for programming a definite loop
do loop
A shorthand structure for programming a definite loop
garbage
A shorthand structure for programming a definite loop
loop control variable
A shorthand structure for programming a definite loop
empty body
A loop body with no statements in it
infinite loop
A loop body with no statements in it
for loop
A loop body with no statements in it
step value
A loop body with no statements in it
counted loop
A loop body with no statements in it
outer loop
A loop body with no statements in it
do loop
A loop body with no statements in it
garbage
A loop body with no statements in it
loop control variable
A loop body with no statements in it
empty body
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/42
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 5: Looping
1
You begin a for statement with the keyword ____ followed by a set of parentheses.

A) while
B) do
C) repeat each
D) for
D
2
A loop for which the number of iterations is predetermined is called a(n) ____ loop.

A) indefinite
B) infinite
C) counted
D) definite
D
3
The ____ loop checks a Boolean expression at the "top" of the loop before the body has a chance to execute.

A) do
B) repeat
C) switch
D) while
D
4
Many loop control variable values are altered by ____ (or adding to) them.

A) comparing
B) reducing
C) expanding
D) incrementing
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
5
When loop structures are nested, the inner loop must be entirely contained within the outer loop; loops can never overlap.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
6
A Boolean expression is evaluated within every while loop to determine whether the loop body will execute.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
7
The do  loop is a(n) ____ loop.

A) intest
B) pretest
C) posttest
D) fortest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
8
You can improve loop performance by using prefix incrementing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
9
Often, the value of a loop control variable is not altered by arithmetic, but instead is altered by user input. This type of loop is a(n) ____ loop.

A) definite
B) indefinite
C) sentinel
D) infinite
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
10
The ____ loop checks a Boolean expression at the "bottom" of the loop after each repetition has occurred.

A) do
B) for
C) switch
D) while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
11
Statements in a for loop body cannot be blocked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
12
One execution of any loop is called a(n) ____.

A) lap
B) iteration
C) path
D) round
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
13
With a ____ loop, you can indicate the starting value for the loop control variable, the test condition that controls loop entry, and the expression that alters the loop control variable, all in one convenient place.

A) for
B) do
C) repeat
D) while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
14
When loops are nested, each pair contains a(n) ____ loop and an outer loop.

A) posttest
B) pretest
C) inner
D) for
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
15
You cannot use a while loop for indefinite loops.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
16
Some loops are controlled by ____ (or reducing) a variable and testing whether the value remains greater than some benchmark value.

A) incrementing
B) comparing
C) decrementing
D) expanding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
17
A while loop is a(n) ____ loop.

A) posttest
B) pretest
C) intest
D) fortest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
18
If you ever find yourself in the midst of executing an infinite loop, you can break out by holding down the ____ key and pressing the C key or the Break (Pause) key.

A) Esc
B) Ctrl
C) Shift
D) Alt
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
19
The block of statements executed in a loop is known as the ____.

A) loop body
B) iteration block
C) loop header
D) loop block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
20
A(n) ____ loop is one in which the loop control variable is tested after the loop body executes.

A) posttest
B) intest
C) fortest
D) pretest
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
21
Why is it important to initialize an accumulator variable?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
22
Often, totals are ____; that is, summed one at a time in a loop.

A) decremented
B) incremented
C) derived
D) accumulated
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
23
The expressions in each part of an AND or OR expression use ____ evaluation; that is, they are evaluated only as much as necessary to determine whether the entire expression is true or false .

A) while
B) stopwatch
C) short-circuit
D) loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
24
Loop ____ is the technique of combining two loops into one.

A) pretesting
B) short-circuiting
C) accumulation
D) fusion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
25
You can use a(n) ____________________ loop to execute a body of statements continuously as long as some condition continues to be true .
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
26
Event-driven GUI programs sometimes require fewer coded loops than their counterpart console applications because some events are determined by the ____ when the program is running.

A) user's actions
B) loop performance
C) GUI's properties
D) loop nesting
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
27
A value that a user must supply to stop a loop (for example, 'Y' or 'N' ) is called a(n) ____________________ value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
28
Statements in a while loop or for loop body can be blocked. Write a for loop that displays "Hello" and "Goodbye" four times each using a blocked loop body.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
29
When a variable is declared inside a loop, it can be referenced only for the duration of the loop body. Once the loop finishes execution, the variable is out of ____________________, which means it is not usable because it has ceased to exist.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
30
When you use a loop within a loop, you should always think of the ____ loop as the all-encompassing loop.

A) inner
B) outer
C) while
D) for
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
31
A(n) ____________________ is a structure that allows repeated execution of a block of statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
32
When writing a while loop, how can you ensure that it will end correctly?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
33
Suppose a loop should execute while x is less than the sum of two integers, a and b . The loop could be written as:
while (x
// loop body
Although this code fragment will run, it is not particularly efficient. In what way is it inefficient, and how could you improve the loop's performance?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
34
Write two code segments that print the integers 1 through 10. One segment should use a while loop and the other should use a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
35
Because you need definite loops so frequently when you write programs, C# provides a shorthand way to create such a loop. This shorthand structure is called a(n) ____________________ loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
36
What tasks can be performed in the three sections of a for loop in addition to initializing a single variable, testing the variable, and incrementing it?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
37
Briefly describe the structure of a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
38
An accumulator variable must be set to ____ before it is used to accumulate a total.

A) 1
B) false
C) true
D) 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
39
Write a short program that prints "Hello" on the console four times using a while loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
40
What are three common ways that the value of a loop control variable is changed during the loop's execution?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
41
When a loop might execute many times, it becomes increasingly important to consider the number of evaluations that take place. How can considering the order of evaluation of short-circuit operators affect the performance of a loop?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
42
Match between columns
A loop that never ends
infinite loop
A loop that never ends
for loop
A loop that never ends
step value
A loop that never ends
counted loop
A loop that never ends
outer loop
A loop that never ends
do loop
A loop that never ends
garbage
A loop that never ends
loop control variable
A loop that never ends
empty body
The value of an uninitialized variable
infinite loop
The value of an uninitialized variable
for loop
The value of an uninitialized variable
step value
The value of an uninitialized variable
counted loop
The value of an uninitialized variable
outer loop
The value of an uninitialized variable
do loop
The value of an uninitialized variable
garbage
The value of an uninitialized variable
loop control variable
The value of an uninitialized variable
empty body
Another name for a definite loop
infinite loop
Another name for a definite loop
for loop
Another name for a definite loop
step value
Another name for a definite loop
counted loop
Another name for a definite loop
outer loop
Another name for a definite loop
do loop
Another name for a definite loop
garbage
Another name for a definite loop
loop control variable
Another name for a definite loop
empty body
The amount by which a loop control variable changes on each cycle
infinite loop
The amount by which a loop control variable changes on each cycle
for loop
The amount by which a loop control variable changes on each cycle
step value
The amount by which a loop control variable changes on each cycle
counted loop
The amount by which a loop control variable changes on each cycle
outer loop
The amount by which a loop control variable changes on each cycle
do loop
The amount by which a loop control variable changes on each cycle
garbage
The amount by which a loop control variable changes on each cycle
loop control variable
The amount by which a loop control variable changes on each cycle
empty body
Checks at the "bottom" of the loop after the first iteration
infinite loop
Checks at the "bottom" of the loop after the first iteration
for loop
Checks at the "bottom" of the loop after the first iteration
step value
Checks at the "bottom" of the loop after the first iteration
counted loop
Checks at the "bottom" of the loop after the first iteration
outer loop
Checks at the "bottom" of the loop after the first iteration
do loop
Checks at the "bottom" of the loop after the first iteration
garbage
Checks at the "bottom" of the loop after the first iteration
loop control variable
Checks at the "bottom" of the loop after the first iteration
empty body
Contains an inner loop when loops are nested
infinite loop
Contains an inner loop when loops are nested
for loop
Contains an inner loop when loops are nested
step value
Contains an inner loop when loops are nested
counted loop
Contains an inner loop when loops are nested
outer loop
Contains an inner loop when loops are nested
do loop
Contains an inner loop when loops are nested
garbage
Contains an inner loop when loops are nested
loop control variable
Contains an inner loop when loops are nested
empty body
A variable that controls the execution of a while loop
infinite loop
A variable that controls the execution of a while loop
for loop
A variable that controls the execution of a while loop
step value
A variable that controls the execution of a while loop
counted loop
A variable that controls the execution of a while loop
outer loop
A variable that controls the execution of a while loop
do loop
A variable that controls the execution of a while loop
garbage
A variable that controls the execution of a while loop
loop control variable
A variable that controls the execution of a while loop
empty body
A shorthand structure for programming a definite loop
infinite loop
A shorthand structure for programming a definite loop
for loop
A shorthand structure for programming a definite loop
step value
A shorthand structure for programming a definite loop
counted loop
A shorthand structure for programming a definite loop
outer loop
A shorthand structure for programming a definite loop
do loop
A shorthand structure for programming a definite loop
garbage
A shorthand structure for programming a definite loop
loop control variable
A shorthand structure for programming a definite loop
empty body
A loop body with no statements in it
infinite loop
A loop body with no statements in it
for loop
A loop body with no statements in it
step value
A loop body with no statements in it
counted loop
A loop body with no statements in it
outer loop
A loop body with no statements in it
do loop
A loop body with no statements in it
garbage
A loop body with no statements in it
loop control variable
A loop body with no statements in it
empty body
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.