wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

LA5.C5: Branching and Subroutines

Total questions: 14

Worksheet time: 7mins

Name
Class
Date
1.

What is the purpose of the Goto statement in programming?

a)

To create a loop

b)

To jump to a specific label

c)

To end a program

d)

To define a variable

2.

What does a label in programming act like?

a)

A bookmark

b)

A variable

c)

A loop

d)

A function

3.

What is the output of the statement "i = i + 1" if i was initially 1?

a)

1

b)

0

c)

3

d)

2

4.

What happens if the value of i is less than 25 in the provided program?

a)

The program jumps to the start label

b)

The program continues to the next statement

c)

The program stops

d)

The program resets i to 0

5.

What is a subroutine?

a)

A method to end a program

b)

A way to create loops

c)

A type of variable

d)

A portion of code that can be called from anywhere

6.

How do you call a subroutine in the program?

a)

SubroutineName()

b)

Call SubroutineName

c)

Execute SubroutineName

d)

SubroutineName[]

7.

What is the advantage of using subroutines?

a)

They make programs run slower

b)

They are only used for loops

c)

They help in code organization

d)

They increase the amount of code

8.

What is the purpose of the FindMax subroutine?

a)

To sort a list of numbers

b)

To find the largest number between two inputs

c)

To calculate the average of two numbers

d)

To find the smallest number

9.

What does the DrawCircleUsingCenter subroutine do?

a)

Calculates the area of a circle

b)

Draws a circle using specified coordinates

c)

Changes the background color

d)

Draws a rectangle

10.

What is the output of the PrimeCheck subroutine if the input is 4?

a)

Not Prime

b)

False

c)

True

d)

Prime

11.

What is the purpose of the For loop in the PrimeCheck example?

a)

To repeat a block of code a fixed number of times

b)

To define a subroutine

c)

To create a new variable

d)

To end the program

12.

What is the initial value of isPrime in the PrimeCheck example?

a)

False

b)

1

c)

True

d)

0

13.

What should be at the top of a well-organized program?

a)

Subroutines

b)

Main program

c)

Variables

d)

Comments

14.

What does the Math.Remainder function do?

a)

Adds two numbers

b)

Calculates the square root

c)

Subtracts one number from another

d)

Finds the remainder of a division