wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

REVIEW Coding Fundamentals Unit 2: Basics of Coding

Total questions: 55

Worksheet time: 28mins

Name
Class
Date
1.

A statement is:

a)

a control structure.

b)

a one-word instruction that has assigned meaning.

c)

a sentence.

d)

all other elements of a command.

2.

A function:

a)

performs a specific task when called.

b)

is one line of code.

c)

is a selection control structure.

d)

repeats a sequence of commands.

3.

Which of the following is NOT a control structure used in coding?

a)

Repetition

b)

Sequential

c)

Selection

d)

Differential

4.

A function is useful because you write it once and call it as often as needed.

a)

True

b)

False

5.

A conditional statement is a statement

a)

is only executed when the code has been run more than one time.

b)

that allows the computer to choose between different paths in a program.

c)

that only appears when called and is then executed.

d)

that is only used when there are multiple conditions that must be met.

6.

What type of control structure is a conditional statement?

a)

Sequential

b)

Repetition

c)

Selection

d)

Differential

7.

An If/Else statement should be used when you want one of two sections of code to be executed.

a)

True

b)

False

8.

Which of the following are reasons control structures are used?

a)

To make code clear

b)

To make code easy for others to follow

c)

To save time

d)

All of the above

9.

A loop

a)

repeats a sequence of commands.

b)

is one line of code.

c)

is a selection

10.

What type of control structure is the default method of the computer reading code?

a)

Sequential

b)

Differential

c)

Selection

d)

Repetition

11.

A (a)   control structure is used to reduce the number of lines of code for an action that will need to be repeated many times.

Choose from the below words

Repetition

Differential

Selection

Sequential

12.

A nested loop is

a)

two loops run one after the other.

b)

with no relation to one another.

c)

a loop within a loop.

d)

a loop inside any other type of control structure.

13.

A selection control structure is used to choose between two or more alternative paths.

a)

True

b)

False

14.

How is a sequential control structure read?

a)

Only reads lines marked as significant; other lines are ignored

b)

In a circular, repetitive order

c)

In a linear, sequential order

15.

Which of the following are types of conditional statements?

a)

A) If and If/Else

b)

B) while and For

c)

C) For and If/Else

d)

D) If/Else and while

16.

Which loop is used for a specified number of times?

a)

A) For

b)

B) open

c)

C) while

d)

D) nested

17.

Which of the following describes the Test phase of the programming process?

a)

A) Identify and correct any errors.

b)

B) Determine the problem.

c)

C) Create a plan using algorithms and control structures.

d)

D) Write the code.

18.

Which of the following describes the Design phase of the programming process?

a)

Write the code.

b)

Create a plan using algorithms and control structures.

19.

Which of the following describes the Define phase of the programming process?

a)

Create a plan using algorithms and control structures.

b)

Write the code.

c)

Determine the problem.

d)

Identify and correct any errors.

20.

A command is

a)

an order you give to the computer verbally

b)

a one-word instruction that has been assigned meaning

c)

a sentence that provides information

d)

a word that is open for interpretation

21.

Which of the following is NOT a type of loop?

a)

open

b)

For

c)

while

d)

nested

22.

A repetition control structure executes code one time only.

a)

True

b)

False

23.

Which of the following is NOT one of the five steps of the programming process?

a)

Distribute

b)

Create a plan using algorithms and control structures.

c)

Identify and correct any errors.

d)

Determine the problem.

24.

How does the computer use a selection control structure to decide which path to follow?

a)

Randomly

b)

By guessing which requirements work best

c)

By repeating the code until a requirement is met

d)

By determining which requirements have been met

25.

Which type of loop only runs while a condition is true?

a)

nested

b)

open

c)

while

d)

For

26.

Define the term 'Command'.

a)

A one-word instruction that has been assigned meaning that is understood by the compiler or interpreter.

b)

A multi-word instruction that is not understood by the compiler or interpreter.

c)

A random sequence of words with no assigned meaning.

d)

A complex algorithm that requires human interpretation.

27.

What is the term for when the computer follows each line of code in order, from top to bottom?

a)

Sequential control structure

b)

Conditional control structure

c)

Loop control structure

d)

Event-driven control structure

28.

Define the term 'Selection control structure'. Used for decisions, such as choosing between two or more alternative paths.

a)

A type of loop structure

b)

A method for error handling

c)

A control structure for making decisions

d)

A data storage technique

29.

Repetition control structure is defined as:

a)

A structure that allows executing a set of instructions once

b)

A structure that allows executing a set of instructions multiple times

c)

A structure that allows executing a set of instructions based on a condition

d)

A structure that allows executing a set of instructions in a random order

30.

Why should you use control structures?

a)

To improve code readability and maintainability

b)

To increase the execution time of a program

c)

To make the code more complex

d)

To avoid using functions

31.

What are the three basic types of control structures?

a)

Sequence, Selection, Iteration

b)

Input, Output, Processing

c)

Data, Control, Logic

d)

Variable, Constant, Function

32.

What does it mean that the sequential control structure is the default?

a)

It means that this is the structure the compiler and interpreter will automatically follow.

b)

It means that instructions are executed in reverse order.

c)

It means that instructions are executed randomly.

d)

It means that instructions are executed based on user input.

33.

How does the computer decide which path to follow in a selection control structure?

a)

By evaluating a condition

b)

By random choice

c)

By user input

d)

By following a fixed sequence

34.

How can a repetition control structure be useful?

a)

It allows for the execution of a set of instructions multiple times.

b)

It helps in defining variables.

c)

It is used for conditional execution of code.

d)

It is used for error handling in programs.

35.

Which of the following is NOT one of the 5 steps in the programming process?

a)

Defining the problem

b)

Designing the solution

c)

Coding the solution

d)

Testing the solution

e)

Marketing the solution

36.

Define the term 'Loop'.

a)

A loop repeats a sequence of commands.

b)

A loop is a type of data structure.

c)

A loop is a method of sorting data.

d)

A loop is a way to store data permanently.

37.

Define the term 'For loop'.

a)

A control structure for specifying repetition.

b)

A data structure for storing elements.

c)

A function for handling exceptions.

d)

A method for sorting arrays.

38.

Define the term 'Function'.

a)

A named section of the program that performs a specific task when called.

b)

A random piece of code that does not perform any specific task.

c)

A variable that stores data temporarily.

d)

A type of loop that iterates over a sequence.

39.

Define the term 'While loop'.

a)

A loop that runs while a condition is true.

b)

A loop that runs a fixed number of times.

c)

A loop that runs only once.

d)

A loop that runs until a condition becomes true.

40.

Define the term 'Nested loop'.

a)

A loop within a loop.

b)

A loop that runs indefinitely.

c)

A loop that executes only once.

d)

A loop that runs in reverse order.

41.

Which of the following is an example of an everyday task with steps that repeat?

a)

Brushing teeth

b)

Reading a book

c)

Watching a movie

d)

Going on a vacation

42.

When is a loop used?

a)

A loop is used when the same commands need to be used again and again.

b)

A loop is used to store data permanently.

c)

A loop is used to connect to the internet.

d)

A loop is used to format a hard drive.

43.

What are some of the benefits of using a loop?

a)

It saves time for the programmer, reduces number of lines of code needed, keeps the code clean and to the point.

b)

It makes the code run slower and more complex.

c)

It increases the chances of errors in the code.

d)

It requires more memory to execute.

44.

When is a For loop used?

a)

Typically, when the specific number of times the loop needs to be performed is known.

b)

When the loop needs to run indefinitely until a condition is met.

c)

When you need to iterate over a collection without knowing the number of elements.

d)

When you want to execute a block of code only once.

45.

How will using a loop help?

a)

A loop will help Mrs. Maloney save time when entering orders.

b)

A loop will make the computer run faster.

c)

A loop will reduce the number of errors in the code.

d)

A loop will allow Mrs. Maloney to enter orders in multiple languages.

46.

What must you include when coding a loop?

a)

A condition to terminate the loop

b)

A function call

c)

A print statement

d)

A variable declaration

47.

Functions are useful because they:

a)

Allow code reuse and organization

b)

Increase code complexity

c)

Make debugging harder

d)

Reduce code readability

48.

Which of the following is an example of a while statement used in everyday life?

a)

While dishes are in sink, load dishwasher.

b)

While watching TV, read a book.

c)

While driving, close your eyes.

d)

While sleeping, go for a run.

49.

Explain how a nested loop operates.

a)

The inner loop runs once for each pass of the outer loop.

b)

The inner loop runs multiple times for each pass of the outer loop.

c)

The outer loop runs once for each pass of the inner loop.

d)

The outer loop runs multiple times for each pass of the inner loop.

50.

Which of the following best defines a conditional statement?

a)

A statement that is always true

b)

A statement that executes based on a condition

c)

A statement that repeats a block of code

d)

A statement that defines a variable

51.

What type of control structure is a conditional statement?

a)

Loop

b)

Conditional

c)

Sequential

d)

Iterative

52.

Conditional statements are used when:

a)

you want to repeat a block of code multiple times

b)

you need to make decisions based on certain conditions

c)

you want to store multiple values in a single variable

d)

you need to define a function

53.

An If statement is used when:

a)

You need to repeat a block of code multiple times.

b)

You want to execute a block of code only if a certain condition is true.

c)

You need to define a function.

d)

You want to store multiple values in a single variable.

54.

Mrs. Maloney wants one of two sauces put on the pizza, based on the customer's order. How will using an If statement help Mrs. Maloney?

a)

It allows her to choose a sauce randomly.

b)

It helps her decide which sauce to use based on the order.

c)

It ensures both sauces are used on every pizza.

d)

It prevents any sauce from being used.

55.

When should an If/Else statement be used?

a)

To execute a block of code based on a condition

b)

To repeat a block of code multiple times

c)

To define a function

d)

To declare a variable