C++ Flashcards

(198 cards)

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
Every C++ program must have a function _____
main
25
Preprocessor directives begin with a _____.
#
26
A group of statements, such as the contents of a function, is enclosed in ______ .
Braces { }
27
Which of the following statements are not valid in cout statements?
all couts need cout <;
28
The negation operator is ____
Unary
29
An _____ is like a variable, but its value is read only and cannot be changed during the programs execution
named Constant
30
When to processor directives execute?
Before the compiler compiles your program
31
A variable must be defined before it can be used?
True
32
Variable names may begin with a number?
False
33
Variable names may be up to 31 characters long?
True
34
A left brace in a C++ program should always be followed by a right brace later in the program
True
35
You cannot initialize a named constant that is declared with the const modifier
False
36
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
relational
37
A relational expression is either ______ or ________.
true or false
38
The if statement regards an expression with the value 0 as ______
False
39
The if statement regard an expression with a nonzero value as ______.
True
40
For an if statement to conditionally execute a group of statements, the statement must be enclosed in a set of _________.
Braces
41
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 ________.
true, false
42
The trailing else is an if/else statement that has a similar purposed as the _______ section of a switch statement
default
43
The if / else statement is actually a form of the _____ statement
nested
44
If the sub-expression on the left of the _____ logical operator is false. The right sub-expression is not checked.
&& And
45
If the sub-expression on the left of an ______ logical operator is true, the right sub-expression is not checked.
|| Or
46
The ______ logical operator has higher precedence than the other logical operators.
! Net
47
The logical operators have _______ associativity
left to right
48
The ________ logical operator works best when testing a number to determine if it is within a range
&& And
49
The _______ logical operator works best when testing a number to determine if it is outside a range.
|| Or
50
A variable with ______ scope is only visible when the program is executing in the block containing the variables definition
block
51
You use the ________ operator to determine whether one string object is greater then another string object.
> Greater
52
An expression using the ________ operator is called an conditional expression
conditional
53
The expression that is tested by a switch statement must have an _____ value
interger
54
The expression following a case statement must be an _____.
integer constant
55
A program will "Fall through" a case section if it is missing the _____ statement
Break
56
The = operator and the == operator perform the same expression when used in a Boolean expression?
False
57
A variable defined in an inner block may not have the same name as a variable defined in the outer block?
false
58
A conditionally executed statement should be indented one level from the if statement?
True
59
All lines in a block should be indented one level?
True
60
It's safe to assume that all uninitialized variable automatically start with 0 as their value?
False
61
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?
True
62
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?
False
63
The scope of a variable is limited to the block in which it is defined
True
64
You can use relational operators to compare string objects
True
65
x ! = y is the same as (x>y || x
True
66
y= y ?
False
67
x>=y is the same as (x>y && x=y) ?
False
68
To ______ a value means to increase it by one and to _____ a value means to decrease it by one?
increment, decrement
69
When the increment or decrement operator is place before the operand ( or to the operands left) the operator is being used in the ____mode?
prefix
70
When the increment or decrement operator is placed after the operand ( or to the operands right), the operand is being used in the ______ mode.
postfix
71
The statement of clock that is repeated is known as the _______ of the loop
body
72
Each repetition of a loop is known as a ________.
iteration
73
A loop that evaluates its test expression before each repetition is an ____ loop
pretest
74
A loop that evaluates its test expression after each repetition is an ______ loop
posttest
75
A loop that does not have a way of stopping is called an ________ loop
infinite or endless
76
A __________ is a variable that counts the number of times a loop repeats
counter
77
A ______ is a sum of numbers that accumulated with each iteration of a loop
running total
78
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
accumulator
79
A _________ is a special value that marks the end of a series of values
sentinel
80
The _______ loop is always iterates at least once
do while
81
The ______ and _______ loops will not iterate at all if their test expressions are false to start with
while and for
82
The ____ loop is ideal for situations that require a counter
for
83
Inside the for loop's parentheses, the first expression is the _______, the second expression is the _________, and the third expression is the ________.
initialization, test, update
84
A loop that is inside another loop is called a ________ loop
nested
85
The ___________ statement causes a loop to terminate immediately
break
86
The _______ statement causes a loop to skip the running statements in the current iteration
continue
87
The operand of the increment and the decrement operators can be any valid mathematical expression.
false
88
The while loop is a pretest loop?
true
89
The do while loop is a post test loop
false
90
It is not necessary to initialize counter variable ?
False
91
All three of the for loops expressions may be omitted ?
true
92
One limitation of the for loop is that only one variable is that only one variable may be initialized in the initialization expression?
False
93
Variables may be defined inside the body of a loop
True
94
A variable may be defined inside the body of a loop
True
95
A variable may be defined in the initialization expression of the loop
True
96
In a nested loop, the outer loop executes faster then the inner loop?
False
97
In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop ?
True
98
To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops?
False
99
The break statement causes a loop to stop the current iteration and begin the next one ?
False
100
The continue statement causes a terminated loop to resume?
False
101
In a nested loop, the break statement only interrupts the loop it is placed in.
True
102
When you call an ofstream object's member function, the specified file will be erased if it already exists?
True
103
The ______ is the part of a function definition that shows the function name, return type, and parameter list?
header
104
If a function doesn't return a value, the word ____ will appear as its return type?
void
105
Either a functions _____ or it's _____ must precede all calls to the function?
definition, prototype
106
Values that are sent into a function are called ______ .
arguments
107
Special variables that hold copies of function argument are called _____.
parameters
108
When only a copy of an argument is passed to a function, it is said to be passed by ______.
Value
109
A _____ eliminates the need to place a function definition before all calls to the function.
prototype
110
A ______ variable is defined inside a function and is not accessible outside the function.
local
111
_____ variables are defined outside all functions and are accessible to any function within their scope
global
112
_____ variables provide an easy way to share large amounts of data among all the functions in a program.
global
113
Unless you explicitly initialize global variables, they are automatically initialized to _______.
Zero
114
If a function had a local variable with the same name as a global variable, only the _____ variable can be seen by the function.
local
115
______ local variables retain their value between function calls
static
116
The _____ statement causes a function to end immediately
return
117
______ arguments are passed to parameters automatically if no argument is provided in the function call
default
118
When a function uses a mixture of parameters with and without default arguments, the parameters with default arguments must be defined
last
119
The value of a default argument must be a _______.
constant
120
When used as parameters, ______ variables allow a function to access the parameters original argument.
reference
121
Reference variables are defined like regular variables, except there is an ______ in front of the name.
&
122
The _____ function causes a program to terminate
exit
123
Two or more functions may have the same name as long as their _____ are different
parameter lists
124
Functions should be given names that reflect their purpose?
True
125
Function headers are terminated with a semicolon?
False
126
Function prototypes are terminated with a semicolon ?
True
127
If other functions are defined before the main, the program still starts executing at the main function?
True
128
When a function terminates, it always branches back to the main, regardless where it was called from?
False
129
Arguments are passed to the function parameters in the order they appear in the function call?
True
130
The scope of the parameter is limited to the function which uses it?
True
131
Changes to a function parameter always affect the original arguments as well?
False
132
In a function prototype, the names of the parameter variables may be left out?
True
133
Many functions may have local variables with the same name?
True
134
Overuse of global variables can lead to problems?
True
135
Static local variables are not destroyed when a function returns?
True
136
All static variables are initialized to -1 by default?
False
137
Initialization of static local variables only happen once, regardless of how many times the function in which they are defined is called?
True
138
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?
True
139
It is not possible for a function to have some parameters with default arguments and some without?
False
140
The exit function can only be called from the main?
False
141
A stub is a dummy function that is called instead of the actual function it represents?
True
142
The ____ indicated the number of elements, or values, an array can hold?
Size declarator
143
The size declamatory must be an ______ with a value greater than _____.
integer, 0
144
The element of an array is accessed and indexed by a number known as a ______.
subscript
145
Subscript numbering in C++ always starts _____.
Zero
146
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 ____.
size declarator, subscript
147
C++ has no array ________ checking, which means you can inadvertently store data past the end of an array.
bounds
148
Starting values for an array may be specified with ______ list.
Initialization
149
If an array is partially initialized the uninitialized elements will be set to _______.
Zero
150
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.
initialization list
151
By using the same _______ for multiple arrays, you can build relationships between the data stored in the arrays
subscripts
152
You cannot use the ______ operator to copy data from one array to another array in a single statement
Assignment =
153
Any time the name of an array is used without brackets and a subscript, it is seen as ______.
an address
154
To pass an array to a function, pass the _______ of the array.
address, or name
155
An _____ array is like several arrays of the same type put together
multi-dimensional
156
It is best to think of a two dimensional array as having ____ and _____.
rows, columns
157
To define a two dimensional array, _____ size declarators are required
two
158
When initializing a two dimensional array, it helps to enclose each rows initialization list in ______.
braces
159
When two dimensional array is passed to a function the ________ size must be specified.
column
160
The _____ is a collection of programmer defined data types and algorithms that you may use in your programs.
Standard Template Library (or STL)
161
The two types of containers defined by the STL are _____ and _____.
Sequence and associative
162
The vector data type is an _____ container
sequence
163
To define a vector in your program, you must #include the ______ header file.
Vector
164
To store a value in a vector that does not have a starting size, or that is already fill, use the ______ member function.
push_back
165
To determine the number of elements in a vector, use the _____ member function.
size
166
Use the ______ member function to remove the last element from a vector.
pop_back
167
To completely clear the contents of a vector, use the ____ member function.
clear
168
An array's size declarator can be either a literal, named constant, or a variable?
False
169
To calculate the amount of memory used by an array, multiply the number of elements by the number of bytes each element uses?
True
170
The individual elements of an array are accessed and indexed by unique numbers?
True
171
The first element in an array is accessed by the subscript 1?
False
172
The subscript of the last element in an single dimensional array is one less then the total number of elements in the array?
True
173
The contents of an array element cannot be displayed with cout?
False
174
Subscript numbers may be stored in variables?
True
175
You can write program that use invalid subscripts for an array?
True
176
Arrays can not be initialized when they are defined. A loop of other means must be used?
False
177
The values in an initialization list are stored in the array in the order they appear in the list?
True
178
C++ allows you to partially initialize and array?
True
179
If an array is partially initialized, the uninitialized elements will contain "garbage"?
False
180
If you leave an element uninitialized, you do not have to leave all the ones that follow it uninitialized?
False
181
If you leave out the size of the declarator of an array definition, you do not have to include the initialization list
False
182
The uninitialized elements of a string array will automatically be set to the value of 0?
False
183
You cannot use the assignment operator to copy one array's contents to another in a single statement?
True
184
When an array name used without brackets and a subscript, it is seen as the value of the first element in the array?
False
185
To pass an array to a function, pass the name of the array?
True
186
When defining a parameter variable to hold a single dimensional array argument, you do not have to include the size declarator.
True
187
When an array is passed to a function, the function has access to the original array?
True
188
A two dimensional array is like several identical arrays put together?
True
189
It's best to think of 2D arrays as having rows and columns?
True
190
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?
False
191
2D arrays may be passed to functions, but the row size must be specified in the definition of the parameter variable?
False
192
C++ allows you to create arrays with three or more dimensions?
True
193
A vector is an associative container?
False
194
To use a vector, you must include the vector header file?
True
195
Vectors can report the number of elements they contain?
True
196
You can use the [ ] operator to insert a value into a vector that has no elements?
False
197
If you add a value to a vector that is already full, the vector will automatically increase its size to accommodate the new value?
True