Deck 4: Dowhile Control Structurecounter-Controlled Loops
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/30
Play
Full screen (f)
Deck 4: Dowhile Control Structurecounter-Controlled Loops
1
To create a properly formed DOWHILE loop you must
A)place the loop test before any other step in the loop
B)place the loop steps in the NO path of the loop test
C)indicate that the loop will exit in the YES path of the loop test
D)all of the above
A)place the loop test before any other step in the loop
B)place the loop steps in the NO path of the loop test
C)indicate that the loop will exit in the YES path of the loop test
D)all of the above
A
2
A counter-controlled loop is more flexible than a loop controlled by a header record value.
False
3
A program that can be viewed as a single statement is called a
A)structured program
B)proper program
C)header record logic program
D)SIMPLE SEQUENCE program
A)structured program
B)proper program
C)header record logic program
D)SIMPLE SEQUENCE program
B
4
If the value input for START is 8,how many times will the instructions within the loop below be executed?
Read START
COUNT START
DOWHILE COUNT START
COUNT COUNT - 1
Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Read START
COUNT START
DOWHILE COUNT START
COUNT COUNT - 1
Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
5
If the value input for START is 8,how many times will the instructions within the loop below be executed?
Read START
COUNT START
DOWHILE COUNT START
COUNT COUNT - 1
Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Read START
COUNT START
DOWHILE COUNT START
COUNT COUNT - 1
Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
6
Which program flowcharting symbol can be used to represent an initialization step in a program flowchart?
A)decision
B)connector
C)terminal interrupt
D)preparation
A)decision
B)connector
C)terminal interrupt
D)preparation
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
7
The test for the No-Data condition is implemented in program design with a(n)
A)IFTHENELSE pattern
B)DOWHILE loop
C)READ statement
D)preparation step
A)IFTHENELSE pattern
B)DOWHILE loop
C)READ statement
D)preparation step
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
8
What is the value of ANSWER after the instructions corresponding to the following pseudocode are executed?
A)100
B)125
C)5
D)25
A)100
B)125
C)5
D)25
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
9
What is the value of ANSWER after the instructions corresponding to the following pseudocode are executed?
DOWHILE COUNT
ENDDO
ANSWER SUM
A)110
B)115
C)120
D)125
DOWHILE COUNT
ENDDO
ANSWER SUM
A)110
B)115
C)120
D)125
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
10
A partial sum cannot have the same value as the corresponding total sum.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
11
A variable that is used to hold the sum of a group of values is called a(n)
A)counter
B)accumulator
C)header record
D)loop control
A)counter
B)accumulator
C)header record
D)loop control
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
12
How many values will be output when the instructions corresponding to the following pseudocode are executed?
COUNT
DOWHILE COUNT
COUNT COUNT + 1
Write ACCUM
Write ACCUM
A)4
B)5
C)8
D)16
COUNT
DOWHILE COUNT
COUNT COUNT + 1
Write ACCUM
Write ACCUM
A)4
B)5
C)8
D)16
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
13
What type of loop is executed a predetermined number of times?
A)infinite
B)counter-controlled
C)header record
D)leading decision
A)infinite
B)counter-controlled
C)header record
D)leading decision
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
14
A sequence of processing steps that must be repeated is called a
A)decision
B)counter
C)loop
D)proper program
A)decision
B)counter
C)loop
D)proper program
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
15
What is the value of ANSWER after the instructions corresponding to the following pseudocode are executed?
A)3
B)4
C)5
D)6
A)3
B)4
C)5
D)6
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
16
A DOWHILE loop is a leading-decision program loop.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
17
Any solution algorithm can be expressed using one or more of the three basic control structures.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
18
An accumulator always adds or accumulates by a constant amount.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
19
If the value input for START is 8,how many times will the instructions within the loop below be executed?
Read START
COUNT START
DOWHILE COUNT START COUNT COUNT - 1 Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Read START
COUNT START
DOWHILE COUNT START COUNT COUNT - 1 Write COUNT
ENDDO
A)0
B)1
C)8
D)infinite
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
20
What is the value of the variable ACCUM after the instructions corresponding to the following pseudocode are executed?
COUNT
DOWHILE
ENDDO
A)8
B)16
C)32
D)64
COUNT
DOWHILE
ENDDO
A)8
B)16
C)32
D)64
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
21
The steps after the loop are always placed on the line after ENDDO and are indented a few positions for clarity.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
22
In a counter-controlled loop,the value of the counter must be changed by some statement within the loop..
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
23
To create a properly formed DOWHILE loop you must place the loop steps in the YES path of the loop.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
24
A preparation symbol should be used in a program flowchart to initialize a counter prior to entering a loop.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
25
A counter used to control a loop can be either incremented or decremented.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
26
A connector symbol must be placed at the exit point of a DOWHILE loop just as it is placed at the exit point of an IFTHENELSE control structure.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
27
A READ statement used to input a header record must be placed within the loop that a value in the header record is controlling.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
28
To create a properly formed DOWHILE loop you must place the loop test after all other steps within the loop.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
29
The loop steps are placed between the DOWHILE statement and the ENDDO statement and are not indented.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
30
When header record logic is used in loop processing,the loop is controlled by a counter.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck