wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Programming Logic and Design Chapter 3 - Understanding Structure

Total questions: 35

Worksheet time: 35mins

Name
Class
Date
1.

What is spaghetti code in programming?

a)

Code that uses extensive comments for better understanding

b)

Code with a clear and well-organized structure

c)

Code that is poorly structured and difficult to follow

d)

Code written using the spaghetti design pattern

2.

What are the three types of control structure?

a)

sequence, order, and process

b)

selection, loop, and iteration

c)

sequence, selection, and loop

d)

if, else, and then

3.

What is the difference between a flowchart and pseudocode?

a)

A flowchart is diagramatic whilst pseudocode is written in a programming language (eg. Pascal or Java)

b)

A flowchart is textual but pseudocode is diagrammatic

c)

A flowchart is a diagrammatic description of an algorithm whilst pseudocode is a textual description of an algorithm

d)

A flowchart and pseudocode are the same thing

4.

What structure is depicted in this flowchart?

a)

sequence

b)

loop

c)

selection

d)

case

5.

The given image is a representation of what structure?

a)

sequence

b)

selection

c)

case

d)

loop

6.

What is the purpose of this symbol in creating program flowcharts?

a)

It evaluates a condition to determine the which action to take.

b)

It signals the beginning and the end of the program.

c)

It evaluates arithmetic operations.

d)

It declares the variables used in the program.

7.

What is the primary purpose of the "sequence" structure in programming logic?

a)

To execute statements in a specific order, one after another

b)

To make decisions based on conditions

c)

To repeat a block of code a specific number of times

d)

To define reusable and modular code components

8.

Which of the following is not another term

for a selection structure?

a)

decision structure

b)

if-then-else structure

c)

dual-alternative if structure

d)

loop structure

9.

Which type of statement is an example of a selection programming structure?

a)

If/else

b)

do while

c)

while

d)

for

10.

What is the purpose of this symbol in creating program flowcharts?

a)

It evaluates a condition to determine the which action to take.

b)

It signals the beginning and the end of the program.

c)

It connects symbols and directs the flow of data in the program.

d)

It is used in accepting inputs or generating outputs in the program

11.

What is the main purpose of the "selection" structure in programming?

a)

To execute a series of statements in a specific order

b)

To repeat a block of code a specific number of times

c)

To make decisions and choose different paths based on conditions

d)

To define reusable and modular code components

12.

How does the "sequence" structure differ
from the "selection" structure in programming?

a)

Sequence executes code in a specific order, while selection involves making decisions based on conditions.

b)

Sequence and selection are identical and can be used interchangeably.

c)

Sequence is used for repeating code, while selection involves executing statements in order.

d)

Sequence is used for making decisions, while selection involves executing code in a specific order.

13.

What is the primary purpose of the "loop" structure in programming?

a)

To execute a block of code once

b)

To organize code into a specific order

c)

To repeat a block of code until a certain condition is met

d)

To choose between different paths based on conditions

14.

Which programming construct is commonly
used to implement a dual-alternative selection?

a)

if-else statement

b)

switch statement

c)

while loop

d)

for loop

15.

To repeat a task number of times, we use

a)

input statement

b)

loop statement

c)

conditional statement

d)

output statement

16.

In a dual-alternative selection,

what is the role of the "else" part?

a)

To handle multiple conditions

b)

To repeat a block of code a specific number of times

c)

To execute statements inside the if block when the condition is true

d)

To provide an alternative set of statements when the condition is false

17.

The act of placing one structure inside another is referred to as ________ the structures.

a)

stacking

b)

untangling

c)

building

d)

nesting

18.

A loop statement is also known as an iterative statement.

a)

True

b)

False

19.

What type of flowchart is shown here?

a)

sequence

b)

loop

c)

dual-alternative selection

d)

single-alternative selection

20.

What will be displayed as output?

a)

10

b)

20

c)

30

d)

40

21.

What type of flowchart is shown here?

a)

sequence

b)

loop

c)

dual-alternative selection

d)

single-alternative selection

22.

What is the Output if the temperature is: 19

a)

Below Freezing

b)

Above Freezing

23.

This is an example of which type of control structure?

a)

selection

b)

loop

c)

sequence

d)

condition

24.

A group of statements that executes as a single unit is known as a _______.

a)

block

b)

family

c)

chunk

d)

cohort

25.

In a selection structure, the structure-controlling

question is __________.

a)

asked once at the beginning of the structure

b)

asked once at the end of the structure

c)

asked repeatedly until it is false

d)

asked repeatedly until it is true

26.

Which of the following is not a reason for enforcing

structure rules in computer programs?

a)

Structured programs are clearer to understand than

unstructured ones.

b)

Other professional programmers will expect programs to

be structured.

c)

Structured programs usually are shorter than unstructured

ones.

d)

Structured programs can be broken down into modules

easily.

27.

Which of the following is not a benefit

of modularizing programs?

a)

Modular programs are easier to read and understand than

nonmodular ones.

b)

If you use modules, you can ignore the rules of structure.

c)

Modular components are reusable in other programs.

d)

Multiple programmers can work on different modules at

the same time.

28.

Which of the following is true of structured logic?

a)

You can use structured logic with newer programming

languages, such as Java and C#, but not with older

ones.

b)

Any task can be described using some combination of the

three structures.

c)

Structured programs require that you break the code into

easy-to-handle modules that each contain no more than

five actions.

d)

All of these are true.

29.

A structure that allows the user to perform a

sequence of process/es to be executed repeatedly.

a)

Conditional

b)

Sequential

c)

Loop

d)

All of the mentioned

30.

The three structures (sequence, selection and loop)

cannot be combined in a single program.

a)

True

b)

False

31.

Which control structure will execute an instruction only after the

computer evaluates conditions to determine if a certain condition exists?

a)

Selection

b)

Loop

c)

Functional

d)

Sequence

32.

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?

a)

Decision (Selection)

b)

Order (Sequence)

c)

Loop (Iteration)

d)

All of the choices

33.

Which tool used to plan computer programs is an

English-like representation of the program steps?

a)

debugging

b)

assembly

c)

flowchart

d)

pseudocode

34.

A condition is

a)

a statement that is either True or False

b)

an integer

c)

a string

d)

a list

35.

What is the Output if the user enters:
YES

a)

Leave umbrella at home

b)

Take an umbrella