
Subroutines - Procedures & Functions
Authored by Rachel Brincat
Computers
9th - 12th Grade
Used 11+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
20 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the return statement in a function?
To terminate the function
To print a value
To return a value to the main program
To declare a local variable
Answer explanation
The return statement in a function is used to return a value to the main program, allowing the function to pass back a result for further processing.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following code snippets correctly calls the clear_screen procedure with 5 as the parameter?
clear_screen(5)
clear_screen = 5
clear_screen()
clear_screen = 5()
Answer explanation
Explanation: To call a procedure, use its name followed by parentheses and any required parameters.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a subroutine in computer programming?
A sequence of program instructions that perform a specific task
A unit of code that can be reused in programs
A way to structure and organize programming code
All of the above
Answer explanation
A subroutine in computer programming is a sequence of program instructions that perform a specific task, a unit of code that can be reused in programs, and a way to structure and organize programming code. Therefore, the correct answer is 'All of the above.'
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax for defining a procedure in Python?
PROCEDURE identifier(parameters):
SUB identifier(parameters):
FUNCTION identifier(parameters):
def identifier(parameters):
Answer explanation
The correct syntax for defining a procedure in Python is 'def identifier(parameters):'.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which type of subroutine returns a value to the main program?
Procedure
Function
Both procedure and function
Neither procedure nor function
Answer explanation
Explanation: Functions manipulate data and return a value to the main program.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following function do?
Converts Celsius to Fahrenheit
Calculates the average temperature
Prints a temperature value
Converts Fahrenheit to Celsius
Answer explanation
Explanation: The function f_to_c converts a temperature from Fahrenheit to Celsius using the given formula.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements is true about local variables?
They are used for complex calculations.
They are confined to a specific section of code (e.g., within a subroutine).
They can be accessed from any part of the program.
They are global variables.
Answer explanation
Explanation: Local variables are declared within a subroutine (procedure or function) and are accessible only within that specific section of code.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
16 questions
J808 LO6.2 Tools to present information
Quiz
•
10th - 11th Grade
15 questions
# REVIEW 1 DATA TYPES
Quiz
•
10th Grade
15 questions
1.1.1 The structure and function of the processor
Quiz
•
11th Grade - University
20 questions
Network topologies
Quiz
•
8th Grade - University
15 questions
Quiz 1
Quiz
•
1st - 12th Grade
15 questions
CSS Quarter IV QUIZ 2
Quiz
•
10th Grade
20 questions
Quiz 4
Quiz
•
1st - 10th Grade
22 questions
HTML Quiz
Quiz
•
9th Grade
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade