Subroutines - Comprehension

Subroutines - Comprehension

9th - 10th Grade

30 Qs

quiz-placeholder

Similar activities

Handling Data: Procedures, functions, records, SQL and Files

Handling Data: Procedures, functions, records, SQL and Files

9th Grade

25 Qs

Codehs Tracy

Codehs Tracy

9th Grade

25 Qs

CodeHS APCSP Python

CodeHS APCSP Python

9th - 12th Grade

26 Qs

Code HS Unit Test

Code HS Unit Test

9th - 12th Grade

26 Qs

Algorithms - python (GCSE)

Algorithms - python (GCSE)

10th - 12th Grade

25 Qs

Python Vocab

Python Vocab

9th - 12th Grade

34 Qs

Python 5 topic (turtle)

Python 5 topic (turtle)

5th - 12th Grade

30 Qs

Variable Types, Functions Review

Variable Types, Functions Review

9th - 12th Grade

26 Qs

Subroutines - Comprehension

Subroutines - Comprehension

Assessment

Quiz

Computers

9th - 10th Grade

Medium

Created by

Mark Jones

Used 1+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main difference between a function and a procedure?
A function uses parameters, a procedure does not
A function can contain loops, a procedure cannot
A function returns a value, a procedure does not
A procedure is always called from within a loop

Answer explanation

Functions return values; procedures do not.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a benefit of using subroutines in a program?
Subroutines make the program run faster
Subroutines reduce the size of the compiler
Subroutines help reduce repetition and make code easier to maintain
Subroutines automatically test your code

Answer explanation

Subroutines help with readability, reuse, and maintenance.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is true about local variables?
They are declared outside all subroutines
They can be used in any part of the program
They are shared between all subroutines
They only exist while the subroutine runs

Answer explanation

Local variables exist only during subroutine execution.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

How many parameters are passed into the subroutine giveChange?

0
1
2
Cannot be determined

Answer explanation

Only the result of the calculation is passed, so 1 parameter.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What is the name of the subroutine?

def
calculateArea
length
return

Answer explanation

The name of the subroutine is the identifier after 'def'.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

In this subroutine, which of the following are the parameters?

greet
print
name and timeOfDay
“Good”, “timeOfDay”, “name”

Answer explanation

Parameters are listed in the subroutine definition.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which of these is an argument in the following subroutine call?

displayScore
'Player 1' and 42
score
None of the above

Answer explanation

Arguments are the actual values passed to the subroutine.

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?