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?

22
Q

What do the following assignments do:

23
Q

What are pointers?

24
Q

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

25
Who is responsible for garbage collection and freeing dynamic memory? What keywords are used?
26
What is the syntax for declaring a pointer? What about a pointer without a specific type attached to it?
27
What is the reference operator? What does it do?
28
Reference operator example
29
How can you make a pointer point to whatever another pointer is pointing at?
30
What is the Dereference operator? How is it used with pointers?
31
Dereference operator examples:
32
What are some misuses of the dereference operator?
33
When SHOULD pointers be ued?
34
What are void pointers?
35
What is pointer casting? What is the syntax?
36
Are functions in C++ similar to those in C? Where must they be declared?
37
What is contained within a function declaration in C++?
38
Function declaration example"
39
What is a function definition?
40
What is a function call?
41
By default, C++ passes parameters into functions by...? What does this mean?
42
What is the output of the following function:
43
How does C++ allow parameters to be passed by reference?
44
Example of pass-by-reference:
45
How can we assure the value of a variable is not changed during the function?
46
How can a function end? When is a function allowed to return by reaching the end of the function body?
47
What are the following function modifiers: inline constexpr static
48
How do C++ arrays differ from C arrays with regards to dynamically allocating arrays?
49
What are two different ways of initializing an array?
50
Can you have a pointer point to an element in an array?
51
What is the syntax of allocating and deallocating arrays in C++?