Search Header Logo

Subroutines and Functions Activity

Authored by JackR JackR

Computers

10th Grade

Used 1+ times

Subroutines and Functions Activity
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

What are two types of subroutine used in programming?

Variables and Constants

Functions and Procedures

Loops and Conditions

Arrays and Strings

2.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

How many parameters can functions and procedures have?

Zero, one or many

Three

One

Two

3.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

Explain the difference between a local and global variables

Local variables can be changed once declared, globals cannot be changed once declared

Local variables are declared using the CONSTANT keyword, globals are declared using the VAR keyword

Local variables are accessible anywhere in the program, globals only within the subroutine

Local variables are only accessible within the particular function or procedure, globals are accessible anywhere in the program

4.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

What are three reasons that you should try to use subroutines where possible?

To make the program less maintainable, to decompose the code, to make the program more complex

To reuse code, to make the program less maintainable, to make the program more complex

To make the program more complex, to increase development time, to make program maintenance harder

Reuse code, decomposition, more maintainable code

5.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

What is one other advantage of using subroutines?

Subroutines can be stored in a subroutine library and used in different programs if required

To make the program less maintainable

To make program maintenance harder

To make the program more complex

6.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

What is output by this program? PROCEDURE changeNum num ← 6 OUTPUT num ENDPROCEDURE #Main program num ← 5 OUTPUT num #call function changenum CALL changeNum OUTPUT num

Outputs 5, Outputs 5, Outputs 6

Outputs 5, Outputs 6, Outputs 6

Outputs 5, Outputs 6, Outputs 5

Outputs 6, Outputs 5, Outputs 5

7.

MULTIPLE CHOICE QUESTION

10 mins • 1 pt

What type of data structure is heights? How will the function be called?

heights is a tuple, The function is called and the result stored with a statement such as: tallest ← CalcMax(pupilHeights)

heights is an array, The function is called and the result stored with a statement such as: tallest ← CalcMax(pupilHeights)

heights is a list, The function is called and the result stored with a statement such as: tallest ← CalcMax(pupilHeights)

heights is a string, The function is called and the result stored with a statement such as: tallest ← CalcMax(pupilHeights)

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?