Wk. 6 Flashcards

1
Q

What is the const modifier for?

A

Used to create “read-only” variables

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

What is the syntax for a const modifier?

A

const [data types] [identifier]

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

Besides const, what other type of variable must be initialized?

A

Reference variable

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

What is an example where you would utilize a const variable?

A

When you have a global variable that is going to be used multiple times. The const will prevent any function from changing the value of the variable.

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

When are variables written in all caps?

A

When a variable is a defined constant.

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

How do you tell whether to use ifstream or ofstream?

A

POV of the program. If reading from file into the program, ifStream. If writing from program to the file, ofStream.

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

What signifies the end of a char array?

A

The null character - \0

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