Test 1 Flashcards

1
Q

Size of char in bytes

A

One

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

Size of short in bytes

A

Two

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

Size of float in bytes

A

Four

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

Size of long in bytes

A

Four

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

Size of double in bytes

A

Eight

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

&

A

Address operator: accesses the variables memory location

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

Which byte of a variable contains the memory address?

A

The first one

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

By default, memory addresses print in what number type?

A

Hexadecimal

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

How to print an address in decimal

A

cout

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

A value that represents or holds the value of a memory location is

A

A pointer

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

Indirection operator

A

*

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

Declaration of a pointer

A

int ptr OR int ptr

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

To access the value of a variable using a pointer

A

ptr (ptr = 100; or cout

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

“*” can be used for

A

Multiplication, declaration of a pointer, and as the indirection operator (they’re not the same!!!)

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

Pointer notation

A

*(arrayName+1)

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

Array notation

A

Ptr[1]

17
Q

How does pointer arithmetic work

A

It adds not 1 value, but one “amount of bytes” required for the type

18
Q

Value to specify that a pointer is not being used/doesn’t point to a valid address

A

0

19
Q

A pointer pointing to 0 is called a

A

NULL pointer

20
Q

Use a pointer with cin

A

Cin&raquo_space; *ptr;

21
Q

A int *const ptr is:

A

A pointer whose address can’t change.

22
Q

A pointer TO a const:

A

Can’t change the value at its memory location, but it’s memory address can change

23
Q

To delete a dynamically allocated array:

A

Delete [] ptr;

24
Q

Pointers that point to memory that has already been delete(d)

A

Dangling pointer

25
Q

To write a function that returns a pointer:

A

Int *myFunct(){
Blah
Blah
Blah

return myPtr; }
26
Q

Point to class members:

A

(*ptr).length = 5;

OR ptr->length = 5

27
Q

What is -> called

A

Structure pointer operator

28
Q

Friend functions:

A

Are functions from other classes that can access this classes private members

29
Q

Class aggregation occurs when:

A

An object of one class owns an object of another class

30
Q

Class composition is:

A

A form of aggregation where the owner class controls the lifetime of the objects of the owned class

31
Q

Is-a relationship:

A

Inheritance

32
Q

declaration:

A

Provides info about the existence/type of a var/function

33
Q

Definition:

A

Provides all the information contained in a declaration, and in addition, causes memory to be allocated for the var or function

34
Q

Static member vars must be declared:

A

Inside the class definition

35
Q

Static members must be defined:

A

Somewhere outside of the class definition