Search Header Logo

Subroutines - Comprehension

Authored by Mark Jones

Computers

9th - 10th Grade

Used 1+ times

Subroutines - Comprehension
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

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.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?