C++ Programming (2) Flashcards

1
Q

What are preprocessor directives?

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

How can preprocessor directives be used to prevent multiple inclusion of the same header file?

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

what is the syntax of the #define preprocessor directive? What does it do? What are some other preprocessor directives?

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

What are namespaces? What is the syntax for declaring a namespace?

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

Example of defining a namespace. How are things within a namespace accessed?

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

How do we declare what default namespace we are using?

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

Should you include the ‘using namespace …’ syntax in a header file? Why?

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

What is the standard library for input and output in C++? What are two commonly used output stream objects in C++? Common input stream?

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

Are the standard inout and output functions from C also available in C++?

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

Are C++ I/O operators performed by functions or operators?

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

What are the insertion / extraction operators? What is the only thing you can put on the right of the extraction symbol?

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

Insertion and Extraction example:

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

What happens with the extraction operator when erroneous data is passed?

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

When using the extraction operator to read input characters into a string variable, how are leading whitespace characters treated?

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

Limitations of Extraction example:

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

How can we parse a line and extract the type / date from it?

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

How can we read from/write to files? What is the library called?

A
18
Q

What work is generally done with files in C++?

A
19
Q

Classes are an expanded concept of ___.
Classes contain what?
What is an object?

How are classes defined?

A
20
Q

What are the different components of a class definition?

A
21
Q

What is the general format of having a main C++ file, a C++ class file, and a C++ header? Where would you put the ‘using namespace’ line?

A
22
Q

How do you compile all C++ files to create an executable?

A
23
Q

What are access specifiers? What is the difference between private, public, and protected?

A
24
Q

Access specifiers example:

A
25
Q

How are objects created? Is an object created when a variable pointing to a class type is created?

A
26
Q

How do you create an object with a pointer variable? What are the steps within the statement?

A
27
Q

When are objects created on the stack destroyed? What about objects created dynamically? How are dynamically created object destroyed?

A
28
Q

What is a constructor? Are they required?

A
29
Q

What is a copy constructor? What can it be used for?

A
30
Q

What happens if you do not declare a copy constructor?

A
31
Q

What is a destructor? When is it called?

A
32
Q

What is class inheritance? What does it allow us to do? What is a base/superclass? Derived/subclass?

A
33
Q

How many classes can a class derive itself from? How do we define a derived class?

A
34
Q

Inheritance example:

A
35
Q

How does inheritance work alongside access specifiers?

A
36
Q

Inheritance and access specifiers example:

A
37
Q

How does inheritance of constructors and destructors work?

A
38
Q

Inheritance of constructors and destructors example:

A
39
Q

What is multiple inheritance? How does it work?

A
40
Q

What is a ‘Friend’ of a class?

A
41
Q

What are ‘Friend’ functions?

A
42
Q

What are ‘Friend’ Classes?

A