Deck 5: Repetition

ملء الشاشة (f)
exit full mode
سؤال
A loop iteration is also called a pass through the loop.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
Not all loops require a condition that must be evaluated.
سؤال
Valid loop conditions are identical to those used in selection statements.
سؤال
In every loop there must be a statement within the repeating section of code that alters the condition so that it eventually becomes false.
سؤال
A pretest loop is also called an exit-controlled loop.
سؤال
A posttest loop is also called an entranced-controlled loop.
سؤال
The switch statement is a general repetition statement that can be used in a variety of programming situations.
سؤال
The general form of the while statement is:
statement;
while (expression);
سؤال
The transfer of control back to the start of a while statement to reevaluate the expression is known as a program loop.
سؤال
Symbolic constants can be extremely useful in constructing loops because they indicate what the number in the tested condition represents.
سؤال
Loops are rarely used for the computation of sums and averages of lists of numeric data.
سؤال
An average is computed by dividing the final total or accumulated value by the number of items that were added.
سؤال
Care must be taken when choosing sentinel values.
سؤال
If we were constructing a program that accepts student grades, a good sentinel value would be 0.
سؤال
In C, EOF stands for End Of Format.
سؤال
The actual value of EOF is compiler-dependent, but it is always assigned a code that is not used by any other character.
سؤال
The stdio.h file contains the definition of EOF.
سؤال
A break statement forces an immediate break, or exit, from switch and while statements only.
سؤال
The break statement violates pure structured programming principles because it provides a second, nonstandard exit from a loop.
سؤال
When a continue statement is encountered in a loop, the next iteration of the loop begins immediately.
سؤال
In many situations, especially those that use a counter-controlled loop, the for statement format is easier to use than its while equivalent.
سؤال
The construction for ( ; count <= 20;) is not valid.
سؤال
In C, lists where commas are required to separate individual expressions in the list, are referred to as comma-separated lists.
سؤال
Nested loops have a loop contained within another loop.
سؤال
The first loop of a nested loop is called the inner loop.
سؤال
The input data validation application is ideally suited for a pretest loop.
سؤال
A section of code that is repeated is referred to as a ____.

A)condition
B)selection
C)repetition
D)loop
سؤال
Once a repetition statement is chosen, the other ____ elements of a loop are generally controlled by a single loop-control variable.

A)two
B)three
C)four
D)five
سؤال
In a(n) ____ loop the condition is tested at the end of the repeating section of code.

A)pretest
B)posttest
C)fixed-count
D)condition-controlled
سؤال
In a(n) ____ loop the condition the tested condition does not depend on a count being achieved, but rather on a specific value being encountered.

A)pretest
B)posttest
C)fixed-count
D)condition-controlled
سؤال
A(n) ____ is a condition-controlled loop where one specific value is required to terminate the loop.

A)input-validation
B)sentinel-controlled
C)condition-controlled
D)counter-controlled
سؤال
A(n) ____ loop is a condition-controlled loop that terminates when a value within a valid range is entered.

A)input-validation
B)sentinel-controlled
C)condition-controlled
D)counter-controlled
سؤال
The ____ statement literally loops back on itself to recheck the expression until it evaluates to 0 (becomes false).

A)for
B)switch
C)do-while
D)while
سؤال
In the following statements, the printf statement will be executed ____ times.
Count = 10;
While (count <= 10)
Printf("%d ",count);

A)0
B)1
C)10
D)an infinite number of
سؤال
The output of the following code is ____.
Count = 1; /* initialize count */
While (count <= 10)
{
Printf("%d ",count);
Count++; /* increment count */
}

A)1 1 1 1 1 1 1 1 ...
B)1 2 3 4 5 6 7 8 9
C)1 2 3 4 5 6 7 8 9 10
D)1 2 3 4 5 6 7 8 9 10 11
سؤال
total = total + num; is equivalent to ____.

A)total += num;
B)total =+ num;
C)total ++ num;
D)total +=+ num;
سؤال
____ is an accumulating statement.

A)total += num;
B)total++;
C)++total;
D)total* = num;
سؤال
Before accumulating values, the accumulator variable should be initialized to ____.

A)-1
B)0
C)1
D)NULL
سؤال
In Unix operating systems, the EOF mark is generated whenever the ____ keys are pressed simultaneously.

A)Ctrl and D
B)Ctrl and E
C)Ctrl and F
D)Ctrl and Z
سؤال
In IBM-compatible computers, the EOF mark is generated whenever the ____ keys are pressed simultaneously.

A)Ctrl and D
B)Ctrl and E
C)Ctrl and F
D)Ctrl and Z
سؤال
The ____ statement is similar to the break statement but applies only to loops created with while, do-while, and for statements.

A)stop
B)loop
C)exit
D)continue
سؤال
The statement ____ is a null statement.

A)NULL
B)NULL;
C)break;
D);
سؤال
The need to initialize variables or make some other evaluations prior to entering a repetition loop is so common that the ____ statement allows all the initializing statements to be grouped together as the first set of items within the statement's parentheses.

A)for
B)while
C)do-while
D)switch
سؤال
The ____ semicolons must always be present within the for statement's parentheses.

A)two
B)three
C)four
D)five
سؤال
Omitting the ____ expression in a for statement results in an infinite loop.

A)initializing
B)altering
C)tested
D)break
سؤال
The second loop of a nested loop is called the ____ loop.

A) inner
B) outer
C) slave
D) conditioned
سؤال
The ____ statement always creates a posttest loop.

A) while
B) do-while
C) for
D) repeat-until
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/47
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 5: Repetition
1
A loop iteration is also called a pass through the loop.
True
2
Not all loops require a condition that must be evaluated.
False
3
Valid loop conditions are identical to those used in selection statements.
True
4
In every loop there must be a statement within the repeating section of code that alters the condition so that it eventually becomes false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
5
A pretest loop is also called an exit-controlled loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
6
A posttest loop is also called an entranced-controlled loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
7
The switch statement is a general repetition statement that can be used in a variety of programming situations.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
8
The general form of the while statement is:
statement;
while (expression);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
9
The transfer of control back to the start of a while statement to reevaluate the expression is known as a program loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
10
Symbolic constants can be extremely useful in constructing loops because they indicate what the number in the tested condition represents.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
11
Loops are rarely used for the computation of sums and averages of lists of numeric data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
12
An average is computed by dividing the final total or accumulated value by the number of items that were added.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
13
Care must be taken when choosing sentinel values.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
14
If we were constructing a program that accepts student grades, a good sentinel value would be 0.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
15
In C, EOF stands for End Of Format.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
16
The actual value of EOF is compiler-dependent, but it is always assigned a code that is not used by any other character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
17
The stdio.h file contains the definition of EOF.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
18
A break statement forces an immediate break, or exit, from switch and while statements only.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
19
The break statement violates pure structured programming principles because it provides a second, nonstandard exit from a loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
20
When a continue statement is encountered in a loop, the next iteration of the loop begins immediately.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
21
In many situations, especially those that use a counter-controlled loop, the for statement format is easier to use than its while equivalent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
22
The construction for ( ; count <= 20;) is not valid.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
23
In C, lists where commas are required to separate individual expressions in the list, are referred to as comma-separated lists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
24
Nested loops have a loop contained within another loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
25
The first loop of a nested loop is called the inner loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
26
The input data validation application is ideally suited for a pretest loop.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
27
A section of code that is repeated is referred to as a ____.

A)condition
B)selection
C)repetition
D)loop
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
28
Once a repetition statement is chosen, the other ____ elements of a loop are generally controlled by a single loop-control variable.

A)two
B)three
C)four
D)five
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
29
In a(n) ____ loop the condition is tested at the end of the repeating section of code.

A)pretest
B)posttest
C)fixed-count
D)condition-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
30
In a(n) ____ loop the condition the tested condition does not depend on a count being achieved, but rather on a specific value being encountered.

A)pretest
B)posttest
C)fixed-count
D)condition-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
31
A(n) ____ is a condition-controlled loop where one specific value is required to terminate the loop.

A)input-validation
B)sentinel-controlled
C)condition-controlled
D)counter-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
32
A(n) ____ loop is a condition-controlled loop that terminates when a value within a valid range is entered.

A)input-validation
B)sentinel-controlled
C)condition-controlled
D)counter-controlled
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
33
The ____ statement literally loops back on itself to recheck the expression until it evaluates to 0 (becomes false).

A)for
B)switch
C)do-while
D)while
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
34
In the following statements, the printf statement will be executed ____ times.
Count = 10;
While (count <= 10)
Printf("%d ",count);

A)0
B)1
C)10
D)an infinite number of
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
35
The output of the following code is ____.
Count = 1; /* initialize count */
While (count <= 10)
{
Printf("%d ",count);
Count++; /* increment count */
}

A)1 1 1 1 1 1 1 1 ...
B)1 2 3 4 5 6 7 8 9
C)1 2 3 4 5 6 7 8 9 10
D)1 2 3 4 5 6 7 8 9 10 11
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
36
total = total + num; is equivalent to ____.

A)total += num;
B)total =+ num;
C)total ++ num;
D)total +=+ num;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
37
____ is an accumulating statement.

A)total += num;
B)total++;
C)++total;
D)total* = num;
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
38
Before accumulating values, the accumulator variable should be initialized to ____.

A)-1
B)0
C)1
D)NULL
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
39
In Unix operating systems, the EOF mark is generated whenever the ____ keys are pressed simultaneously.

A)Ctrl and D
B)Ctrl and E
C)Ctrl and F
D)Ctrl and Z
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
40
In IBM-compatible computers, the EOF mark is generated whenever the ____ keys are pressed simultaneously.

A)Ctrl and D
B)Ctrl and E
C)Ctrl and F
D)Ctrl and Z
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
41
The ____ statement is similar to the break statement but applies only to loops created with while, do-while, and for statements.

A)stop
B)loop
C)exit
D)continue
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
42
The statement ____ is a null statement.

A)NULL
B)NULL;
C)break;
D);
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
43
The need to initialize variables or make some other evaluations prior to entering a repetition loop is so common that the ____ statement allows all the initializing statements to be grouped together as the first set of items within the statement's parentheses.

A)for
B)while
C)do-while
D)switch
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
44
The ____ semicolons must always be present within the for statement's parentheses.

A)two
B)three
C)four
D)five
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
45
Omitting the ____ expression in a for statement results in an infinite loop.

A)initializing
B)altering
C)tested
D)break
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
46
The second loop of a nested loop is called the ____ loop.

A) inner
B) outer
C) slave
D) conditioned
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
47
The ____ statement always creates a posttest loop.

A) while
B) do-while
C) for
D) repeat-until
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 47 في هذه المجموعة.