Practice Subroutines (functions/procedures) (2.5.3) - Machine Instructions and Assembly Language Programming
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

Subroutines (Functions/Procedures)

Practice - Subroutines (Functions/Procedures)

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

Define what a subroutine is.

💡 Hint: Think about how it helps to avoid code repetition.

Question 2 Easy

What does the CALL instruction do?

💡 Hint: Consider what happens before the program jumps to a new routine.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What happens when a subroutine is called?

The program jumps to the end of the code.
The return address is pushed onto the stack.
The program stops execution.

💡 Hint: Think about what needs to be remembered before jumping.

Question 2

True or False: A stack frame can contain parameters passed to a subroutine.

True
False

💡 Hint: Consider what information is necessary when a subroutine is called.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Write a pseudocode implementation of a program that includes a main function calling two nested subroutines. Explain the flow of execution.

💡 Hint: Use flow diagrams to illustrate how calls stack up.

Challenge 2 Hard

Discuss how changing the calling convention from callee-save to caller-save affects subroutine design. Provide examples.

💡 Hint: Contrast both approaches with specific use cases.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.