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?

18
Q

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

19
Q

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

How are classes defined?

20
Q

What are the different components of a class definition?

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?

22
Q

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

23
Q

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

24
Q

Access specifiers example:

25
How are objects created? Is an object created when a variable pointing to a class type is created?
26
How do you create an object with a pointer variable? What are the steps within the statement?
27
When are objects created on the stack destroyed? What about objects created dynamically? How are dynamically created object destroyed?
28
What is a constructor? Are they required?
29
What is a copy constructor? What can it be used for?
30
What happens if you do not declare a copy constructor?
31
What is a destructor? When is it called?
32
What is class inheritance? What does it allow us to do? What is a base/superclass? Derived/subclass?
33
How many classes can a class derive itself from? How do we define a derived class?
34
Inheritance example:
35
How does inheritance work alongside access specifiers?
36
Inheritance and access specifiers example:
37
How does inheritance of constructors and destructors work?
38
Inheritance of constructors and destructors example:
39
What is multiple inheritance? How does it work?
40
What is a 'Friend' of a class?
41
What are 'Friend' functions?
42
What are 'Friend' Classes?