Given the following code. Will anything be displayed?
z = 130;
if (x++ > 130)
cout << "z is greater than 130.\n";
a. true
b. false
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
Chapter 5 Quiz Starting Out With C++ 004
What is the difference between prefix and postfix when dealing with statements that do more than incrementing or decrementing?
a. nothing.
b. prefix will increment/decrement BEFORE the variable is used.
c. postfix will increment/decrement BEFORE the variable is used.
d. both will preform the increment/decrement AFTER the variable is used
a. nothing.
b. prefix will increment/decrement BEFORE the variable is used.
c. postfix will increment/decrement BEFORE the variable is used.
d. both will preform the increment/decrement AFTER the variable is used
Chapter 5 Quiz Starting Out With C++ 003
Given that x is 5 in the snippet below. What will be displayed by the cout statement?
x = 5;
cout << x++;
a. 6
b. 7
c. 5
d. 4
x = 5;
cout << x++;
a. 6
b. 7
c. 5
d. 4
Chapter 5 Quiz Starting Out With C++ 002
The first example is _____ mode and the second is _____ mode?
i++, ++j
a. prefix, postfix
b. postfix, prefix
c. post inc, pre inc
d. pre inc, post inc
i++, ++j
a. prefix, postfix
b. postfix, prefix
c. post inc, pre inc
d. pre inc, post inc
Exericse Number
Chapter 05,
Quiz
Chapter 5 Quiz Starting Out With C++ 001
How do you use the increment and decrement operators in C++?
a. x++, x--
b. x = x + 1, x = x -1
c. inc x, dec x
d. both a and b are acceptable
e. answer a, c. One is C language and the other is C++
a. x++, x--
b. x = x + 1, x = x -1
c. inc x, dec x
d. both a and b are acceptable
e. answer a, c. One is C language and the other is C++
Chapter 4 Quiz Starting Out With C++ 047
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
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
Subscribe to:
Posts (Atom)