c++ module 5 study guide
Which symbol is used in C++ for the logical And operator?
&&
What is the result of the following arithmetic expression in C++? 2 * (4 + 4)
16
What is the result of the following arithmetic expression in C++? 2 + 4 * 2
16
For a program to use the setprecision stream manipulator, it must include which file?
<iomanip>
AND and OR are the two most commonly used examples of which type of operator?
Boolean
What is the name of the process used to verify that the input data is within the expected range?
Data validation
With short circuit evaluation, each sub condition is independent of any other sub condition. (T/F)
False
What type of variable can be used only within the statement block in which it is defined?
Local
By default in C++, smaller real numbers with a decimal place (those containing six or fewer digits to the left of the decimal) are displayed in exponential notation. (T/F)
True
In the summary of operators, all arithmetic operators will be evaluated prior to any logical operators. (T/F)
True
The "equal to" operator has a higher precedence number than the "less than" operator in C++. (T/F)
True
What is used to summarize how the computer evaluates the logical operators in an expression?
Truth tables
What value is stored in the letter variable after the following code is executed? char letter = 'a'; char letter2 = ' '; letter2 = toupper(letter); a. a b. A c. a blank space d. none of the above
a. a
Comparison operators evaluate to what type of value? a. integer b. boolean c. character d. real
b. boolean
Selection structures that contain instructions on both the true and false paths are referred to as which of the following? a. single-alternative b. dual-alternative c. two path d. none of the above
b. dual-alternative
In an if statement, the programmer must supply the condition that the computer needs to evaluate before further processing can occur. The condition must be which type of expression?
boolean
In a selection structure, if a path contains more than one statement, the statements must be entered as a statement block, which means they must be enclosed in which of the following?
braces
What would be the result of the following C++ code (assuming all necessary directives)? double number = 1234.567; cout << fixed << number << endl; a. 1234.567 b. 1234.6 c. 1234.567000 d. 1235
c
Which of the following comparison operators represents "not equal to" in C++? a. < > b. <= c. != d. /=
c. !=
Which of the following conditions tests to see if the variable number is equal to 29? a. ( number > 28) b. ( number = 29 ) c. ( number == 29 ) d. ( number != 29 )
c. ( number == 29 )
To display real numbers in exponential notation, the programmer would use which stream manipulator? a. fixed b. real c. scientific d. none of the above
c. scientific
What data type is required for the argument in the toupper and tolower functions?
char
What would be the result of the following C++ code (assuming all necessary directives)? double number = 1234.567; cout << scientific << number << endl; a. 1234.567 b. 1234.6 c. 1234.567000 d. 1.234567e+03
d.
What is another way that the condition below could be written? ( num <= 10 ) a. (num < 11 || num < 10) b. (num > 9) c. ( (num < 10) && (num = 10) ) d. ( (num < 10) || (num = 10) )
d. ( (num < 10) || (num = 10) )
What would be the result of the following C++ code (assuming all necessary directives)? double number = 1234.56; cout << fixed; cout << setprecision(0); cout << number << endl; a. 1234 b. 1234.6 c. 1234.567000 d. 1235
d. 1235
Which of the following describes an item that appears between parentheses in a function's syntax? a. data type b. relational operator c. function body d. argument
d. argument
What symbol in a flowchart is known as the decision symbol?
diamond
Stream manipulators that do not have arguments, such as fixed and scientific, are defined in which file?
iostream
A computer programmer can use which of the following to control the number of decimal places that appear when a real number is displayed?
setprecision stream manipulator
What type of selection structure occurs when there are one or more actions to be taken only when its condition evaluates to true?
single-alternative