Exam1 Flashcards

(174 cards)

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
When a line begins with a #it indicates it | is a _______
preprocessor directive
26
The ________ contains code that allows a C++ program to display output on the screen and read input from the keyboard
iostream file
27
The iostream file is called a ________file, so it | should be included at the head, or top, of the program.
header
28
using namespace std; is a _____ file
header
29
The statement using ___ declares that the program will be accessing entities whose names are part of the namespace called std.
namespace std;
30
A ___can be thought of as a group of one or | more programming statements that has a name
function
31
what is the name of this function? int main()
main
32
what character is associated with the beginning and ending of a function
braces {}
33
the group of characters | inside the quotation marks is called a ______
string
34
what line sends the integer value 0 back to the operating system upon the program’s completion.
return 0;
35
Marks the beginning of a comment.
//
36
Marks the beginning of a preprocessor directive.
#
37
Encloses a filename when used with the #include | directive
< >
38
Used in naming a function, as in int main()
()
39
Encloses a group of statements, such as the contents of a function.
{}
40
Encloses a string of characters, such as a message that is to be printed on the screen.
" "
41
Marks the end of a complete programming statement.
;
42
___ is used to display information on the computer’s screen.
cout
43
When the << | symbol is used this way _____
stream-insertion operator
44
endl means
end line
45
\nis an example of an
escape sequence
46
Causes the cursor to go to the next line for subsequent printing.
\n
47
Causes the cursor to skip over to the next tab stop
\t
48
The _____ directive causes the contents of another file to be inserted into the program.
#include
49
#include is part of what library
input-output stream library
50
______ represent storage locations in the computer’s memory.
Variables
51
_______ are data items whose values cannot change while the program is running
constants
52
number = 5; is an ______ and = is called a _______
assignment statement and the = sign is called the assignment operator.
53
The item on the left hand side of an assignment statement must be a _____
variable
54
constants variable names must always be ?
CAPITALIZED
55
and cannot be used as a variable...true/false
true
56
3dGraph can be a variable name..true/false
false
57
Mixture#3 can be a variable name..true/false
false
58
Integers are whole numbers like −2, 19, and 24. True/False
True
59
Floating-point numbers have a decimal | point like −2.35, 19.0, and 0.024 True/False
True
60
int data type can hold how many bytes?
4
61
A variable of the ____data type holds only a single character.
char
62
what character set type do you reference?
ASCII
63
what is the class for string?
64
what is the preprocessor header for string?
#include
65
what is a string variable type?
string object
66
Floating-point data types are used to define variables that can hold real numbers. True/False
True
67
The floatdata type is considered ____
single precision.
68
The doubledata type is usually twice | as big as float, so it is considered ____
double precision
69
Boolean variables are set to either ___ or ____
true or false
70
A variable’s ___ is the part of the program that has access to the variable.
scope
71
% is an arithmetic operator to do ?
modulus or remainder = value % 3;
72
/* is a
multi-line comment
73
__ can be used to read data typed at the keyboard.
cin
74
is this correct? | cin >> length;
yes
75
is this correct? | cin << width;
no
76
The >>symbol is the stream extraction operator..true/false
true
77
It gets characters from the stream object on its left and stores them in the variable whose name appears on its right
>>
78
<< and >> operators appear to point in the direction that data is flowing..true/false
true
79
Raising a number to a power requires the use of a ______
library function
80
what is missing when you want to do an exponent? | area = (4.0, 2);
area = pow(4.0, 2);
81
does a double outrank higher than a float?
yes
82
if you want to use setw then you need to use header file ____
#include
83
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.
precision
84
28.92786 with setprecision(3) will show ?
28.9
85
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 _____
fixed
86
____ 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.
showpoint
87
Sets the display field width to size n
setw(n)
88
Displays floating-point numbers in fixed (i.e., decimal) form
fixed
89
Displays the decimal point and trailing zeroes for floating-point numbers even if there is no fractional part
showpoint
90
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.
setprecision(n)
91
This function will read in an entire line, including leading and embedded spaces, and store it in a string object.
getline
92
correct syntax for getline is ____
getline(cin, inputLine);
93
The _____ in cin reads a single character, including any whitespace character.
getfunction
94
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:
cin.get();
95
what does this do? cout << "Enter a number: "; cin >> number;
reads an integer
96
what does this do? cout << "Enter a character: "; ch = cin.get();
reads a character
97
This function tells the cin | object to skip characters in the keyboard buffer ___
cin.ignore(n, c);
98
char name[SIZE]; // name is a set of 12 memory cells | is called a?
c-string
99
Returns the square root of the argument. The return type and argument are doubles. The argument must be zero or greater.
sqrt
100
To use the rand()function, you must include the ____header file in your program
cstdlib
101
The number returned by the rand() function is an ____
int
102
randomNum = rand(); is an example of the ___ function
rand
103
rand needs a starting value, called | a _____, to generate the numbers
seed
104
There are five steps that must be taken when a file is used by a program:
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
which header file for a a file IO?
#include
106
Output file stream
ofstream
107
Input file stream
ifstream
108
File stream. This data type can be used to open files, write data to them, and read data from them
fstream
109
true/false: correct way to open a file? | inputFile.open("customer.dat"); // Open an input file
true
110
The ____ operator not only reads user input from the cin object, but it can also be used to read data from a file
>>
111
how to call the file stream objects close function to close a file
outputFile.close();
112
Numeric data is compared in C++ by using _____ _____
relational operators
113
== is a _______ meaning _____
relational operator meaning equal
114
!= is
not equal to
115
if xis 10 and y is 7 then this is true/false: | x <= y
false, because xis not less than or equal to y.
116
if xis 10 and y is 7 then this is true/false: | y != x
true, because yis not equal to x
117
True/False, relational operators have a higher precedence than the assignment operator
true
118
True/False, arithmetic operators have a lower precedence than relational operators
false
119
when statements are executed in sequence, one after another, without branching off in another direction.
sequence structure
120
algorithms require a program to execute some statements only under certain circumstances
decision tree
121
most common way to code a decision structure in C++ is with the ____ statement
if
122
true/false: Semicolons do not mark the end of a line, but the end of a complete C++ statement.
true
123
if (condition); ...true/false
false, no semicolon
124
The ____ statement will execute one set of statements when the if condition is true, and another set when the condition is false.
if/else
125
Division by _____ is mathematically impossible to perform and it normally causes a program to crash.
zero
126
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.
true
127
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.
if/else ifstatement
128
what type of variable does this hold? | char grade;
holds a letter
129
____ connect two or more relational expressions into one or | reverse the logic of an expression.
Logical operators
130
&& is what logical operator?
AND
131
|| is what logical operator?
OR
132
! is what logical operator?
NOT
133
Connects two expressions into one. Both expressions must be true for the overall expression to be true.
&& | AND
134
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
|| | OR
135
Reverses the “truth” of an expression. It makes a true expression false, and a false expression true
! | NOT
136
What is the value of this expression? | true && false
false (0)
137
What is the value of this expression? | false || true
true (1)
138
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
true
139
What is the value of this expression? | !false
true(1)
140
What is the precedence of Logical Operators?
! && ||
141
___ is the process of inspecting | information given to a program by the user and determining if it is valid
Input validation
142
Relational operators can also be used to compare ____ and string objects.
characters
143
The ____ statement lets the value of a variable or expression determine where the program will branch to.
switch
144
switch statements involve ___ statements
case
145
The ___ statement causes the program to exit the switchstatement
break
146
An ____ data type is a | programmer-defined data type that contains a set of named integer constants
enumerated
147
in this value assignment, what value will red be assigned to: enum Colors { red, orange, yellow = 9, green, blue };
0
148
Below is called: num = num + 1; num += 1; num++;
incrementing
149
Below is called: num = num - 1; num -= 1; num--;
decrementing
150
when the operator is placed after the variable
postfix mode
151
when the operator is placed before the variable name
prefix mode
152
++num; is what type of mode?
prefix mode
153
a control structure that causes a statement or group of statements to repeat
a loop
154
each execution of a loop is called an
iteration
155
a variable that controls the number of time a loop iterates is refered to a ___ _____ _____
loop control variable
156
by placing a semicolon after the first line of a while loop you can create an
infinite loop
157
process of inspecting data given to a program by the user and determining if it is valid
input validation
158
a variable that is regularly incremented or decremented each time a loop itierates
counter
159
the ____ ____ loop is a post test loop
do-while
160
you do this loop when you want to make sure the loop executes at least once
do-while
161
which type of loop is good for a menu
do-while
162
a pretest loop that combines the initialization, testing, and updating of a loop control variable in a single loop header
for loop
163
for loops contain three things
initialization, test, update
164
in a for loop if the initialization makes the test expression false, will the loop run?
no
165
a sum of numbers that accumulates with each iteration of a loop
running total
166
variable used to keep the running total is called a
accumulator
167
a special value that marks the end of a list of values
sentinel
168
what is the end of file function for an inputfile
inputFile.eof
169
use the ____ loop where you do not want the loop to iterate if the test condition is false from the beginning
while
170
use the ___ loop where you always want the loop to iterate at least once
do-while
171
use the ___ loop when you the exact number of iterations is known
for loop
172
nested loops have _____ and ____ loops
inner/outer
173
___ statements cause a loop to terminate early
break
174
_____ statement causes a loop to stop its current iteration and begin the next one
continue