1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Describe pass by value
Copies argument → safe but slower for large data
Describe pass by reference
Passes address → faster, can modify original variable.
Compare pass by value/reference
Value = copy, safe; Reference = efficient, modifiable.
Describe pointers
Store memory addresses; referenced with *.
Describe references
Alternate names for existing variables; must be initialized.
Compare pointers and references
Pointers can be null/reassigned; references can’t.
How are pointers different from variables
Store addresses, not actual values
Why prefer pass-by-reference
Efficiency and ability to modify arguments
Advantages/disadvantages of pass by value/pass by reference
By value: safe but slow; By reference: efficient but risk unintended modification
Describe garbage collection
Automatic memory cleanup (not in C++).
C++ has no garbage collection - implication?
Programmers must manage new/delete manually
Describe memory leaks
Allocated memory not freed; causes lost resources.
Describe memory fragmentation
Freeing blocks creates gaps, reducing usable continuous memory.
Describe paging/sweeping
Moving data between RAM and disk to manage limited memory.
Dynamic allocation/freeing memory
arrays use new[], delete[]
Describe scope
Defines variable visibility; inner scope hides outer
Name conflict across scopes
Inner takes precedence; access outer via ::.
Describe default parameters
Placed at the end of the parameter list; supply defaults for missing args.
What does a function’s type mean?
Its return type — what kind of value it outputs