logo

Learning objective

Local variables in subroutines: Know that subroutines may declare their own variables, called local variables, and that local variables: • exist only while the subroutine is executing • are accessible only within the subroutine. Be able to use local variables and explain why it is good practice to do so.

Read the explanation, check the common trap, then practise with flashcards and questions.

At a glance

0

Flashcards

0

Questions

Topic

Programming

Subtopic

Local variables in subroutines

Aqa A Level Computer ScienceFundamentals of programming

Study support

Understand this objective

Quick explanation

Local variables in subroutines: Know that subroutines may declare their own variables, called local variables, and that local variables: • exist only while the subroutine is executing • are accessible only within the subroutine. Be able to use local variables and explain why it is good practice to do so

  • This point belongs to Programming, especially Local variables in subroutines.
  • You need to be able to local variables in subroutines: Know that subroutines may declare their own variables, called local variables, and that local variables: • exist only while the subroutine is executing • are accessible only within the subroutine. Be able to use local variables and explain why it is good practice to do so.
  • Use the linked flashcards and practice questions to check recall, then practise applying the idea in an exam-style answer.

Why it matters

This objective helps connect Local variables in subroutines to exam-style questions, flashcards, and revision notes for Programming.

Quick student answer

What is a local variable?

Direct answer

A variable declared inside a subroutine and accessible only there

Key terms

  • Local variable: A variable declared within a subroutine that is accessible only within that subroutine and exists only while the subroutine is executing.
  • Subroutine: A named section of a program that can be executed to perform a particular task and can contain its own local variables.

Common trap

Confusing local variables with variables available everywhere: Remember that a local variable is accessible only within the subroutine that declares it and exists only while that subroutine is executing.

Related questions

Try this as a practice card

4 linked

Question 1 of 4

Choose an answer, get feedback, then move sideways through the set.

0 of 4 attempted

Flashcard prompts

Flip through the key recall cards

4 cards

Flashcard 1 of 4

Press Space to flip, arrows to move

Revision tools

Choose how to practise

Back to topic hub
Flashcards0 linked cards
No objective-specific flashcards are cached for this page. Use the topic hub to revise the surrounding flashcards without triggering a frozen-subject DB fallback.Open topic hub
Practice Questions0 linked questions
No objective-specific practice questions are cached for this page. Use the topic question bank to practise nearby curriculum questions without weakening the egress guard.Open topic questions

Related learning objectives