NEW
Font size
WorksheetsLA5.C5: Branching and Subroutines
Total questions: 14
Worksheet time: 7mins
What is the purpose of the Goto statement in programming?
To create a loop
To jump to a specific label
To end a program
To define a variable
What does a label in programming act like?
A bookmark
A variable
A loop
A function
What is the output of the statement "i = i + 1" if i was initially 1?
1
0
3
2
What happens if the value of i is less than 25 in the provided program?
The program jumps to the start label
The program continues to the next statement
The program stops
The program resets i to 0
What is a subroutine?
A method to end a program
A way to create loops
A type of variable
A portion of code that can be called from anywhere
How do you call a subroutine in the program?
SubroutineName()
Call SubroutineName
Execute SubroutineName
SubroutineName[]
What is the advantage of using subroutines?
They make programs run slower
They are only used for loops
They help in code organization
They increase the amount of code
What is the purpose of the FindMax subroutine?
To sort a list of numbers
To find the largest number between two inputs
To calculate the average of two numbers
To find the smallest number
What does the DrawCircleUsingCenter subroutine do?
Calculates the area of a circle
Draws a circle using specified coordinates
Changes the background color
Draws a rectangle
What is the output of the PrimeCheck subroutine if the input is 4?
Not Prime
False
True
Prime
What is the purpose of the For loop in the PrimeCheck example?
To repeat a block of code a fixed number of times
To define a subroutine
To create a new variable
To end the program
What is the initial value of isPrime in the PrimeCheck example?
False
1
True
0
What should be at the top of a well-organized program?
Subroutines
Main program
Variables
Comments
What does the Math.Remainder function do?
Adds two numbers
Calculates the square root
Subtracts one number from another
Finds the remainder of a division
