Deck 5: Looping
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
العب
ملء الشاشة (f)
Deck 5: Looping
1
What keyword(s) should you use to initiate a for-loop in C#?
A) while
B) do
C) repeat each
D) for
A) while
B) do
C) repeat each
D) for
D
2
Unlike the while and for loops, the do loop is considered to be in what category of loops?
A) intest loops
B) pretest loops
C) posttest loops
D) fortest loops
A) intest loops
B) pretest loops
C) posttest loops
D) fortest loops
C
3
What type of loop allows you to 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
A
4
Loops that are controlled by reducing a variable are utilizing what type of loop control variable?
A) incrementing
B) comparing
C) decrementing
D) expanding
A) incrementing
B) comparing
C) decrementing
D) expanding
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
A bug has resulted in your program executing an infinite loop.What key can be pressed in conjunction with the C or Break (Pause) key to escape the loop?
A) Esc
B) Ctrl
C) Shift
D) Alt
A) Esc
B) Ctrl
C) Shift
D) Alt
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
Many loop control variable values rely on an added value through each loop.What type of loop control variable is this?
A) A comparing loop control variable.
B) A reducing loop control variable.
C) An expanding loop control variable.
D) An incrementing loop control variable.
A) A comparing loop control variable.
B) A reducing loop control variable.
C) An expanding loop control variable.
D) An incrementing loop control variable.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
A Boolean expression is evaluated within every while loop to determine whether the loop body will execute.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
What type of 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
You cannot use a while loop for indefinite loops.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
Both the while loop and for loops are considered to be in what category of loops?
A) posttest loops
B) pretest loops
C) intest loops
D) for-test loops
A) posttest loops
B) pretest loops
C) intest loops
D) for-test loops
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
What is any single execution of a loop referred to as?
A) A lap of the loop.
B) An iteration of the loop.
C) A path through the loop.
D) A round in the loop.
A) A lap of the loop.
B) An iteration of the loop.
C) A path through the loop.
D) A round in the loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
You can improve loop performance by using prefix incrementing.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
Statements in a for loop body cannot be blocked.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
What type of 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
A loop for which the number of iterations is predetermined is known as what type of loop?
A) indefinite
B) infinite
C) while
D) definite
A) indefinite
B) infinite
C) while
D) definite
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
When loop structures are nested, the inner loop must be entirely contained within the outer loop; loops can never overlap.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
A loop that is controlled by user input rather than altered by arithmetic is known as what type of loop?
A) definite
B) indefinite
C) sentinel
D) infinite
A) definite
B) indefinite
C) sentinel
D) infinite
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
What type of 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
What are the block of statements that are executed in a loop considered to be part of?
A) a loop body
B) an iteration block
C) the loop header
D) the loop block
A) a loop body
B) an iteration block
C) the loop header
D) the loop block
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
When using nested loops, what loop is contained entirely within an outer loop?
A) posttest loop
B) pretest loop
C) inner loop
D) for loop
A) posttest loop
B) pretest loop
C) inner loop
D) for loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
Why do event-driven GUI programs sometimes require fewer coded loops than their counterpart console applications?
A) Some events are determined by the user's actions when the program is running.
B) GUI programs have better loop performance and can benefit more from loop fusion.
C) A GUI's properties removes the need for some loops.
D) A GUI program can utilize loop nesting, while a console program cannot.
A) Some events are determined by the user's actions when the program is running.
B) GUI programs have better loop performance and can benefit more from loop fusion.
C) A GUI's properties removes the need for some loops.
D) A GUI program can utilize loop nesting, while a console program cannot.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
A value such as a 'Y' or 'N' that must be supplied in order to stop a loop is known as what type of value?
A) control value
B) sentinel value
C) stop value
D) switch value
A) control value
B) sentinel value
C) stop value
D) switch value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
You are writing a program that defines a variable within a loop, and then tries to use that variable outside the loop.However, the program does not run as intended.What is the issue?
A) The variable is being overwritten inside the loop.
B) The variable is declared with an incorrect type.
C) The variable is limited to the scope of the loop.
D) The variable name conflicts with a built in keyword.
A) The variable is being overwritten inside the loop.
B) The variable is declared with an incorrect type.
C) The variable is limited to the scope of the loop.
D) The variable name conflicts with a built in keyword.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
When using a nested loop, what should always be thought of as the all-encompassing loop?
A) inner loop
B) outer loop
C) while loop
D) for loop
A) inner loop
B) outer loop
C) while loop
D) for loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
After executing your GUI program, you realize that your code has created an infinite loop.How can you break free of the loop in your GUI program?
A) Use Ctrl + C
B) Use Ctrl + Break
C) Close the Frame that hosts the application
D) Close the IDE
A) Use Ctrl + C
B) Use Ctrl + Break
C) Close the Frame that hosts the application
D) Close the IDE
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
What are three common ways that the value of a loop control variable is changed during the loop's execution?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
What should an accumulator variable 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
Why is it important to initialize an accumulator variable?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
What technique can be used to combine two different loops into one?
A) pretesting loop
B) short-circuiting loop
C) loop accumulation
D) loop fusion
A) pretesting loop
B) short-circuiting loop
C) loop accumulation
D) loop fusion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
The expressions in each part of an AND or OR expression are evaluated only as much as necessary to determine whether the entire expression is true or false.What type of evaluation is this?
A) while
B) stopwatch
C) short-circuit
D) loop
A) while
B) stopwatch
C) short-circuit
D) loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
When writing a while loop, how can you ensure that it will end correctly?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
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 < a + b)
// 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 < a + b)
// 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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
Briefly describe the structure of a for loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
What is a garbage value in the C# programming language?
A) It is an unknown, unassigned value.
B) It is a variable that is assigned a value that has no purpose.
C) It is a variable that is used as a placeholder.
D) It is a variable that holds output text after it is displayed.
A) It is an unknown, unassigned value.
B) It is a variable that is assigned a value that has no purpose.
C) It is a variable that is used as a placeholder.
D) It is a variable that holds output text after it is displayed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
Write a short program that prints Hello on the console four times using a while loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
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?
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
Totals that are summed one at a time in a loop are known as what type of totals?
A) decremented
B) incremented
C) derived
D) accumulated
A) decremented
B) incremented
C) derived
D) accumulated
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck