Chapter 5 C++ test

¡Supera tus tareas y exámenes ahora con Quizwiz!

The comparison operator representing "not equal to" in C++ is ________

!=

for a program to use the setprecision stream manipulator, it must contain the _________ directive.

#include <iomanip>

The symbol used in C++ for the And operator is ______

&&

The condition below could be written as _________. (num <= 10)

((num < 10 II (num = 10))

Which of the following conditions would test to see if the variable number was equal to 29?

(number == 29)

What would the result of the following C++ code (assuming all necessary directives): double number = 1234.567; cout << scientific << number << endl;

1.234567e+03

What is the outcome of the following arithmetic expression in C++: 2+4*2

10

What is the outcome of the following arithmetic expression in C++: 2*4+4

12

What would the result of the following C++ code (assuming all necessary directives): double number = 1234.567; cout << fixed << number << endl;

1234.567000

What would the result of the following C++ code (assuming all necessary directives): double number = 1234.56; cout << fixed; cout << setprecision(0); cout << number << endl;

1235

The comparison operator representing "equal to" in C++ is _______

= =

T/F Another name for logical operators are comparison operators

False

T/F By default in C++, smaller numbers with a decimal place (those containing six or fewer digits to the left of the decimal) are displayed in exponential notation.

False

T/F Comparison operators are also referred to as symbol operators.

False

T/F The toupper function may have more than one argument

False

T/F With short-circuit evaluation, each sub-condition is independent of any other sub-condition

False

T/F the oval is a flowchart is the decision symbol

False

T/F Although not required, it is good programming practice to use a comment (such as //end if) to mark the end of the if statement in a program

True

T/F C++ provides stream manipulators that allow the programmer to control the format used to display real numbers.

True

T/F In the summary of operators, logical operators will be evaluated after all relational operators

True

T/F The "equal to" operator has a higher precedence number than the "less than" operator in C++

True

give the following code: int x = 1; int y = 2; int z = 3; Will the outcome of the condition in the if statement below be true or false? Show your evaluation breakdown.

True

________ tables summarize how the computer evaluates the logical operators in an expression

Truth

What value is stored in the letter variable after the following? char letter = 'a'; char letter2 = ' '; letter2 = toupper(letter);

a

An item that appears between parentheses in a function's syntax is called a(n) _______

argument

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 a set of ______

braces

What data type is required for the argument in the toupper and tolower functions?

char

__________ refers to the process of verifying that the input data is within the expected range.

date validation

Selection structures that contain instructions on both the true and false paths are referred to as _________

daul-alternative

The ________ in a flowchart is called the decision symbol.

diamond

A selection structure's condition must evaluate to ________

either true or false

In an if statement, you cannot have an else clause without a matching _________ clause.

if

Write the if statement to print "yes" on the screen if the value stored in the variable number is between 1 and 100, inclusive (including 1 and 100)

if (( number >= 1) && (number <= 10)) cout << "yes" << endl;

Rewrite the following if statement condition without using the != operator: if (number != 50)

if ((number < 50) II (number > 50))

Write the if statement to print "yes" on the screen if the value stored in the variable number is between 1 and 100, exclusive (excluding 1 and 100)

if ((number > 1) && (number < 100)) cout << "yes" <<endl;

Given the following code: int number 50; Write the if statement to print "yes" and add one to the number variable if the value stored in the number variable is greater than or equal to 50.

if ((number >= 50) { cout << "yes" << endl; number = number + 1;

Given the following code: int testScore = 0; cout << "Enter the test score: "; cin >> testScore; Write the if statement to print "yes" if the test score entered is valid, and "no" if it is not. A valid test score would be in the range from 0 to 100, inclusive (including 0 and 100)

if ((testScore >= 0) && (testScore <= 100)) cout << "yes" << endl; else cout << "no" <<endl;

Stream manipulators that do not have arguments, such as fixed and scientific, are defined in the _________

iostream

A ________ variable is a variable that can be used only within the statement block in which it is declared.

local

The _______ and _____ operators can be used interchangeably.

none of the above

given the following code: int number + 49; What will be printed, if anything, and what will the value of the variable number be after the following statements are executed? if (number >= 50) cout << "yes" << endl; number = number + 1

number = 50

Another name for comparison operators is ________ operators

relational

C++ provides the ________ stream manipulator to display real numbers in exponential notation.

scientific

You can use the _________ stream manipulator to control the number of decimal places that appear when a real number is displayed

setprecision

With a condition that has sub-conditions, the concept of evaluating the second sub-condition based upon the result of the first sub-condition is referred to as ________

short-circuiting evaluation

A(n) ______ selection structure occurs when there are one or more actions to be taken only when its condition evaluates to true.

single-alternative

Logical operators combine _________.

two or more conditions


Conjuntos de estudio relacionados

Science - What are the Planets in our Solar System?

View Set

HUMAN BIOLOGY - Possible Final Questions

View Set

Binary, Denary and Hexadecimal Conversion HJ

View Set

New Issues - Corporate Underwritings Practice Questions

View Set