Quiz 2 Flashcards

1
Q

Exceptions

A

allows program to catch and handle errors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Exception handler

A

allows program to recover through a try-catch

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Stack memory

A

for data that is automatically managed or statically allocated at runtime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Heap memory

A

for data that is dynamically allocated

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Casting

A

taking one type of data and converting it to another

broad: how bits are interpreted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explicit Ctors

A

turns off implicit conversions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Implicit Ctors

A

can be overwritten with diff data types (compiler adds code to cast to a different type)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Pointers

A

contains memory address as value
must be defined
* to dereference

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

References

A

applied to a variable to access the address
cannot be null
require initialization
cannot change what it refers to
must be const if initialized with literal value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Const

A

ensures data cannot be modified

makes temp variables when unnamed/not matching the type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

this

A

non-const member function: X * const
- const pointer to a non-const object X
const member function const X * const
- object is also const

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Static Memory

A
Reserved at compile-time, allocated when the program starts and deallocated when it ends.
Ex. Global variables, static variables in functions, static class members.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Dynamic Memory

A

Allocated on the program’s heap during run time. Requires new and delete operators. Examples: When memory is allocated for an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Automatic Memory

A

Allocated on the program’s execution stack during run time, as control flow enters and deallocated as flow exits from a block of code
Ex. Function parameters, local variables, and functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Try block

A

encloses code that may generate error/ produce an exception

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Catch block

A

specifies type of exception and contains exception handler, if there is not catch block the terminate function is called (abort function)
must be const for const object

17
Q

Const pointer

A

memory address cannot change
different from pointer to const data
const needs to be to the right of *