C++ Programming Flashcards

1
Q

Where does C++ inherit most of its syntax and structure from? Is all C code valid in C++?

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

What are the basic elements of a C++ program?

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

What are most programs made up of? What is required for a program as an entry point?

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

How many main functions should / can exist?

A

Exactly one

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

What must be included to use ‘cout’?

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

Is C++ a compiled or interpreted language? C++ source code must be ___ and ___.

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

How can you, from the command line, build a C++ executable in one step? Multiple steps?

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

What is a statement? What is the simplest statement in C++?

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

What is an expression and a type?

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

What types does C++ have in common with C?

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

What are the different forms of constant expressions?

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

Which of the following are valid / invalid? Why?

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

What are the set of operators in C++? Does C++ do conversions?

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

What are statements and compound statements / blocks? Do blocks have a scope?

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

What is C++ control flow? What is a sequence? Selection? Repetition?

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

What are the different ways of doing multi-way selection in C++?

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

What are the different forms of repetition control flow?

A

while loops, for loops, do-while loops

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

What are structures? What is the keyword? What is the difference between a structure and a class with regards to members?

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

What is the syntax of declaring a structure?

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

What is the difference between C and C++ with regards to declaring an instance of a struct?

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

How do you access a field of a structure? What is we were accessing the fields from a pointer variable?

A
22
Q

What do the following assignments do:

A
23
Q

What are pointers?

A
24
Q

What are the two main uses for pointers in C++?

A
25
Q

Who is responsible for garbage collection and freeing dynamic memory? What keywords are used?

A
26
Q

What is the syntax for declaring a pointer? What about a pointer without a specific type attached to it?

A
27
Q

What is the reference operator? What does it do?

A
28
Q

Reference operator example

A
29
Q

How can you make a pointer point to whatever another pointer is pointing at?

A
30
Q

What is the Dereference operator? How is it used with pointers?

A
31
Q

Dereference operator examples:

A
32
Q

What are some misuses of the dereference operator?

A
33
Q

When SHOULD pointers be ued?

A
34
Q

What are void pointers?

A
35
Q

What is pointer casting? What is the syntax?

A
36
Q

Are functions in C++ similar to those in C? Where must they be declared?

A
37
Q

What is contained within a function declaration in C++?

A
38
Q

Function declaration example”

A
39
Q

What is a function definition?

A
40
Q

What is a function call?

A
41
Q

By default, C++ passes parameters into functions by…? What does this mean?

A
42
Q

What is the output of the following function:

A
43
Q

How does C++ allow parameters to be passed by reference?

A
44
Q

Example of pass-by-reference:

A
45
Q

How can we assure the value of a variable is not changed during the function?

A
46
Q

How can a function end? When is a function allowed to return by reaching the end of the function body?

A
47
Q

What are the following function modifiers:
inline
constexpr
static

A
48
Q

How do C++ arrays differ from C arrays with regards to dynamically allocating arrays?

A
49
Q

What are two different ways of initializing an array?

A
50
Q

Can you have a pointer point to an element in an array?

A
51
Q

What is the syntax of allocating and deallocating arrays in C++?

A