Oral Exam - memory, references, and parameters - mini

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

Describe pass by value

Copies argument → safe but slower for large data

2
New cards

Describe pass by reference

Passes address → faster, can modify original variable.

3
New cards

Compare pass by value/reference

Value = copy, safe; Reference = efficient, modifiable.

4
New cards

Describe pointers

Store memory addresses; referenced with *.

5
New cards

Describe references

Alternate names for existing variables; must be initialized.

6
New cards

Compare pointers and references 

Pointers can be null/reassigned; references can’t.

7
New cards

How are pointers different from variables

Store addresses, not actual values

8
New cards

Why prefer pass-by-reference

 Efficiency and ability to modify arguments

9
New cards

Advantages/disadvantages of pass by value/pass by reference

By value: safe but slow; By reference: efficient but risk unintended modification

10
New cards

Describe garbage collection

Automatic memory cleanup (not in C++).

11
New cards

C++ has no garbage collection - implication?

Programmers must manage new/delete manually

12
New cards

Describe memory leaks

Allocated memory not freed; causes lost resources.

13
New cards

Describe memory fragmentation

Freeing blocks creates gaps, reducing usable continuous memory.

14
New cards

Describe paging/sweeping

 Moving data between RAM and disk to manage limited memory.

15
New cards

Dynamic allocation/freeing memory

arrays use new[], delete[]

16
New cards

Describe scope

Defines variable visibility; inner scope hides outer

17
New cards

Name conflict across scopes

 Inner takes precedence; access outer via ::.

18
New cards

Describe default parameters

Placed at the end of the parameter list; supply defaults for missing args.

19
New cards

What does a function’s type mean?

Its return type — what kind of value it outputs