Sub Programs (OCR GCSE Computer Science): Flashcards

📚Flashcards
Sub Programs
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

12 cards from this deck

Show

What are sub programs?

Smaller, reusable code blocks used to structure larger programs

Two main types of sub programs

Functions and procedures

Do functions return a value?

Yes, functions return a value

Do procedures return a value?

No, procedures do not return a value

Benefits of using sub programs

Avoid repetition, easier to read/maintain, modular programming

When to use a function

When returning a specific result

When to use a procedure

When executing a task without needing a return value

Local variables definition

Declared inside sub program, accessible only within it

Global variables definition

Declared outside sub programs, accessible throughout program

Risk of global variables

Can cause unintended side effects if modified unexpectedly

Can arrays be passed to sub programs?

Yes, as arguments

Can functions return arrays?

Yes, to process and return multiple values

Explore OCR GCSE Computer Science Revision Notes by Topics

Explore OCR GCSE Computer Science Model Answers by Topics

Explore OCR GCSE Computer Science Quizzes by Topics

Explore OCR GCSE Computer Science Exam Questions by Topics

Join 100,000+ GCSE students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.