Deck 4: The Sequence Structure

Full screen (f)
exit full mode
Question
An advantage of structured programming is that it works well with the concept of modular programming.
Use Space or
up arrow
down arrow
to flip the card.
Question
An advantage of structured programming is that structures can be pulled out of programs and inserted into other programs without adversely affecting the flow of the surrounding code.
Question
Structured programming is most often characterized by the GOTO statement, common in early line-number BASIC programs.
Question
Structures are easy to find and change: They have one entry point and one exit point-a clear beginning and end.
Question
Procedural programming is widely accepted as the most efficient method of program development, resulting in faster development, reusable code, easier maintenance, and fewer errors.
Question
When code is not written by using modules, it is difficult to know what effect changing a line of code will have on surrounding statements.
Question
Structured programming is commonly called "spaghetti code."
Question
The "stored programming" concept developed by John von Neumann states that any program can be written by using only sequence, selection, and repetition structures.
Question
The following is an example of a nonstructured program:
100 PRINT "Enter a number (or 0 to quit): "
110 INPUT N
120 WHILE N <> 0
120 \quad IF N < 0 THEN PRINT "Your number is negative."
130 \quad IF N > 0 THEN PRINT "Your number is positive."
140 \quad PRINT "Enter a number (or 0 to quit): "
150 \quad INPUT N
160 END WHILE
200 PRINT "Thank you!"
Question
Statements in a sequence structure are performed without any conditions.
Question
On a flowchart, a variable declaration is considered a process, so it is placed in a parallelogram.
Question
On a flowchart, symbols are connected by flowlines that indicate the order of processing.
Question
Flowcharts can be drawn to move from top to bottom or from left to right, whichever fits the page better.
Question
Modules (which include methods and functions) are sections of programming code, and as a result, they are made up of sequence, selection, and repetition structures, just as other program code is.
Question
The computer always processes comments.
Question
Comments are included in programs to aid the programmer.
Question
Every time a module is called, the computer suspends execution of the main program, runs the module, and then returns to the next statement in the main program.
Question
Modules are represented by rectangles with stripes.
Question
Modular programming helps keep your main program uncluttered and easy to understand.
Question
Right-brained people tend to favor pseudocode as a method of developing algorithms for programs
Question
Left-brained people tend to favor flowcharts as a method of developing algorithms for programs.
Question
"Accessor" methods are also called "get" methods.
Question
Methods that assign values to class variables are called "accessor" methods.
Question
Class methods that return values to the calling module are called "mutator" methods.
Question
"Mutator" methods are also called "set" methods.
Question
____ is a way of designing, writing, and modifying programs that focuses on this core concept: Use only the three recognized control structures-sequence, selection, and repetition.

A) Procedural programming
B) Structured programming
C) Object oriented programming
D) Nonstructured programming
Question
A ____ structure consists of one or more statements performed in order with no variation.

A) selection
B) sequence
C) repetition
D) nested
Question
The ____ structure evaluates a logical condition, one that's true or false, then performs one or more statements (or ignores those statements), based on the evaluation of this condition.

A) selection
B) sequence
C) repetition
D) nested
Question
A ____ structure evaluates a logical condition and performs or ignores one or more statements based on the evaluation.

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"Go to the grocery store. Buy milk and eggs. Get gas in the car on the way home."

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"Deposit $100 into savings every week, as long as your balance is below $1000."

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"If it's raining outside, take an umbrella."

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"For one week, you will pay $3 for a subway ticket. After that, you will receive a discount."

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"If the baby gets sick, take her to the hospital."

A) selection
B) sequence
C) repetition
D) nested
Question
The following statement is an example of a(n) ____ structure.
"Do your homework, then watch t.v."

A) selection
B) sequence
C) repetition
D) nested
Question
A common example used for a sequence structure is the ______ part of a recipe.

A) ingredient list
B) preparation time
C) instruction
D) optional
Question
Which of the following correctly converts the algorithm below to JavaScript? (Assume that constants for an empty string (ES) and the line break tag (BR) have been declared.)
Display "Enter your full name: "
Input fullName
Display "Enter your age in years: "
Input age
Display "Hi, " + fullName
Display "You are " + age + " years old."

A) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);

B) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document("Hi, " + fullName + BR);
Document("You are " + age + "years old." + BR);

C) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document.write("Hi, " + fullName + BR);

D) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document.write("Hi, " + fullName + BR);
Document.write("You are " + age + "years old." + BR);
Question
On a flowchart, ____ mark the beginning and ending of the flowchart.

A) terminal symbols
B) process symbols
C) input/output symbols
D) module symbols
Question
On a flowchart, ____ are used for variable declarations or assignment statements.

A) terminal symbols
B) process symbols
C) module symbols
D) input/output symbols
Question
On a flowchart, ____ are used for display statements, prompts, and input statements.

A) terminal symbols
B) process symbols
C) module symbols
D) input/output symbols
Question
On a flowchart, ____ are used for connecting other symbols.

A) terminal symbols
B) process symbols
C) module symbols
D) flow lines
Question
On a flowchart, ____ are used for comments.

A) terminal symbols
B) process symbols
C) annotation boxes
D) flow lines
Question
On a flowchart, the Start and Stop keywords, used to indicate the beginning and end of a pseudocode program, are represented by ____.

A) rectangles
B) annotation boxes
C) parallelograms
D) terminal symbols
Question
In the algorithm below, adding 10 years to the age variable and storing the result in the newAge variable is an assignment statement, so on a flowchart, it is placed in a(n) ____.
Start
// Declare variables
Declare Numeric age, newAge
// Get user's age
Display "Please enter your age: "
Input age
// Compute age in 10 years
NewAge = age + 10
// Display new age
Display "In 10 years, you will be " + newAge
Stop

A) rectangle
B) parallelogram
C) terminal symbol
D) annotation box
Question
In the algorithm below, the Display statement for the result is considered output, so on a flowchart, it is placed in a ____.
Start
// Declare variables
Declare Numeric age, newAge
// Get user's age
Display "Please enter your age: "
Input age
// Compute age in 10 years
NewAge = age + 10
// Display new age
Display "In 10 years, you will be " + newAge
Stop

A) rectangle
B) parallelogram
C) terminal symbol
D) annotation box
Question
On a flowchart, assignment statements appear in ____.

A) rectangles
B) parallelograms
C) terminal symbols
D) annotation boxes
Question
Look at the following pseudoocode and insert the missing statement:
Start
// Declare variables
Declare String lastName, firstName, fullName
// Input last and first names
Display "Enter your last name: "
Input lastName
Display "Enter your first name: "
Input firstName
// Concatenate names with space in between
____
// Display full name
Display "Your full name is " + fullName
Stop

A) fullName = firstName + lastName
B) fullName = firstName + " " + lastName
C) fullName = firstName, lastName
D) fullName = firstName, space, lastName
Question
The JavaScript equivalent of the pseudocode Input is ____.

A) var
B) document.write()
C) new
D) prompt()
Question
The JavaScript equivalent of the pseudocode Declare is ____.

A) var
B) document.write()
C) new
D) prompt()
Question
The JavaScript equivalent of the pseudocode Display is ____.

A) var
B) document.write()
C) new
D) prompt()
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 4: The Sequence Structure
1
An advantage of structured programming is that it works well with the concept of modular programming.
True
2
An advantage of structured programming is that structures can be pulled out of programs and inserted into other programs without adversely affecting the flow of the surrounding code.
True
3
Structured programming is most often characterized by the GOTO statement, common in early line-number BASIC programs.
False
4
Structures are easy to find and change: They have one entry point and one exit point-a clear beginning and end.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
Procedural programming is widely accepted as the most efficient method of program development, resulting in faster development, reusable code, easier maintenance, and fewer errors.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
When code is not written by using modules, it is difficult to know what effect changing a line of code will have on surrounding statements.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Structured programming is commonly called "spaghetti code."
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
The "stored programming" concept developed by John von Neumann states that any program can be written by using only sequence, selection, and repetition structures.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
The following is an example of a nonstructured program:
100 PRINT "Enter a number (or 0 to quit): "
110 INPUT N
120 WHILE N <> 0
120 \quad IF N < 0 THEN PRINT "Your number is negative."
130 \quad IF N > 0 THEN PRINT "Your number is positive."
140 \quad PRINT "Enter a number (or 0 to quit): "
150 \quad INPUT N
160 END WHILE
200 PRINT "Thank you!"
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
Statements in a sequence structure are performed without any conditions.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
On a flowchart, a variable declaration is considered a process, so it is placed in a parallelogram.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
On a flowchart, symbols are connected by flowlines that indicate the order of processing.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Flowcharts can be drawn to move from top to bottom or from left to right, whichever fits the page better.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Modules (which include methods and functions) are sections of programming code, and as a result, they are made up of sequence, selection, and repetition structures, just as other program code is.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
The computer always processes comments.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
Comments are included in programs to aid the programmer.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
Every time a module is called, the computer suspends execution of the main program, runs the module, and then returns to the next statement in the main program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
Modules are represented by rectangles with stripes.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
Modular programming helps keep your main program uncluttered and easy to understand.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
Right-brained people tend to favor pseudocode as a method of developing algorithms for programs
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Left-brained people tend to favor flowcharts as a method of developing algorithms for programs.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
"Accessor" methods are also called "get" methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
Methods that assign values to class variables are called "accessor" methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Class methods that return values to the calling module are called "mutator" methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
"Mutator" methods are also called "set" methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
____ is a way of designing, writing, and modifying programs that focuses on this core concept: Use only the three recognized control structures-sequence, selection, and repetition.

A) Procedural programming
B) Structured programming
C) Object oriented programming
D) Nonstructured programming
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
A ____ structure consists of one or more statements performed in order with no variation.

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ structure evaluates a logical condition, one that's true or false, then performs one or more statements (or ignores those statements), based on the evaluation of this condition.

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
A ____ structure evaluates a logical condition and performs or ignores one or more statements based on the evaluation.

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
The following statement is an example of a(n) ____ structure.
"Go to the grocery store. Buy milk and eggs. Get gas in the car on the way home."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
The following statement is an example of a(n) ____ structure.
"Deposit $100 into savings every week, as long as your balance is below $1000."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
The following statement is an example of a(n) ____ structure.
"If it's raining outside, take an umbrella."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
The following statement is an example of a(n) ____ structure.
"For one week, you will pay $3 for a subway ticket. After that, you will receive a discount."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
The following statement is an example of a(n) ____ structure.
"If the baby gets sick, take her to the hospital."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The following statement is an example of a(n) ____ structure.
"Do your homework, then watch t.v."

A) selection
B) sequence
C) repetition
D) nested
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
A common example used for a sequence structure is the ______ part of a recipe.

A) ingredient list
B) preparation time
C) instruction
D) optional
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following correctly converts the algorithm below to JavaScript? (Assume that constants for an empty string (ES) and the line break tag (BR) have been declared.)
Display "Enter your full name: "
Input fullName
Display "Enter your age in years: "
Input age
Display "Hi, " + fullName
Display "You are " + age + " years old."

A) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);

B) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document("Hi, " + fullName + BR);
Document("You are " + age + "years old." + BR);

C) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document.write("Hi, " + fullName + BR);

D) fullName = prompt("Enter your full name:",ES);
Age = prompt("Enter your age in years:",ES);
Document.write("Hi, " + fullName + BR);
Document.write("You are " + age + "years old." + BR);
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
On a flowchart, ____ mark the beginning and ending of the flowchart.

A) terminal symbols
B) process symbols
C) input/output symbols
D) module symbols
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
On a flowchart, ____ are used for variable declarations or assignment statements.

A) terminal symbols
B) process symbols
C) module symbols
D) input/output symbols
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
On a flowchart, ____ are used for display statements, prompts, and input statements.

A) terminal symbols
B) process symbols
C) module symbols
D) input/output symbols
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
On a flowchart, ____ are used for connecting other symbols.

A) terminal symbols
B) process symbols
C) module symbols
D) flow lines
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
On a flowchart, ____ are used for comments.

A) terminal symbols
B) process symbols
C) annotation boxes
D) flow lines
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
On a flowchart, the Start and Stop keywords, used to indicate the beginning and end of a pseudocode program, are represented by ____.

A) rectangles
B) annotation boxes
C) parallelograms
D) terminal symbols
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
In the algorithm below, adding 10 years to the age variable and storing the result in the newAge variable is an assignment statement, so on a flowchart, it is placed in a(n) ____.
Start
// Declare variables
Declare Numeric age, newAge
// Get user's age
Display "Please enter your age: "
Input age
// Compute age in 10 years
NewAge = age + 10
// Display new age
Display "In 10 years, you will be " + newAge
Stop

A) rectangle
B) parallelogram
C) terminal symbol
D) annotation box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
In the algorithm below, the Display statement for the result is considered output, so on a flowchart, it is placed in a ____.
Start
// Declare variables
Declare Numeric age, newAge
// Get user's age
Display "Please enter your age: "
Input age
// Compute age in 10 years
NewAge = age + 10
// Display new age
Display "In 10 years, you will be " + newAge
Stop

A) rectangle
B) parallelogram
C) terminal symbol
D) annotation box
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
On a flowchart, assignment statements appear in ____.

A) rectangles
B) parallelograms
C) terminal symbols
D) annotation boxes
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
Look at the following pseudoocode and insert the missing statement:
Start
// Declare variables
Declare String lastName, firstName, fullName
// Input last and first names
Display "Enter your last name: "
Input lastName
Display "Enter your first name: "
Input firstName
// Concatenate names with space in between
____
// Display full name
Display "Your full name is " + fullName
Stop

A) fullName = firstName + lastName
B) fullName = firstName + " " + lastName
C) fullName = firstName, lastName
D) fullName = firstName, space, lastName
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
The JavaScript equivalent of the pseudocode Input is ____.

A) var
B) document.write()
C) new
D) prompt()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The JavaScript equivalent of the pseudocode Declare is ____.

A) var
B) document.write()
C) new
D) prompt()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
The JavaScript equivalent of the pseudocode Display is ____.

A) var
B) document.write()
C) new
D) prompt()
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.