Chapter 5 C++ Review

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

local

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

either true or false

A selection structure's condition must evaluate to _____

single alternative

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

int temp=0 temp=num1 num1=num2 num2=temp

Add the necessary instructions to swap the contents of the variables num1 and num2 int num1=10 int num2=15 int temp=0

True

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.

Argument

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

Relational

Another name for comparison operators is ______ operators

False

Another name for logical are comparison operators are comparison operators

True

Another name for the selection structure is the decision structure

False

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

True

C++ provides manipulators that allow the programmer to control the format used to display real numbers

Scientific

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

False

Comparison operators are also referred to as symbol operators

#include <iomanip>

For a program to use the setprecision stream manipulator, it must contain the ______directive

if

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

braces

In 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 ________

True

In summary of operators, logical operators will be evaluated after all relational operators

True

In the summary of operators, all arithmetic operators will be evaluated prior to any relational operators

two or more conditions

Logical operators combine __________

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

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

If (( letter =='x') II(letter=='X')

Rewrite the following if statement without using the toupper function: cout<< "The letter entered was either x or X"<<endl;

dual alternative

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

iostream

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

True

The "Equal to" operator has a higher precedence number than the "less than" operator in C++

False

The "Or" logical operator has a smaller precedence number "And" logical operator

none of the above

The ______ and ________ operators can be used interchangably. a.&&, II b. +,- C. *,/ D. none of the above

diamond

The _______ in a flowchart is called the decision symbol

========

The comparison operator representing "equal to " in C++ is________________

!=

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

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

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

False

The oval in a flowchart is the decision symbol

And

The symbol used in C++ for And operator is _______

False

The toupper function may have more than one argument

char

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

8

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

10

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

1235

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

1234567e+03

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

(number ==29)

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

1==2 2==2 3==2 F II T II F= True

Will the outcome of the condition in the if statement below be true or false? Show your evaluation

short circuiting evaluation

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 _____

False

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

True

Without a specialized instruction, in order to swap the contents of two variables a third variable is needed.

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

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

setprecison

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

True

You should not use the equality operator or the inequality operator to compare two real numbers because not all real numbers can be stored precisely in memory.

data validation

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

Truth

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

a

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

1234.567000

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


Ensembles d'études connexes

Exam 1 - Membrane Structure and Transport Processes

View Set

Chapter 24: Cognitive Disorders PREP U

View Set

DT 2.2 Waste Mitigation Strategies, Study Notes

View Set

crucible act 1, 2, 3, 4 test review

View Set

AIMA Chapter 12: Knowledge Representation

View Set