Deck 5: Looping
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
Match between columns
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/42
العب
ملء الشاشة (f)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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?
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 42 في هذه المجموعة.
فتح الحزمة
k this deck