CPSC 1020 Exam 2!!

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/59

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.

60 Terms

1
New cards

(*) pointer

variable that stores a memory address

2
New cards

Memory address

Numeric location where data is stored

3
New cards

(*) dereferencing

Accessing the value stored at pointer's address

4
New cards

(&) Address-of operator

gets memory address of variable

5
New cards

Stack memory

Memory automatically managed, used for local/function calls

6
New cards

Heap memory

Memory dynamically allocated(manually) at runtime with new, freed with delete

7
New cards

Static memory

memory that persists for the lifetime of the program (Global/static variables)

8
New cards

dynamic memory allocation

allocation memory at runtime using new

9
New cards

new operator

requests memory from heap and returns pointer to it

10
New cards

delete operator

frees memory previously allocated with new

11
New cards

time-space tradoff

Balancing program speed/memory use

12
New cards

memory leak

when allocated memory is never released, wasting space

13
New cards

dangling pointer

pointer that references deallocated/invalid memory

14
New cards

Null pointer

pointer set to 0/nullPtr that points to nothing

15
New cards

this pointer

implicit pointer to the object that called a member function

16
New cards

shallow copy

copies pointer values (addresses) but not actual data they point

17
New cards

deep copy

creates new memory and copies actual data, not just addresses

18
New cards

copy constructor

special constructor used to initialize an object from another object

19
New cards

destructor (~ClassName())

Function called automatically when an object goes put of scope to free resources

20
New cards

stream

sequence of bytes flowing between a program anbd data source/destination

21
New cards

input stream

reads data from keyboard/file into program

22
New cards

output stream

sends data from a program to screen or file

23
New cards

Filestream

ifstream, ofstream, fstream (enables reading/writing files)

24
New cards

stream manipulators

functions like setw/setfill/setprecision that format output

25
New cards

string stream

treats a string as input/output like a fill stream

26
New cards

is_open()/fail()

functions used to check if a file stream opened/closed

27
New cards

constructor

special function used to intialize objects when they an created

28
New cards

destructor

cleans up resources when object is destroyed(called when object = out of scope)

29
New cards

Default arguments

function parameters that have preset values if none are provided

30
New cards

member function

function that operates objects of a class

31
New cards

friend function

non-member function function that has access to private data of a class

32
New cards

Assignment operator (operator=)

copies one existing object to another after both are created

33
New cards

Rule of 3

1) Destructor

34
New cards

2) Copy constructor

35
New cards

3) assignment operator

36
New cards

Array

fixed size, contiguous block of elements

37
New cards

vector

dynamic array that resizes automatically as elements are added

38
New cards

string

sequence of characters managed as C++ object

39
New cards

Linked list

data structured made of nodes connected by pointers

40
New cards

node data

stored information data

41
New cards

node pointer (next)

points to the next node in list

42
New cards

null pointer

marks end of linked list (doesnt have next)

43
New cards

inheritance

mechanism where one class derives from properties from another

44
New cards

Base class/parent class/superclass

class being inherited from

45
New cards

derived class/child class/subclass

class that inherits from base class

46
New cards

"Is-a" relationship

Indicates inheritance (Dog Is-a animal)

47
New cards

Protected access specifier

allows access within class and its derived class

48
New cards

function overriding

redefining a base class function in a derived class

49
New cards

virtual function

base class function marked with virtual to allow overriding

50
New cards

runtime polymorphism/dynamic binding

deciding which function calls @ runtime

51
New cards

Compile-time polymorphism

function behavior determined at compile time by using parameter types

52
New cards

abstract base class

class that cannot be instantiated and usually has at least one pure virtual function

53
New cards

pure virtual function

declared but not defined in base class, must be implemented in derived class

54
New cards

polymorphism

ability to treat derived class objects as base class objects and call the correct overridden functions

55
New cards

"virtual"

enables polymorphism by marking functions as overridable

56
New cards

constructor order

base class run first, then derived class

57
New cards

destructor order

derived class run first, then base class!!

58
New cards

stack vs heap

stack for automatic processes, heap for dynamic processes(new/delete)

59
New cards

Pointers+inheritance

Needed for polymorphism

60
New cards

abstract base class instantiation

cannot create objects directly from it