Deck 3: Ifthenelse Control Structure
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 3: Ifthenelse Control Structure
1
A diamond shape symbol on a program flowchart represents a decision to be made.
True
2
The keyword ELSE is not needed when writing the pseudcode of a null ELSE.
False
3
If the variable named ANSWER has a value of 1,what will be output after the instructions corresponding to the following pseudocode are executed?
IF ANSWER Write "Hello"
(ELSE)
IF ANSWER THEN
Write "Goodbye"
ELSE
Write "Good day",
ENDIF
A)Hello
B)Goodbye
C)Good day
D)both a and c
IF ANSWER Write "Hello"
(ELSE)
IF ANSWER THEN
Write "Goodbye"
ELSE
Write "Good day",
ENDIF
A)Hello
B)Goodbye
C)Good day
D)both a and c
both a and c
4
Which of the following terms is an example of a character-string constant?
A)123
B)ABC
C)GRADE
D)none of the above
A)123
B)ABC
C)GRADE
D)none of the above
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
5
Which program flowcharting symbol is used as a collector,emphasizing the single exit point of an IFTHEN control structure?
A)decision
B)connector
C)terminal interrupt
D)process
A)decision
B)connector
C)terminal interrupt
D)process
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
6
An algorithm can be expressed by the use of an informal language called
A)BASIC
B)Visual Basic
C)pseudocode
D)flowcharting
A)BASIC
B)Visual Basic
C)pseudocode
D)flowcharting
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
7
If the variable named AVG has a value of 73,what is the value of GRADE after the instructions corresponding to the following pseudocode are executed?
IF
GRADE "A"
ELSE
GRADE "B"
ENDIF
IF THEN
GRADE "C"
ELSE
GRADE "F"
ENDIF
A)A
B)B
C)C
D)F
IF
GRADE "A"
ELSE
GRADE "B"
ENDIF
IF THEN
GRADE "C"
ELSE
GRADE "F"
ENDIF
A)A
B)B
C)C
D)F
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
8
If the variable named AVG has a value of 93,what is the value of GRADE after the instructions corresponding to the following pseudocode are executed?
IF THEN
GRADE = "A"
ELSE
IF THEN
ELSE
ENDIF
ENDIF
A)A
B)B
C)C
D)F
IF THEN
GRADE = "A"
ELSE
IF THEN
ELSE
ENDIF
ENDIF
A)A
B)B
C)C
D)F
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
9
Which program flowcharting symbol is used to indicate a choice between two alternative paths?
A)process
B)general input/output
C)terminal interrupt
D)decision
A)process
B)general input/output
C)terminal interrupt
D)decision
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
10
If the variable named AVG has a value of 73,what is the value of GRADE after the instructions corresponding to the following pseudocode are executed?
IF AVG THEN
GRADE = "A"
ELSE
IF THEN
GRADE = "B"
ELSE
GRADE = "P"
ENDIF
ENDIF
A)A
B)B
C)P
D)none of the above
IF AVG THEN
GRADE = "A"
ELSE
IF THEN
GRADE = "B"
ELSE
GRADE = "P"
ENDIF
ENDIF
A)A
B)B
C)P
D)none of the above
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
11
The no-function condition is usually called a null ELSE.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
12
If the variable named ANSWER has a value of 1,what will be output after the instructions corresponding to the following pseudocode are executed?
IF ANSWER THEN
Write "Hello"
ELSE
IF ANSWER THEN
Write "Goodbye"
ELSE
Write "Good day"
ENDIF
ENDIF
A)Hello
B)Goodbye
C)Good day
D)both a and c
IF ANSWER THEN
Write "Hello"
ELSE
IF ANSWER THEN
Write "Goodbye"
ELSE
Write "Good day"
ENDIF
ENDIF
A)Hello
B)Goodbye
C)Good day
D)both a and c
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
13
If no special alternative action is required when the condition tested in an IFTHENELSE pattern is false,we refer to this as a
A)null ELSE
B)IFTHENELSE
C)conditional branch
D)nested pattern
A)null ELSE
B)IFTHENELSE
C)conditional branch
D)nested pattern
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
14
The following pseudocode
IF AVG THEN GRADE = "A" ELSE
GRADE = "B"
ENDIF
IF THEN
GRADE " ",
ELSE
GRADE = "F "
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
IF AVG THEN GRADE = "A" ELSE
GRADE = "B"
ENDIF
IF THEN
GRADE " ",
ELSE
GRADE = "F "
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
15
In a nested IFTHENELSE pattern,all the tests are always made,one after the other.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
16
In a sequential IFTHENELSE pattern,whether tests after the first one are made depends upon the outcome of the preceding tests.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
17
The following pseudocode
IF AVG THEN
GRADE "A"
ELSE
IF THEN
GRADE "B"
ELSE
GRADE "P"
ENDIF
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
IF AVG THEN
GRADE "A"
ELSE
IF THEN
GRADE "B"
ELSE
GRADE "P"
ENDIF
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
18
The following pseudocode
IF AVG THEN GRADE "A"
(ELSE)
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
IF AVG THEN GRADE "A"
(ELSE)
ENDIF
Represents a
A)sequential IFTHENELSE pattern
B)nested IFTHENELSE pattern
C)null IFTHENELSE pattern
D)simple IFTHENELSE pattern
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
19
If the variable named AVG has a value of 93,what is the value of GRADE after the instructions corresponding to the following pseudocode are executed?
IF
ENDIF
IF
GRADE " ",
ELSE
GRADE = "F"'
ENDIF
A)A
B)B
C)C
D)F
IF
ENDIF
IF
GRADE " ",
ELSE
GRADE = "F"'
ENDIF
A)A
B)B
C)C
D)F
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
20
If the variable named GRADE has a value of 95,which of the following statements will cause the line
95 is above average
To be output?
A)Write "GRADE is above average"
B)Write GRADE is above average
C)Write GRADE,"is above average"
D)Write "GRADE,is above average"
95 is above average
To be output?
A)Write "GRADE is above average"
B)Write GRADE is above average
C)Write GRADE,"is above average"
D)Write "GRADE,is above average"
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
21
A connector symbol is placed at the entry point of an IFTHENELSE control structure.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
22
The value of a character-string constant is usually enclosed in either single or double quotes.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
23
Indentation is used in pseudocode to improve readability.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
24
A nested IFTHENELSE pattern cannot contain a null ELSE.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
25
The decision point in an IFTHENELSE statement is called an unconditional branch.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
26
Pseudocode is a graphic depiction of an algorithm.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
27
The statements Write A and Write "A" will always produce the same output.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
28
Pseudocode may be a more suitable tool than flowcharting when working on complex problems.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
29
In a nested IFTHENELSE pattern,it is probable that many of the tests will be skipped.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck
30
There is no ANSI-approved standard for pseudocode.
Unlock Deck
Unlock for access to all 30 flashcards in this deck.
Unlock Deck
k this deck