C++ test 2

Two different variables in the same program may have the same name

if they have different scopes

What will the following statement assign to variable answer if x equals 17
answer = x> 100 ? 0 : 1;

1

what will the following code print
num = 5
cout << num++ << " ";
cout << num-- << " ";
cout << --num;

5 6 5

An ________________ is a variable that controls the number of times a loop iterates

loop control variable

A for loop is considered an _____________ loop

pretest

The ideal type of loop to use for repeating a menu is a ___________ loop

do - while

In a function header, 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
the data type of the return value

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

a data type for each parameter
the data type of return value

Two or more functions may have the same name provided that

their parameter list are different
their return types are different

you can nest a for loop inside another for loop, but cannot nest a while loop inside another while loop or a do- while loop inside another do while loop T/F

False

A while loop is somewhat limited because the counter can only be increased by one each time through the loop T/F

false

If the closing brace of a function body is reached, the flow of control moves to the next function in the file. T/F

false

It is possible for a function to have some parameters with default arguments and some without T/F

True

Althought global variables can be useful, it is considered good programming practice to restrict your use of them T/F

True

The purpose of a memory address

to identify the location of a memory cell

#include <iostream> is an example of an

preprocessor directive

The numeric data type in C++ are broken down into two categories

interger and floating point

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

operators

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

7

Program code that can be evaluated to a value is called an

expression

which of the following expressions will evaluated to 2.5?

static_cast<double>(5/2)
5/static_cast<double>(5)/2
the data type of the variable

When a program lets the user know that an invalid menu choice has been made, this is an example of

menus reselection

A trailing else placed at the end of an if/else if statement provides a default action when ________ of the if conditions is/ are true

none

software engineering is a field that encompasses designing , writing , testing, debugging,documenting, modifying, and maintaining computer program T/F

true

If number has been defined as an int , both of the following statement will print out of its value:
cout<<number;
cout<< "number"; T/F

false

The purpose of the compiler is to convert object code into source code T/F

false

Assuming goodData is a Boolean variable, the following two test are logically equivalent
if(goodData==false)
if(!goodData) T/F

true

The following two segments will assign the same value to answer
answer = a*b/c ;
answer=b/c*a; T/F

true