Back to marketplace

Passing by reference VS Passing by value

No description yet. This curated deck is ready for daily study.

Total cards: 9•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (9)

#1
Front (Question)

What is passing by value?

Back (Answer)

The value created for the subroutine is a copy of the original value.

#2
Front (Question)

What is passing by reference?

Back (Answer)

A pointer that contains the memory address of the original variable is created This means that any change made to the variable in the subroutine also affects the original variable.

#3
Front (Question)

Features of passing by value

Back (Answer)

The copied value has its own separate memory Seen more in newer programming languages

#4
Front (Question)

1 positive and 1 negative of passing by value

Back (Answer)

+ The copied variable and the original can be given the same identifier • Creates inconsistency between the two variables

#5
Front (Question)

When would you pass by reference?

Back (Answer)

If the original value needs editing

#6
Front (Question)

When would you pass by value?

Back (Answer)

If it’s local and merely referenced

#7
Front (Question)

Features of passing by reference?

Back (Answer)

Uses a pre-existing memory location to store the memory address of the value. Any edits directly affect the variable

#8
Front (Question)

1 Positive and 1 negative of passing by reference

Back (Answer)

+ Requires less space than passing by value • Entails implicit dependency, which is considered bad practice.

#9
Front (Question)

How is implicit dependency triggered in passing by reference?

Back (Answer)

If you pass a local variable by reference and then assign to it, the result is a direct change to the caller’s variable, not to what its pointing to.