Exam

Ace your homework & exams now with Quizwiz!

operators.

Characters or symbols that perform operations on one or more operands are

program design, writing source code, and testing.

Creating a program requires many steps. Three of these are

True

True/False: When a function just needs to use a copy of an argument passed to it, the argument should normally be passed by value.

True

True/False: When an operator's operands are of different data types, such as int and double, C++ automatically converts one of them so that they are the same data type.

their parameter lists are different.

Two or more functions may have the same name provided that

preprocessor directive.

#include is an example of a(n)

an algorithm.

A set of well-defined steps for performing a task or solving a problem is known as

accumulator.

A variable that keeps a running total of data values is called a(n)

modular

Breaking a program up into a set of manageable sized functions is called ________ programming.

returns no value.

A void function is one that

program

A(n) ________ is a set of instructions that tells the computer how to solve a problem.

the null terminator

C++ automatically places ________ at the end of a string literal.

high-level

C++ is an example of a ________ programming language.

single, double

A C++ character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.

driver

A ________ is a program module whose purpose is to test other modules by calling them.

local

A ________ variable is defined inside the body of a function and is not accessible outside that function.

update.

A for statement contains three expressions: initialization, test, and

definition

A function ________ includes the statements that make up the function.

whenever it is called.

A function other than the main function is executed

marks the end of a list of values.

A sentinel is a special value that

a text editor, a compiler, a debugger.

An integrated development environment (IDE) normally includes

fetch instructions, carry out the operations commanded by the instructions, produce some result.

At the heart of a computer is its central processing unit (CPU). Its job is to

Secondary Storage Device

Even when there is no power to the computer, data can be held in

while loop.

For data validation, it is best to use a(n)

a program debugging technique.

Hand tracing a program is

False

If number is an int variable, both of the following statements will print out its value: cout << number; cout << "number";

the pow function.

In C++, a value can be raised to a power by using

a comment.

In a C++ program, two slash marks ( // ) indicate the beginning of

initialization

In a for statement, the ________ expression is executed only once.

an identifier name or constant for each argument.

In a function call, in addition to the name of the function, you are required to furnish

a data type for each parameter, an identifier name for each parameter, and the data type of the return value.

In a function header, in addition to the name of the function, you are required to furnish

a data type for each parameter and the data type of the return value, but not an identifier name for each parameter.

In a function prototype, in addition to the name of the function, you are required to furnish

the iostream header file.

In any program that uses the cin object, you must #include

variables.

Memory locations that can hold data are called

expression.

Program code that can be evaluated to a value is called a(n)

is a unary operator, adds one to the value of its operand, and can operate in prefix or postfix mode.

The ++ operator

the arithmetic and logic unit (ALU) and the control unit.

The CPU includes

control unit

The ________ coordinates the computer's operations by fetching the next instruction and using control signals to regulate the other major computer components.

#include

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

exit ()

The ________ function causes the entire program to terminate, regardless of which function or control mechanism is executing.

cout object

The ________ is used to display information on the computer's screen.

>> , <<

The ________ operator always follows the cin object, and the ________ operator follows the cout object.

return

The ________ statement causes a function to end and the flow of control to move back to the point where the function call was made.

setw

The ________ stream manipulator can be used to establish a field width for the value immediately following it.

has only two values: true and false.

The bool data type

random-access memory (RAM).

The computer's main memory is commonly known as

1

The expression 5 % 2 evaluates to

2

The expression 5 / 2 evaluates to

to identify the location of a memory cell.

The purpose of a memory address is

at least once.

The statements in the body of a do-while loop are executed

source code.

The statements written by a programmer are called

the physical components that make up a computer.

The term hardware refers to

a static

The value in ________ local variable is retained between function calls.

repeated as long as the condition is true.

The while loop has two important parts: a condition that is tested and a statement or block of statements that is

pretest, post test

The while loop is a(n) ________ loop, whereas the do-while loop is a(n) ________ loop.

False

True/False: The purpose of the compiler is to convert object code into source code.

do create a file stream object that will "point to" (i.e. reference) the file and open the file, but not make sure the file already exists.

To use an output file in a C++ program you must

fstream

To use files in a C++ program you must include the ________ header file.

iomanip

To use stream manipulators, you should include the ________ header file.

False

True or False: When a loop is nested inside another loop, the outer loop goes through all its iterations for each iteration of the inner loop.

True

True/False: A function can have zero to many parameters and either zero or one return value(s).

True

True/False: A function with a return type of bool must return a value of either true or false.

False

True/False: A variable of the char data type can hold a set of characters like "January".

False

True/False: A while loop is somewhat limited, because the counter can only count up, not down.

False

True/False: A while loop may have a semicolon after the test expression and before the body of the loop, but it is not required.

True

True/False: An initialization expression may be omitted from the for loop if no initialization is required.

True

True/False: Before a computer can execute a program written in a high level language, such as C++, it must be translated into object code.

True

True/False: C++ is a case-sensitive language.

True

True/False: Functions are ideal for use in menu-drive programs. When a user selects a menu item, the program can call an appropriate function to carry out the user's choice.

True

True/False: It is possible for a function to have some parameters with default arguments and some without.

True

True/False: Most of the lines in a program contain something meaningful; however, some of the lines may contain nothing at all.

False

True/False: Once a value has been stored in a variable it cannot be changed.

True

True/False: The block of code in the body of a while statement can contain an unlimited number of statements, provided they are enclosed in a set of braces.

True

True/False: The cin object can be used to input more than one value in a single statement.

False

True/False: The following C++ statement will assign 1.5 to the result variable. int result = 3.0 / 2.0;

False

True/False: The following pair of C++ statements is legal. const double taxRate; taxRate = .05;

False

True/False: The following two C++ statements perform the same operation. wages = regPay + overTime; regPay + overTime = wages;

True

True/False: The following two statements will assign the same value to result. result = a + b * c; result = b * c + a;

False

True/False: The only difference between C-strings and string objects is how they are declared and internally stored. They are used exactly the same way.

False

True/False: To decrement a number means to increase its value.

7

What value will be assigned to the variable number by the following statement? int number = 7.8;

7 7 8

What will the following code print? num = 8; cout << --num << " "; cout << num++ << " "; cout << num;

overloaded

When more than one function has the same name they are called ________ functions.

the data type of the variable.

When the final value of an expression is assigned to a variable, it will be converted to

reference

When used as a parameter, a ________ variable allows a function to access and modify the original argument passed to it.

float total; double total; auto total = 0.0;

Which of the following definitions will allow the variable total to hold floating-point values?

Both static_cast<double>(5)/2 and 5/static_cast<double>(2), but not static_cast<double>(5/2)

Which of the following expressions will evaluate to 2.5?

June_2010

Which of the following is/are valid C++ identifiers?

Both answer *= 2; and answer = answer * 2;, but not answer += 2;

Which of the following statements doubles the value stored in answer?

number = rand() % 11 + 90;

Which of the following statements will assign number a value from 90 — 100.

getline()

Which of the following will allow an entire line of text to be read into a string object, even if it contains embedded blanks?

cout << endl;

Which of the following will cause the next output to begin on a new line?

variable

You may define a(n) ________ in the initialization expression of a for loop.

definition

You must have a(n) ________ for every variable you include in a program.

++ and --

________ are C++ operators that change their operands by one.

Literals

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

Parentheses

________ can be used to override the rules of operator precedence.

The cin object

________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.

Punctuation

________ is used in a C++ program to mark the end of a statement, or to separate items in a list.


Related study sets

Maths - Exponentials and Logarithms

View Set

MGMT473: Ch. 17: Planning for Growth

View Set