Term
The ____ is the part of a function definition that shows the function name, return type, and parameter list. |
|
Definition
|
|
Term
If function showValue has the following header: void showValue(int quantity) you would use the statement ______ to call it with the argument 5. |
|
Definition
|
|
Term
Values that are sent into a function are called _____. |
|
Definition
|
|
Term
When only a copy of an argument is passed to a function, it is said to be passed by _____. |
|
Definition
|
|
Term
A(n) ______ variable is defined inside a function and is not accessible outside the function. |
|
Definition
|
|
Term
If a function has a local variable with the same name as a global variable, only the _____ variable can be seen by the function. |
|
Definition
|
|
Term
The _____ statement causes a function to end immediately. |
|
Definition
|
|
Term
When a function uses a mix of parameters with and without default arguments, the parameters with default arguments must be defined _______. |
|
Definition
|
|
Term
When used as parameters, _______ variables allow a function to acccess the parameters original argument. |
|
Definition
|
|
Term
Reference variables allow arguments to be passed by _______. |
|
Definition
|
|
Term
What is the difference between an argument and a parameter variable? |
|
Definition
An argument is in the function call (in parantheses) and represent the actual values passed into a function. Parameters are in the function header and receive the arguments. |
|
|
Term
The following statement calls a function named half, which returns a value that is half that of the argument passed to it. assume that result and number have both been defined to be double variables. Write the half function. result = half(number); . |
|
Definition
double half (double value){
return value / 2;
} |
|
|
Term
Internally, the CPU consists of the _____ and the ______. |
|
Definition
|
|
Term
The two categories of software are ______ and _____. |
|
Definition
Operating systems and application software. |
|
|
Term
Since computers can't be programmed in natural human language, algorithms must be written in a(n) ______ language. |
|
Definition
|
|
Term
A program's ability to run on several different types of computer systems is called ______. |
|
Definition
|
|
Term
Words or names defined by the programmer are called ____________. |
|
Definition
programmer defined symbols. |
|
|
Term
The three primary activities of a program are __, ___ and ___. |
|
Definition
Input, processing, output. |
|
|
Term
Every complete statement ends with a ____. |
|
Definition
|
|
Term
Assume a string object has been defined as follows:
string description;
A) write a cin statement that reads in a one word description.
B) write a statement that reads in a description that can contain multiple words separated by blanks.
|
|
Definition
A) cin >> description;
B) getline(cin, description); |
|
|
Term
What header files must be included in the following program?
int main() {
double amount = 89.7;
cout << fixed << showpoint << setprecision(1);
cout << setw(8) << amount << endl;
return 0;
} |
|
Definition
|
|
Term
Write a definition statement for a C-string object that can hold a string 30 characters in length. |
|
Definition
string city;
// no size declaration is needed |
|
|
Term
Write a cout statement that uses stream manipulators to display the contents of the variable divSales in a field of eight spaces, in a fixed-point notation, with a decimal point and two decimal digits. |
|
Definition
cout << fixed << showpoint << setprecision(2);
cout << setw(8) << divSales << endl; |
|
|
Term
An expression using the greater-than, less-than, greater-than-or-equal-to, etc... is called a(n) ______ operator. |
|
Definition
|
|
Term
The if statement regards an expression with the value 0 as ____ and an expression with a nonzero value as ____. |
|
Definition
|
|
Term
The ____ logical operator works best when testing a number to determine if it is within a range. |
|
Definition
|
|
Term
Convert the following conditional expression into an if/else statement.
q = (x < y) ? (a + b) : (x * 2); |
|
Definition
if (x < y){
q = a + b;
else {
q = x * 2;
}
|
|
|
Term
The following statement should determind if x is not greater than 20. What is wrong with it? if (!x > 20) |
|
Definition
|
|
Term
When the increment or decrement operator is placed after the operand (or to the operand's right), the operator is being used in _____ mode. |
|
Definition
|
|
Term
The statement or block that is repeated is known as the ____ of the loop. |
|
Definition
|
|
Term
A(n) ____ is a sum of numbers that accumulates with each iteration of a loop. |
|
Definition
|
|
Term
A(n) ______ is a special value that marks the end of a series of values. |
|
Definition
|
|
Term
Inside the for loop's parentheses, the first expression is the _____, the second is the ____ , and the thrid expression is the _____ . |
|
Definition
initialization, test, update. |
|
|
Term
The ____ statement causes a loop to terminate immidiately. |
|
Definition
|
|
Term
What header file do you need to include in a program that performs file operations? |
|
Definition
|
|
Term
What is a file's read position? Where is the read position when a file is first opened for reading? |
|
Definition
A read position marks the location of the next byte to read. When an input file is opened, the default is the first byte of the file. |
|
|
Term
Convert the following while loop to a for loop:
int count = 0 ;
while (count < 50){
cout << "count is " << count << endl;
count++;
} |
|
Definition
for (int count = 0; count < 50; count++){
cout << "count is " << count << endl;
} |
|
|
Term
Complete the program segment below to write the numbers 1 through 50 to the numbers.txt file.
ofstream outputFile;
outputFile.open("numbers.txt");
//you write this code
outputFile.close(); |
|
Definition
for (int num = 1; num <=50; num++)
outfile << num << " "; |
|
|
Term
The ____ is the part of a funciton definition that shows the funcction name, return type, and parameter list. |
|
Definition
|
|
Term
Values that are sent into a function are called ____. |
|
Definition
|
|
Term
When only a copy of an argument is passed to a function, it is said to be passed by _____. |
|
Definition
|
|
Term
|
Definition
|
|
Term
Creating a class object is often called _____ the class. |
|
Definition
|
|
Term
An object's data items are stored in its _____. |
|
Definition
|
|
Term
Bundling together an object's data and procedures is called _______. |
|
Definition
|
|
Term
Normally a class's ____ are declared to be private and ________ public. |
|
Definition
member variables, member functions |
|
|
Term
A class member function that changes the value of a member variable is called a(n) ____. |
|
Definition
|
|
Term
constructors cannot have a(n) ______ type. |
|
Definition
|
|
Term
A destructor is a member function that is automatically called when an object is ______. |
|
Definition
|
|
Term
A constructor with all default values is a(n) ______ constructor |
|
Definition
|
|
Term
A class may only have one default ____ and one ____. |
|
Definition
|
|
Term
When a member function forms part of the interface through which a client program can use the class, the function must be _____. |
|
Definition
|
|
Term
If you were writing a class declaration for a class named Canine and wanted to palce it in its own file, what should you name the file? |
|
Definition
|
|
Term
When a structure variable is created its members can be initialized with either a(n) ______ or a(n) ________. |
|
Definition
initialization list, constructor |
|
|
Term
An inventory structure is declared as follows:
struct {
int itemCode;
int qtyOnHand;
};
Write a definition statement that creates an Inventory variable named trivet and initializes it with an initialization list so that its code is 555 and quantity 110. |
|
Definition
Inventory trivet = {555, 110}; |
|
|
Term
Declare a structure named TempScale, with the following members:
farenheight: a double
celsius: a double |
|
Definition
struct TempScale{
double farenheight;
double celsius;
}; |
|
|
Term
What are the 5 major components of a computer? |
|
Definition
CPU, main memory (RAM), secondary storage devices, input devices, output devices. |
|
|
Term
What does the linker do? compared to the compiler and preprocessor. |
|
Definition
The linker creates an executable file after combining the object file (the code you wrote) and the library routines(which the preprocessor took care of) |
|
|
Term
What's the difference between the object file and the executable file? |
|
Definition
The object file has the machine instructions (generated by the compiler) and the executable file is all the code ready to be executed. |
|
|
Term
|
Definition
data written directly into the program. Literals can be variables (number = 5) or an integer literal (int apples) or string literals ("this is a string literal") or other things. |
|
|
Term
How many bytes of memory do each of these hold (give explanations for each):
|
|
Definition
- 'Q' is one byte of memory since it's a character literal.
- "Q" is two bytes because it is stored as Q and then the null terminator, \0.
- "Sales" uses 6 bytes, one byte for each character and then the null terminator, \0.
- '\n' is one since it's a character in this case.
|
|
|
Term
What is the << operator called? |
|
Definition
stream extraction operator |
|
|