Exam1 Flashcards

1
Q

What does ALU stand for ?

A

Arithmetic and logic unit

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

What is the F D E cycle called?

A

Fetch Decode Execute

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

A machine language program consists of a sequence of ____ which the CPU interprets as commands

A

Binary Numbers

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

A ___ is close to the level of the computer, which means it resembles
the numeric machine language of the computer more than the natural language of humans.
The easiest languages for people to learn are high-level languages. They are called “high

A

low-level language

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

C was created by whom?

A

Bell Laboratories

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

When a C++ program is written, it must be typed into the computer and saved to a file…True/False

A

True

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

C++ is written in a _____

A

text editor

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

The statements written by the programmer are called ____________

A

source code

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

File saved by C++ is called _________

A

source file

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

After the source code is saved to a file, the process of translating it to machine language
can begin. During the first phase of this process, a program _______ reads the source code

A

preprocessor

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

IDE’s consist of what main components?

A

text editor, compiler, debugger

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

Programming Cycle is composed of 7 items

A

source code, preprocessor, modified source code, compiler, object code, linker, executable code

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

Programming Langues include 5 language elements

A

key words, programmer defined identifiers, operators, punctuation, syntax

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

= is an ____

A

operator

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

a semicolon is part of what programming language element

A

punctuation

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

A __ is a complete instruction that causes the computer to perform some action.

A

statement

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

A ___ is a named storage location in the computer’s memory for holding a piece of data.

A

variable

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

variables are stored in computer’s _____

A

RAM

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

variables are usually _____ and _____

A

characters and numbers

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

A ____ is a diagram that graphically depicts the structure of a program

A

hierarchy chart

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

A ____ is a diagram that shows the logical flow of a program.

A

flowchart

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

______is a cross between human language and a programming language.

A

pseudocode

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

____, also called logic errors, are mistakes that cause a program to produce erroneous results.

A

logical errors

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

// means

A

comment

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

When a line begins with a #it indicates it

is a _______

A

preprocessor directive

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

The ________ contains code that allows a C++ program to display output on
the screen and read input from the keyboard

A

iostream file

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

The iostream file is called a ________file, so it

should be included at the head, or top, of the program.

A

header

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

using namespace std; is a _____ file

A

header

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

The statement using ___ declares that the program will be accessing entities whose names are part of the namespace called std.

A

namespace std;

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

A ___can be thought of as a group of one or

more programming statements that has a name

A

function

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

what is the name of this function? int main()

A

main

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

what character is associated with the beginning and ending of a function

A

braces {}

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

the group of characters

inside the quotation marks is called a ______

A

string

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

what line sends the integer value 0 back to the operating system upon the program’s completion.

A

return 0;

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

Marks the beginning of a comment.

A

//

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

Marks the beginning of a preprocessor directive.

A

#

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

Encloses a filename when used with the #include

directive

A

< >

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

Used in naming a function, as in int main()

A

()

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

Encloses a group of statements, such as the contents of a function.

A

{}

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

Encloses a string of characters, such as a message that is to
be printed on the screen.

A

” “

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

Marks the end of a complete programming statement.

A

;

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

___ is used to display information on the computer’s screen.

A

cout

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

When the «

symbol is used this way _____

A

stream-insertion operator

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

endl means

A

end line

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

\nis an example of an

A

escape sequence

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

Causes the cursor to go to the next line for subsequent printing.

A

\n

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

Causes the cursor to skip over to the next tab stop

A

\t

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

The _____ directive causes the contents of another file to be inserted
into the program.

A

include

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

include is part of what library

A

input-output stream library

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

______ represent storage locations in the computer’s memory.

A

Variables

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

_______ are data items whose values cannot change while the program
is running

A

constants

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

number = 5; is an ______ and = is called a _______

A

assignment statement and the = sign is called the assignment operator.

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

The item on the left hand side of an assignment statement must be a _____

A

variable

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

constants variable names must always be ?

A

CAPITALIZED

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

and cannot be used as a variable…true/false

A

true

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

3dGraph can be a variable name..true/false

A

false

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

Mixture#3 can be a variable name..true/false

A

false

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

Integers are whole numbers like −2, 19, and 24. True/False

A

True

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

Floating-point numbers have a decimal

point like −2.35, 19.0, and 0.024 True/False

A

True

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

int data type can hold how many bytes?

A

4

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

A variable of the ____data type holds only a single character.

A

char

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

what character set type do you reference?

A

ASCII

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

what is the class for string?

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

what is the preprocessor header for string?

A

include

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

what is a string variable type?

A

string object

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

Floating-point data types are used to define variables that can hold real numbers. True/False

A

True

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

The floatdata type is considered ____

A

single precision.

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

The doubledata type is usually twice

as big as float, so it is considered ____

A

double precision

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

Boolean variables are set to either ___ or ____

A

true or false

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

A variable’s ___ is the part of the program that has access to the variable.

A

scope

71
Q

% is an arithmetic operator to do ?

A

modulus or remainder = value % 3;

72
Q

/* is a

A

multi-line comment

73
Q

__ can be used to read data typed at the keyboard.

A

cin

74
Q

is this correct?

cin&raquo_space; length;

A

yes

75
Q

is this correct?

cin &laquo_space;width;

A

no

76
Q

The&raquo_space;symbol is the stream extraction operator..true/false

A

true

77
Q

It gets characters from the stream object on its left and stores them in the
variable whose name appears on its right

A

> >

78
Q

&laquo_space;and&raquo_space; operators appear to point in the direction that data is flowing..true/false

A

true

79
Q

Raising a number to a power requires the use of a ______

A

library function

80
Q

what is missing when you want to do an exponent?

area = (4.0, 2);

A

area = pow(4.0, 2);

81
Q

does a double outrank higher than a float?

A

yes

82
Q

if you want to use setw then you need to use header file ____

A

include

83
Q

Floating-point values may be rounded to a number of significant digits, or ____ , which
is the total number of digits that appear before and after the decimal point.

A

precision

84
Q

28.92786 with setprecision(3) will show ?

A

28.9

85
Q

If a number is too large to print using the number of digits specified with setprecision,
many systems print it in scientific notation so use _____

A

fixed

86
Q

____ which indicates that a decimal point should
be printed for a floating-point number, even if the value being displayed has no decimal
112 Chapter 3 Expressions and Interactivity
igits.

A

showpoint

87
Q

Sets the display field width to size n

A

setw(n)

88
Q

Displays floating-point numbers in fixed (i.e., decimal) form

A

fixed

89
Q

Displays the decimal point and trailing zeroes for floating-point numbers even if there is no fractional part

A

showpoint

90
Q

If the fixedmanipulator is notset, nindicates the total number of significant digits to display. If the fixedmanipulator is set, nindicates the number of decimal digits to display.

A

setprecision(n)

91
Q

This function will read in an entire line, including leading and embedded spaces, and store it in a string object.

A

getline

92
Q

correct syntax for getline is ____

A

getline(cin, inputLine);

93
Q

The _____ in cin reads a single character, including any whitespace character.

A

getfunction

94
Q

If the program is using the getfunction simply to hold the screen until the [Enter]key is
pressed and does not need to store the character, the function can also be called like this:

A

cin.get();

95
Q

what does this do?
cout &laquo_space;“Enter a number: “;
cin&raquo_space; number;

A

reads an integer

96
Q

what does this do?
cout &laquo_space;“Enter a character: “;
ch = cin.get();

A

reads a character

97
Q

This function tells the cin

object to skip characters in the keyboard buffer ___

A

cin.ignore(n, c);

98
Q

char name[SIZE]; // name is a set of 12 memory cells

is called a?

A

c-string

99
Q

Returns the square root of the argument. The return type and argument are doubles. The argument must be zero or greater.

A

sqrt

100
Q

To use the rand()function, you must include the ____header file in your program

A

cstdlib

101
Q

The number returned by the rand() function is an ____

A

int

102
Q

randomNum = rand(); is an example of the ___ function

A

rand

103
Q

rand needs a starting value, called

a _____, to generate the numbers

A

seed

104
Q

There are five steps that must be taken when a file is used by a program:

A
  1. Include the header file needed to perform file input/output.
  2. Define a file stream object.
  3. Open the file.
  4. Use the file.
  5. Close the file.
105
Q

which header file for a a file IO?

A

include

106
Q

Output file stream

A

ofstream

107
Q

Input file stream

A

ifstream

108
Q

File stream. This data type can be used to open files, write data to them, and
read data from them

A

fstream

109
Q

true/false: correct way to open a file?

inputFile.open(“customer.dat”); // Open an input file

A

true

110
Q

The ____ operator not only reads user input from the cin object, but it can also be used to
read data from a file

A

> >

111
Q

how to call the file stream objects close function to close a file

A

outputFile.close();

112
Q

Numeric data is compared in C++ by using _____ _____

A

relational operators

113
Q

== is a _______ meaning _____

A

relational operator meaning equal

114
Q

!= is

A

not equal to

115
Q

if xis 10 and y is 7 then this is true/false:

x <= y

A

false, because xis not less than or equal to y.

116
Q

if xis 10 and y is 7 then this is true/false:

y != x

A

true, because yis not equal to x

117
Q

True/False, relational operators have a higher precedence than the assignment operator

A

true

118
Q

True/False, arithmetic operators have a lower precedence than relational operators

A

false

119
Q

when statements are executed in sequence, one after another, without branching off in another direction.

A

sequence structure

120
Q

algorithms require a program to execute some statements only under certain circumstances

A

decision tree

121
Q

most common way to code a decision structure in C++ is with the ____ statement

A

if

122
Q

true/false: Semicolons do not mark the end of a line, but the end of a complete C++ statement.

A

true

123
Q

if (condition); …true/false

A

false, no semicolon

124
Q

The ____ statement will execute one set of statements when the if
condition is true, and another set when the condition is false.

A

if/else

125
Q

Division by _____ is mathematically impossible to perform and it normally causes a program
to crash.

A

zero

126
Q

true/false: The if/else if statement is a chain of if statements. They perform their
tests, one after the other, until one of them is found to be true.

A

true

127
Q

what type of statement is this?
if it is very cold, wear a heavy coat,
else, if it is chilly, wear a light jacket,
else, if it is windy, wear a windbreaker,
else, if it is hot, wear no jacket.

A

if/else ifstatement

128
Q

what type of variable does this hold?

char grade;

A

holds a letter

129
Q

____ connect two or more relational expressions into one or

reverse the logic of an expression.

A

Logical operators

130
Q

&& is what logical operator?

A

AND

131
Q

|| is what logical operator?

A

OR

132
Q

! is what logical operator?

A

NOT

133
Q

Connects two expressions into one. Both expressions must be true
for the overall expression to be true.

A

&&

AND

134
Q

Connects two expressions into one. One or both expressions must
be true for the overall expression to be true. It is only necessary for
one to be true, and it does not matter which

A

||

OR

135
Q

Reverses the “truth” of an expression. It makes a true expression false, and a false expression true

A

!

NOT

136
Q

What is the value of this expression?

true && false

A

false (0)

137
Q

What is the value of this expression?

false || true

A

true (1)

138
Q

true/false: All it takes for an OR expression to be true is for one of the sub-expressions to be true. It
doesn’t matter if the other sub-expression is false or true

A

true

139
Q

What is the value of this expression?

!false

A

true(1)

140
Q

What is the precedence of Logical Operators?

A

!
&&
||

141
Q

___ is the process of inspecting

information given to a program by the user and determining if it is valid

A

Input validation

142
Q

Relational operators can also be used to compare ____ and string
objects.

A

characters

143
Q

The ____ statement lets the value of a variable or expression determine
where the program will branch to.

A

switch

144
Q

switch statements involve ___ statements

A

case

145
Q

The ___ statement causes the program to exit the switchstatement

A

break

146
Q

An ____ data type is a

programmer-defined data type that contains a set of named integer constants

A

enumerated

147
Q

in this value assignment, what value will red be assigned to:
enum Colors { red, orange, yellow = 9, green, blue };

A

0

148
Q

Below is called:
num = num + 1;
num += 1;
num++;

A

incrementing

149
Q

Below is called:
num = num - 1;
num -= 1;
num–;

A

decrementing

150
Q

when the operator is placed after the variable

A

postfix mode

151
Q

when the operator is placed before the variable name

A

prefix mode

152
Q

++num; is what type of mode?

A

prefix mode

153
Q

a control structure that causes a statement or group of statements to repeat

A

a loop

154
Q

each execution of a loop is called an

A

iteration

155
Q

a variable that controls the number of time a loop iterates is refered to a ___ _____ _____

A

loop control variable

156
Q

by placing a semicolon after the first line of a while loop you can create an

A

infinite loop

157
Q

process of inspecting data given to a program by the user and determining if it is valid

A

input validation

158
Q

a variable that is regularly incremented or decremented each time a loop itierates

A

counter

159
Q

the ____ ____ loop is a post test loop

A

do-while

160
Q

you do this loop when you want to make sure the loop executes at least once

A

do-while

161
Q

which type of loop is good for a menu

A

do-while

162
Q

a pretest loop that combines the initialization, testing, and updating of a loop control variable in a single loop header

A

for loop

163
Q

for loops contain three things

A

initialization, test, update

164
Q

in a for loop if the initialization makes the test expression false, will the loop run?

A

no

165
Q

a sum of numbers that accumulates with each iteration of a loop

A

running total

166
Q

variable used to keep the running total is called a

A

accumulator

167
Q

a special value that marks the end of a list of values

A

sentinel

168
Q

what is the end of file function for an inputfile

A

inputFile.eof

169
Q

use the ____ loop where you do not want the loop to iterate if the test condition is false from the beginning

A

while

170
Q

use the ___ loop where you always want the loop to iterate at least once

A

do-while

171
Q

use the ___ loop when you the exact number of iterations is known

A

for loop

172
Q

nested loops have _____ and ____ loops

A

inner/outer

173
Q

___ statements cause a loop to terminate early

A

break

174
Q

_____ statement causes a loop to stop its current iteration and begin the next one

A

continue