Week 6 Flashcards

1
Q

These are easy and fun to learn.

A

Pointers

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

Some C++ tasks are performed more easily with ______, and other C++ tasks, such as dynamic memory allocation, cannot be performed without them. These are variables that store memory addresses.

A

Pointers

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

They allow direct memory access and manipulation, making them useful for dynamic memory allocation, arrays, and function arguments.

A

Pointers

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

It is a variable whose value is the address of another variable. Like any variable or constant, you must declare a pointer before you can work with it. The general form of a pointer variable declaration is

A

Pointers

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

Every variable is a memory location, which has its address defined.

A

Ampersand/Address-of Operator (&)

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

That address can be accessed using the ________________, which denotes an address in memory.

A

Ampersand/Address-of Operator (&)

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

returns the memory address of its operand.

A

Ampersand/Address-of Operator (&)

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

returns the value of the variable located at the address specified by its operand.

A

Dereference/ Contents-of Operator (*)

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

is basically an alias for the variable the pointer points to

A

Dereference/ Contents-of Operator (*)

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

There are few important operations, which we will do with the pointers very frequently.

A

a. We define a pointer variable.
b. Assign the address of a variable to a pointer.
c. Finally access the value at the address available in the pointer variable. This is done by using unary operator * that returns the value of the variable located at the address specified by its operand.

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

It is an alias, that is, another name for an already existing variable. Once a reference is initialized with a variable, either the variable name or the reference name may be used to refer to the variable.

A

Reference variable

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

Is the process of setting aside sections of memory in a program to be used to store variables

A

Memory Allocation

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

What are the three type of memory allocation

A

Static Memory Allocation
Automatic Memory Allocation
Dynamic Memory Allocation

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

it means that the memory for your variables is allocated when the program starts.

A

Static Memory Allocation

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

the size is fixed when the program is created.

A

Static Memory Allocation

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

applies to global and static variables

A

Static Memory Allocation

17
Q

static memory allocation uses ________as its storage of memory

A

Memory Stack

18
Q

occurs for (non-static) variables defined inside functions and is usually stored on the memory stack.

A

Automatic Memory Allocation

19
Q

you do not have to reserve extra memory using them, but on the other hand, have also limited control over the lifetime of this memory

A

Automatic Memory Allocation

20
Q

Example of this is automatic variables in a function are only there until the function finishes

A

Automatic Memory Allocation

21
Q

you know the exact size and the lifetime of these memory locations.

A

Dynamic Memory Allocation

22
Q

if you don’t free it, you’ll run into memory leaks, which may cause your application to crash, since at some point of time, system cannot allocate more memory

A

Dynamic Memory Allocation

23
Q

It uses Memory Heap

A

Dynamic Memory Allocation