WorksheetsProgramming Logic and Design Chapter 3 - Understanding Structure
Total questions: 35
Worksheet time: 35mins
What is spaghetti code in programming?
Code that uses extensive comments for better understanding
Code with a clear and well-organized structure
Code that is poorly structured and difficult to follow
Code written using the spaghetti design pattern
What are the three types of control structure?
sequence, order, and process
selection, loop, and iteration
sequence, selection, and loop
if, else, and then
What is the difference between a flowchart and pseudocode?
A flowchart is diagramatic whilst pseudocode is written in a programming language (eg. Pascal or Java)
A flowchart is textual but pseudocode is diagrammatic
A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a textual description of an algorithm
A flowchart and pseudocode are the same thing
What structure is depicted in this flowchart?
sequence
loop
selection
case
The given image is a representation of what structure?
sequence
selection
case
loop
What is the purpose of this symbol in creating program flowcharts?
It evaluates a condition to determine the which action to take.
It signals the beginning and the end of the program.
It evaluates arithmetic operations.
It declares the variables used in the program.
What is the primary purpose of the "sequence" structure in programming logic?
To execute statements in a specific order, one after another
To make decisions based on conditions
To repeat a block of code a specific number of times
To define reusable and modular code components
Which of the following is not another term
for a selection structure?
decision structure
if-then-else structure
dual-alternative if structure
loop structure
Which type of statement is an example of a selection programming structure?
If/else
do while
while
for
What is the purpose of this symbol in creating program flowcharts?
It evaluates a condition to determine the which action to take.
It signals the beginning and the end of the program.
It connects symbols and directs the flow of data in the program.
It is used in accepting inputs or generating outputs in the program
What is the main purpose of the "selection" structure in programming?
To execute a series of statements in a specific order
To repeat a block of code a specific number of times
To make decisions and choose different paths based on conditions
To define reusable and modular code components
How does the "sequence" structure differ
from the "selection" structure in programming?
Sequence executes code in a specific order, while selection involves making decisions based on conditions.
Sequence and selection are identical and can be used interchangeably.
Sequence is used for repeating code, while selection involves executing statements in order.
Sequence is used for making decisions, while selection involves executing code in a specific order.
What is the primary purpose of the "loop" structure in programming?
To execute a block of code once
To organize code into a specific order
To repeat a block of code until a certain condition is met
To choose between different paths based on conditions
Which programming construct is commonly
used to implement a dual-alternative selection?
if-else statement
switch statement
while loop
for loop
To repeat a task number of times, we use
input statement
loop statement
conditional statement
output statement
In a dual-alternative selection,
what is the role of the "else" part?
To handle multiple conditions
To repeat a block of code a specific number of times
To execute statements inside the if block when the condition is true
To provide an alternative set of statements when the condition is false
The act of placing one structure inside another is referred to as ________ the structures.
stacking
untangling
building
nesting
A loop statement is also known as an iterative statement.
True
False
What type of flowchart is shown here?
sequence
loop
dual-alternative selection
single-alternative selection
What will be displayed as output?
10
20
30
40
What type of flowchart is shown here?
sequence
loop
dual-alternative selection
single-alternative selection
What is the Output if the temperature is: 19
Below Freezing
Above Freezing
This is an example of which type of control structure?
selection
loop
sequence
condition
A group of statements that executes as a single unit is known as a _______.
block
family
chunk
cohort
In a selection structure, the structure-controlling
question is __________.
asked once at the beginning of the structure
asked once at the end of the structure
asked repeatedly until it is false
asked repeatedly until it is true
Which of the following is not a reason for enforcing
structure rules in computer programs?
Structured programs are clearer to understand than
unstructured ones.
Other professional programmers will expect programs to
be structured.
Structured programs usually are shorter than unstructured
ones.
Structured programs can be broken down into modules
easily.
Which of the following is not a benefit
of modularizing programs?
Modular programs are easier to read and understand than
nonmodular ones.
If you use modules, you can ignore the rules of structure.
Modular components are reusable in other programs.
Multiple programmers can work on different modules at
the same time.
Which of the following is true of structured logic?
You can use structured logic with newer programming
languages, such as Java and C#, but not with older
ones.
Any task can be described using some combination of the
three structures.
Structured programs require that you break the code into
easy-to-handle modules that each contain no more than
five actions.
All of these are true.
A structure that allows the user to perform a
sequence of process/es to be executed repeatedly.
Conditional
Sequential
Loop
All of the mentioned
The three structures (sequence, selection and loop)
cannot be combined in a single program.
True
False
Which control structure will execute an instruction only after the
computer evaluates conditions to determine if a certain condition exists?
Selection
Loop
Functional
Sequence
An Algorithm asks the user to enter their gender (M or F) and prints out a different comment depending on what they entered.
This is an example of which of the algorithm constructs?
Decision (Selection)
Order (Sequence)
Loop (Iteration)
All of the choices
Which tool used to plan computer programs is an
English-like representation of the program steps?
debugging
assembly
flowchart
pseudocode
A condition is
a statement that is either True or False
an integer
a string
a list
What is the Output if the user enters:
YES
Leave umbrella at home
Take an umbrella
