Intro to C++ Flashcards

You may prefer our related Brainscape-certified 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
Q

What is true represented as in a computer

A

True is one and any number other than zero

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

What does datatype char hold

A

A single character value

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

What Are c-strings?

A

Arrays of characters

28
Q

What are string objects

A

Variables that have to be declared of the string class

29
Q

What preprocessor directive is required to use the string class

A

String

30
Q

What format do constant declarations have

A

Const datatype identifier = value

31
Q

What does data type determine?

A

How the data will be stored and what types of operations can be performed on this data.

32
Q

What types of data types are there?

A

integers, real numbers, characters, boolean

33
Q

What subtypes of integer data types are there?

A

short, unsigned short, int, unsigned int, long, unsigned long, long long int, unsigned long long

34
Q

What types of floating point data types are there?

A

float, double, long double

35
Q

What is boolean data?

A

data that is either true or false

36
Q

How can you declare multiple variables with the same data type?

A

in a single statement.

datattype var1, var2, var3;

37
Q

What are assignment statements used for?

A

to store values in the memory locations.

38
Q

What is the assignment operator?

A

=

39
Q

When are named constants assigned?

A

At the time they are declared.

40
Q

When can assignments to variables occur?

A

At declaration, or any time after.

41
Q

How do assignment statements work?

A

The result of whatever is on the right side, is stored in the variable on the left side.

42
Q

What does truncated mean?

A

Data is lost to change a value.

43
Q

When are numbers truncated?

A

When they do not fit in the data type they are being stored in.

44
Q

How many characters can data type char store?

A

1 character

45
Q

What type of quotation marks must you use with the char data type?

A

Single quotes

46
Q

Why do you use single quotes with char data type?

A

Because double quotes include an end character, so is stored as one more character than it actually.

47
Q

What are strings?

A

a collection of characters

48
Q

What are the two methods of creating strings?

A

c-strings and string objects

49
Q

What is a c-string?

A

an array of characters

50
Q

When can C-strings be assigned

A

at the time of declaration.

51
Q

What do strings require you include?

A

the string preprocessor directive

52
Q

What are the three types of operators?

A

unary, binary, and ternary

53
Q

What is a unary operator?

A

operator that requires one operand.

54
Q

what is a binary operator?

A

operator that requires two operands

55
Q

What is a ternary operator?

A

an operator that requires three operands.

56
Q

What does the operator modulus (%) do?

A

Finds the remainder of the division of two integers.

57
Q

integers operated on by integers will result in…

A

integers

58
Q

floating points operated on by integers will result in…

A

floating points

59
Q

What is the order of operations for operators?

A

parenthesis, unary negation, multiplication/division/modulus, addition/subtraction

60
Q

What order are operations of equal precedence performed in?

A

from left to right.

61
Q

Any number without a decimal point is assumed to be…

A

an integer.

62
Q

How do multiple assignments work?

A

many variables can be assigned the same number by placing them as x=y=z=a=b=c=3.0;

63
Q

What are the Four types of Control Structures?

A

Sequence, Branched, Loops, Functions

64
Q

Describe sequence (control structure)

A

statements are executed in order they are written

65
Q

What is the Branched control structure?

A

some statements may be executed only when a specific condition is met.

66
Q

What is the loop control structure?

A

statements are repeated

67
Q

describe the functions control structure

A

a group of statements are executed at various times in the program.