C++ Flashcards

0
Q

The job of the _______ is to fetch instructions, carry out the operations commanded by the instructions, and produce some outcome or resultant information

A

CPU

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

computers can do many different jobs because they can be ?

A

Programmed

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

Internally, the CPU consists of the _______ and the ______

A

Arithmetic Logic Unit and Control Unit

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

A _______ is an example of a secondary storage

A

Disk

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

The two general categories of software are ______ and _____

A

System Software and Application Software

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

A program is a set of _________

A

instructions

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

Since computers can’t be programmed in natural language, algorithms must be writer in a ____________ language

A

Programmable language

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

________ us the only language computers really process

A

machine language

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

_______________ languages are close to the level of humans in terms of readability

A

high level

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

____________ languages are close to the level of the computer

A

low level

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

A program’s ability to run on several different types of computers is called ______________

A

Portability

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

Words that have special meaning in a programming language are called

A

key words

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

Words of names defined by the programmer are called _________

A

programmer defined symbols

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

____________ are characters or symbols that perform operations on one or more operands

A

operators

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

___________ characters or symbols mark the beginning or ending of programming statements, or separate items in a list.

A

punctuation

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

the rules that must be followed when constructing a program are called

A

syntax

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

_______ is a named storage location

A

variable

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

A variable must be ________ before it can be used in a program

A

defined

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

the three primary activities of a program are _______, _______, and ______.

A

input, processing, output

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

_______ is the information a program gathers from the outside world

A

input

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

_____ is information a program sends to the outside world

A

output

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

A ______ is a diagram that graphically illustrates the structure of a program

A

hierarchy chart

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

Every complete statement ends with a ______

A

semicolon

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

which of the following statements is correct?

A

include

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

Every C++ program must have a function _____

A

main

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

Preprocessor directives begin with a _____.

A

#

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

A group of statements, such as the contents of a function, is enclosed in ______ .

A

Braces { }

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

Which of the following statements are not valid in cout statements?

A

all couts need cout <;

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

The negation operator is ____

A

Unary

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

An _____ is like a variable, but its value is read only and cannot be changed during the programs execution

A

named Constant

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

When to processor directives execute?

A

Before the compiler compiles your program

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

A variable must be defined before it can be used?

A

True

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

Variable names may begin with a number?

A

False

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

Variable names may be up to 31 characters long?

A

True

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

A left brace in a C++ program should always be followed by a right brace later in the program

A

True

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

You cannot initialize a named constant that is declared with the const modifier

A

False

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

An expression using the greater than, less than, greater than or equal to, less than or equal to, equal, or not equal to operator is called a _____ expression

A

relational

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

A relational expression is either ______ or ________.

A

true or false

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

The if statement regards an expression with the value 0 as ______

A

False

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

The if statement regard an expression with a nonzero value as ______.

A

True

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

For an if statement to conditionally execute a group of statements, the statement must be enclosed in a set of _________.

A

Braces

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

In an if/else statement, the if past executes its statement or block if the expression is _______, and else part executes its statement or block if the expression is ________.

A

true, false

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

The trailing else is an if/else statement that has a similar purposed as the _______ section of a switch statement

A

default

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

The if / else statement is actually a form of the _____ statement

A

nested

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

If the sub-expression on the left of the _____ logical operator is false. The right sub-expression is not checked.

A

&& And

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

If the sub-expression on the left of an ______ logical operator is true, the right sub-expression is not checked.

A

|| Or

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

The ______ logical operator has higher precedence than the other logical operators.

A

! Net

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

The logical operators have _______ associativity

A

left to right

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

The ________ logical operator works best when testing a number to determine if it is within a range

A

&& And

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

The _______ logical operator works best when testing a number to determine if it is outside a range.

A

|| Or

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

A variable with ______ scope is only visible when the program is executing in the block containing the variables definition

A

block

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

You use the ________ operator to determine whether one string object is greater then another string object.

A

> Greater

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

An expression using the ________ operator is called an conditional expression

A

conditional

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

The expression that is tested by a switch statement must have an _____ value

A

interger

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

The expression following a case statement must be an _____.

A

integer constant

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

A program will “Fall through” a case section if it is missing the _____ statement

A

Break

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

The = operator and the == operator perform the same expression when used in a Boolean expression?

A

False

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

A variable defined in an inner block may not have the same name as a variable defined in the outer block?

A

false

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

A conditionally executed statement should be indented one level from the if statement?

A

True

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

All lines in a block should be indented one level?

A

True

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

It’s safe to assume that all uninitialized variable automatically start with 0 as their value?

A

False

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

When an if statement is nested in the part if part of another statement, the only time the inner if is executed is when the expression of the outer if is true?

A

True

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

When an if statement is nested in the else part of another statement, as in an if else if, the only time the inner if is executed is when the expression of the other if is true?

A

False

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

The scope of a variable is limited to the block in which it is defined

A

True

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

You can use relational operators to compare string objects

A

True

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

x ! = y is the same as (x>y || x<y) ?

A

True

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

y= y ?

A

False

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

x>=y is the same as (x>y && x=y) ?

A

False

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

To ______ a value means to increase it by one and to _____ a value means to decrease it by one?

A

increment, decrement

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

When the increment or decrement operator is place before the operand ( or to the operands left) the operator is being used in the ____mode?

A

prefix

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

When the increment or decrement operator is placed after the operand ( or to the operands right), the operand is being used in the ______ mode.

A

postfix

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

The statement of clock that is repeated is known as the _______ of the loop

A

body

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

Each repetition of a loop is known as a ________.

A

iteration

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

A loop that evaluates its test expression before each repetition is an ____ loop

A

pretest

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

A loop that evaluates its test expression after each repetition is an ______ loop

A

posttest

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

A loop that does not have a way of stopping is called an ________ loop

A

infinite or endless

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

A __________ is a variable that counts the number of times a loop repeats

A

counter

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

A ______ is a sum of numbers that accumulated with each iteration of a loop

A

running total

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

A _________ is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop

A

accumulator

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

A _________ is a special value that marks the end of a series of values

80
Q

The _______ loop is always iterates at least once

81
Q

The ______ and _______ loops will not iterate at all if their test expressions are false to start with

A

while and for

82
Q

The ____ loop is ideal for situations that require a counter

83
Q

Inside the for loop’s parentheses, the first expression is the _______, the second expression is the _________, and the third expression is the ________.

A

initialization, test, update

84
Q

A loop that is inside another loop is called a ________ loop

85
Q

The ___________ statement causes a loop to terminate immediately

86
Q

The _______ statement causes a loop to skip the running statements in the current iteration

87
Q

The operand of the increment and the decrement operators can be any valid mathematical expression.

88
Q

The while loop is a pretest loop?

89
Q

The do while loop is a post test loop

90
Q

It is not necessary to initialize counter variable ?

91
Q

All three of the for loops expressions may be omitted ?

92
Q

One limitation of the for loop is that only one variable is that only one variable may be initialized in the initialization expression?

93
Q

Variables may be defined inside the body of a loop

94
Q

A variable may be defined inside the body of a loop

95
Q

A variable may be defined in the initialization expression of the loop

96
Q

In a nested loop, the outer loop executes faster then the inner loop?

97
Q

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop ?

98
Q

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops?

99
Q

The break statement causes a loop to stop the current iteration and begin the next one ?

100
Q

The continue statement causes a terminated loop to resume?

101
Q

In a nested loop, the break statement only interrupts the loop it is placed in.

102
Q

When you call an ofstream object’s member function, the specified file will be erased if it already exists?

103
Q

The ______ is the part of a function definition that shows the function name, return type, and parameter list?

104
Q

If a function doesn’t return a value, the word ____ will appear as its return type?

105
Q

Either a functions _____ or it’s _____ must precede all calls to the function?

A

definition, prototype

106
Q

Values that are sent into a function are called ______ .

107
Q

Special variables that hold copies of function argument are called _____.

A

parameters

108
Q

When only a copy of an argument is passed to a function, it is said to be passed by ______.

109
Q

A _____ eliminates the need to place a function definition before all calls to the function.

110
Q

A ______ variable is defined inside a function and is not accessible outside the function.

111
Q

_____ variables are defined outside all functions and are accessible to any function within their scope

112
Q

_____ variables provide an easy way to share large amounts of data among all the functions in a program.

113
Q

Unless you explicitly initialize global variables, they are automatically initialized to _______.

114
Q

If a function had a local variable with the same name as a global variable, only the _____ variable can be seen by the function.

115
Q

______ local variables retain their value between function calls

116
Q

The _____ statement causes a function to end immediately

117
Q

______ arguments are passed to parameters automatically if no argument is provided in the function call

118
Q

When a function uses a mixture of parameters with and without default arguments, the parameters with default arguments must be defined

119
Q

The value of a default argument must be a _______.

120
Q

When used as parameters, ______ variables allow a function to access the parameters original argument.

121
Q

Reference variables are defined like regular variables, except there is an ______ in front of the name.

122
Q

The _____ function causes a program to terminate

123
Q

Two or more functions may have the same name as long as their _____ are different

A

parameter lists

124
Q

Functions should be given names that reflect their purpose?

125
Q

Function headers are terminated with a semicolon?

126
Q

Function prototypes are terminated with a semicolon ?

127
Q

If other functions are defined before the main, the program still starts executing at the main function?

128
Q

When a function terminates, it always branches back to the main, regardless where it was called from?

129
Q

Arguments are passed to the function parameters in the order they appear in the function call?

130
Q

The scope of the parameter is limited to the function which uses it?

131
Q

Changes to a function parameter always affect the original arguments as well?

132
Q

In a function prototype, the names of the parameter variables may be left out?

133
Q

Many functions may have local variables with the same name?

134
Q

Overuse of global variables can lead to problems?

135
Q

Static local variables are not destroyed when a function returns?

136
Q

All static variables are initialized to -1 by default?

137
Q

Initialization of static local variables only happen once, regardless of how many times the function in which they are defined is called?

138
Q

When a function with default arguments is called an argument is left out, all arguments that come after it must be left out as well?

139
Q

It is not possible for a function to have some parameters with default arguments and some without?

140
Q

The exit function can only be called from the main?

141
Q

A stub is a dummy function that is called instead of the actual function it represents?

142
Q

The ____ indicated the number of elements, or values, an array can hold?

A

Size declarator

143
Q

The size declamatory must be an ______ with a value greater than _____.

A

integer, 0

144
Q

The element of an array is accessed and indexed by a number known as a ______.

145
Q

Subscript numbering in C++ always starts _____.

146
Q

The number inside the brackets of an array definition is the ____. But the number inside the arrays brackets in an assignment statement, or any other statement that works with the contents of the array is the ____.

A

size declarator, subscript

147
Q

C++ has no array ________ checking, which means you can inadvertently store data past the end of an array.

148
Q

Starting values for an array may be specified with ______ list.

A

Initialization

149
Q

If an array is partially initialized the uninitialized elements will be set to _______.

150
Q

If the size declamatory of an array definition is omitted, C++ counts the number of times in the _______ to determine how large the array should be.

A

initialization list

151
Q

By using the same _______ for multiple arrays, you can build relationships between the data stored in the arrays

A

subscripts

152
Q

You cannot use the ______ operator to copy data from one array to another array in a single statement

A

Assignment =

153
Q

Any time the name of an array is used without brackets and a subscript, it is seen as ______.

A

an address

154
Q

To pass an array to a function, pass the _______ of the array.

A

address, or name

155
Q

An _____ array is like several arrays of the same type put together

A

multi-dimensional

156
Q

It is best to think of a two dimensional array as having ____ and _____.

A

rows, columns

157
Q

To define a two dimensional array, _____ size declarators are required

158
Q

When initializing a two dimensional array, it helps to enclose each rows initialization list in ______.

159
Q

When two dimensional array is passed to a function the ________ size must be specified.

160
Q

The _____ is a collection of programmer defined data types and algorithms that you may use in your programs.

A

Standard Template Library (or STL)

161
Q

The two types of containers defined by the STL are _____ and _____.

A

Sequence and associative

162
Q

The vector data type is an _____ container

163
Q

To define a vector in your program, you must #include the ______ header file.

164
Q

To store a value in a vector that does not have a starting size, or that is already fill, use the ______ member function.

165
Q

To determine the number of elements in a vector, use the _____ member function.

166
Q

Use the ______ member function to remove the last element from a vector.

167
Q

To completely clear the contents of a vector, use the ____ member function.

168
Q

An array’s size declarator can be either a literal, named constant, or a variable?

169
Q

To calculate the amount of memory used by an array, multiply the number of elements by the number of bytes each element uses?

170
Q

The individual elements of an array are accessed and indexed by unique numbers?

171
Q

The first element in an array is accessed by the subscript 1?

172
Q

The subscript of the last element in an single dimensional array is one less then the total number of elements in the array?

173
Q

The contents of an array element cannot be displayed with cout?

174
Q

Subscript numbers may be stored in variables?

175
Q

You can write program that use invalid subscripts for an array?

176
Q

Arrays can not be initialized when they are defined. A loop of other means must be used?

177
Q

The values in an initialization list are stored in the array in the order they appear in the list?

178
Q

C++ allows you to partially initialize and array?

179
Q

If an array is partially initialized, the uninitialized elements will contain “garbage”?

180
Q

If you leave an element uninitialized, you do not have to leave all the ones that follow it uninitialized?

181
Q

If you leave out the size of the declarator of an array definition, you do not have to include the initialization list

182
Q

The uninitialized elements of a string array will automatically be set to the value of 0?

183
Q

You cannot use the assignment operator to copy one array’s contents to another in a single statement?

184
Q

When an array name used without brackets and a subscript, it is seen as the value of the first element in the array?

185
Q

To pass an array to a function, pass the name of the array?

186
Q

When defining a parameter variable to hold a single dimensional array argument, you do not have to include the size declarator.

187
Q

When an array is passed to a function, the function has access to the original array?

188
Q

A two dimensional array is like several identical arrays put together?

189
Q

It’s best to think of 2D arrays as having rows and columns?

190
Q

The first size declarator (in the declaration of a 2D array) represents the number of columns. The second size definition represents the number of rows?

191
Q

2D arrays may be passed to functions, but the row size must be specified in the definition of the parameter variable?

192
Q

C++ allows you to create arrays with three or more dimensions?

193
Q

A vector is an associative container?

194
Q

To use a vector, you must include the vector header file?

195
Q

Vectors can report the number of elements they contain?

196
Q

You can use the [ ] operator to insert a value into a vector that has no elements?

197
Q

If you add a value to a vector that is already full, the vector will automatically increase its size to accommodate the new value?