Intro to C++ Flashcards

1
Q

What does the #include directive do?

A

Causes another file to be inserted into the program. Usually library files that contain specific definitions.

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

C++ is case sensitive, which means…

A

Anything written in lowercase will not be read the same way as something in uppercase.

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

All programs must have a…

A

main function.

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

What are the two ways that main can be defined?

A

int main() and void main(void)

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

What do output statements do?

A

send the user messages, results, questions, etc from the computer.

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

What format does an output statement usually take?

A

the cout object, the insertion operator, and variables or constants to be displayed.

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

What is the insertion operator?

A

«

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

What is an escape sequence?

A

something that performs a specific output task when enclosed in quotes.

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

What does \n do?

A

causes the cursor to go to the next line

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

what does \t do?

A

causes the cursor to go to the next tab stop.

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

What does \a do?

A

Causes the computer to beep

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

What does \ do?

A

Causes a backslash to be printed.

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

What does ' do?

A

Causes a single quote to be printed.

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

What does " do?

A

Causes a double quote to be printed.

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

what does endl do?

A

returns output to next line.

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

What is an identifier?

A

names or symbols used by the programmer to refer to times such as variables, named constants, functions, classes, ect.

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

What words are off limits as identifiers?

A

Any key words or reserved words.

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

What must an identifier be comprised of?

A

Only letters, numbers, or the underscore.

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

What is the rule for the first character of an identifier?

A

it must be a letter or underscore.

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

What do variables refer to?

A

memory locations in which the value stored may change throughout the execution of the program.

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

What do named or symbolic constants refer to?

A

memory locations in which the values do not change during the course of the program.

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

You must define or declare a variable before you may use it!

A

.

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

What is the format of a variable definition?

A

datatype variablename;

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

What is false represented as in a computer

A

Zero

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is true represented as in a computer
True is one and any number other than zero
26
What does datatype char hold
A single character value
27
What Are c-strings?
Arrays of characters
28
What are string objects
Variables that have to be declared of the string class
29
What preprocessor directive is required to use the string class
String
30
What format do constant declarations have
Const datatype identifier = value
31
What does data type determine?
How the data will be stored and what types of operations can be performed on this data.
32
What types of data types are there?
integers, real numbers, characters, boolean
33
What subtypes of integer data types are there?
short, unsigned short, int, unsigned int, long, unsigned long, long long int, unsigned long long
34
What types of floating point data types are there?
float, double, long double
35
What is boolean data?
data that is either true or false
36
How can you declare multiple variables with the same data type?
in a single statement. | datattype var1, var2, var3;
37
What are assignment statements used for?
to store values in the memory locations.
38
What is the assignment operator?
=
39
When are named constants assigned?
At the time they are declared.
40
When can assignments to variables occur?
At declaration, or any time after.
41
How do assignment statements work?
The result of whatever is on the right side, is stored in the variable on the left side.
42
What does truncated mean?
Data is lost to change a value.
43
When are numbers truncated?
When they do not fit in the data type they are being stored in.
44
How many characters can data type char store?
1 character
45
What type of quotation marks must you use with the char data type?
Single quotes
46
Why do you use single quotes with char data type?
Because double quotes include an end character, so is stored as one more character than it actually.
47
What are strings?
a collection of characters
48
What are the two methods of creating strings?
c-strings and string objects
49
What is a c-string?
an array of characters
50
When can C-strings be assigned
at the time of declaration.
51
What do strings require you include?
the string preprocessor directive
52
What are the three types of operators?
unary, binary, and ternary
53
What is a unary operator?
operator that requires one operand.
54
what is a binary operator?
operator that requires two operands
55
What is a ternary operator?
an operator that requires three operands.
56
What does the operator modulus (%) do?
Finds the remainder of the division of two integers.
57
integers operated on by integers will result in...
integers
58
floating points operated on by integers will result in...
floating points
59
What is the order of operations for operators?
parenthesis, unary negation, multiplication/division/modulus, addition/subtraction
60
What order are operations of equal precedence performed in?
from left to right.
61
Any number without a decimal point is assumed to be...
an integer.
62
How do multiple assignments work?
many variables can be assigned the same number by placing them as x=y=z=a=b=c=3.0;
63
What are the Four types of Control Structures?
Sequence, Branched, Loops, Functions
64
Describe sequence (control structure)
statements are executed in order they are written
65
What is the Branched control structure?
some statements may be executed only when a specific condition is met.
66
What is the loop control structure?
statements are repeated
67
describe the functions control structure
a group of statements are executed at various times in the program.