Can you have two variables with the same name in C++?
a. only if they are in the same scope
b. only if they are in different blocks
c. if one of the variables is in a function
d. heck, I wasn't listening when we went over this. idk
Answers for C++ Course using "Starting out with C++ : from control structures through objects" by Tony Gaddis. 7/8th ed. I used the Pearson myprogramminglab to complete the homework. Here are my solutions/answers for the exercises/labs so please use the test bank as a GUIDE if you're stuck. Let me know if you find a better solution to a problem or any of the programming challenges. Thanks in advance for your support! Send in missing programming challenges to cplusplus.answers@gmail.com
Showing posts with label Chapter 04. Show all posts
Showing posts with label Chapter 04. Show all posts
Chapter 4 Quiz Starting Out With C++ 046
The switch statement lets the value of a variable or expression determine where the program will branch in an if/else statement
a. true
b. false
a. true
b. false
Chapter 4 Quiz Starting Out With C++ 045
Since it takes three operands, the conditional operator is considered a
ternary operator.
a. true
b. false
ternary operator.
a. true
b. false
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 044
Which of the following is an example of a conditional operator?
a.
x > y ? z=1 : z=0;
b.
if (x>y)
z=1
else
z=0;
c.
if x>y then z=1 else z=0
d.
? (x>y) : z=1 : z=0;
a.
x > y ? z=1 : z=0;
b.
if (x>y)
z=1
else
z=0;
c.
if x>y then z=1 else z=0
d.
? (x>y) : z=1 : z=0;
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 043
The conditional operator works like an if/else statement
a. true
b. false
a. true
b. false
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 042
What do the ASCII values 65 through 90 represent?
a. the numbers from 65 through 90 as integers.
b. the characters 'a' through 'z'
c. the characters 'A' through 'Z'
d. the characters '0' through '9'
e. none. ASCII is obsolete and no longer used.
a. the numbers from 65 through 90 as integers.
b. the characters 'a' through 'z'
c. the characters 'A' through 'Z'
d. the characters '0' through '9'
e. none. ASCII is obsolete and no longer used.
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 041
The highest or of precedence in C++ is
a. ||
b. !
c. &&
d. they are all the same. Left to right
a. ||
b. !
c. &&
d. they are all the same. Left to right
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 040
Precedence is not important in C++
a. true
b. false
a. true
b. false
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 039
What does || mean in C++?
a. OR
b. NOT
c. EITHER
a. OR
b. NOT
c. EITHER
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 038
What is the value of the following expression?
true && false
a. true
b. false
c. can't tell
d. the expression makes no sense in C++
true && false
a. true
b. false
c. can't tell
d. the expression makes no sense in C++
Chapter 4 Quiz Starting Out With C++ 037
In C++, the ______ operator reverses the "truth" of an expression. It makes a true expression false and a false expression true.
a. &&
b. !
c. ||
d. reverse()
e. none of the above
a. &&
b. !
c. ||
d. reverse()
e. none of the above
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 036
_____ operators connect two or more relational expressions into one or reverse the logic of an expression?
a. syntax
b. binary
c. logical
d. combinatory
e. answer b and c
a. syntax
b. binary
c. logical
d. combinatory
e. answer b and c
Chapter 4 Quiz Starting Out With C++ 035
What is typically used as a flag in C++
a. a float
b. an integer
c. a bool
d. a register
e. b and c
ab. answer c is typical but answer b is also used by some
ae. none of the above. C++ does not have access to the AX or BX flags of the CPU
a. a float
b. an integer
c. a bool
d. a register
e. b and c
ab. answer c is typical but answer b is also used by some
ae. none of the above. C++ does not have access to the AX or BX flags of the CPU
Chapter 4 Quiz Starting Out With C++ 034
The potential round-off errors are common if the user is not careful when the user uses the equality operator to compare floating point values.
a. true
b. false
a. true
b. false
Chapter 4 Quiz Starting Out With C++ 033
What is the operator that can be used for the logical AND ?
a. &&
b. ++
c. ||
d. @
e. AND
a. &&
b. ++
c. ||
d. @
e. AND
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 032
What is the value for a relational operation when it is not true?
a. one
b. zero
c. zero, one, or minus one
d. less than zero
a. one
b. zero
c. zero, one, or minus one
d. less than zero
Chapter 4 Quiz Starting Out With C++ 031
The following C++ statement will let the variable decide where the program will go to.
a. select
b. associative
c. scope
d. switch
e. none of the above
a. select
b. associative
c. scope
d. switch
e. none of the above
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 030
When you use input values, the user should check for the following:
a. Appropriate range
b. Reasonableness
c. Division by zero, if division is taking place
d. All of these
e. None of the above
a. Appropriate range
b. Reasonableness
c. Division by zero, if division is taking place
d. All of these
e. None of the above
Exericse Number
Chapter 04,
Quiz
Chapter 4 Quiz Starting Out With C++ 029
An if statement considers true any value that is NOT 0 (ZERO)
a. true
b. false
a. true
b. false
Chapter 4 Quiz Starting Out With C++ 028
When a user writes an if statement, the user should indent the statements that get executed conditionally based on programming style.
a. true
b. false
a. true
b. false
Subscribe to:
Comments (Atom)