1) The C++ compiler has a built-in safety mechanism to prevent while blocks from
ID: 3586412 • Letter: 1
Question
1) The C++ compiler has a built-in safety mechanism to prevent while blocks from entering an endless loop.
True or False?
2)
What is the output of this statement?
cout << !true << endl;
a) 0 b) true c) false d) !true
3) What are the values of x, y, and z after the following code executes?
int x = 0,
y = 2,
z = 4;
x < 0 ? y = 4 : z = 2;
4)
Write nested if statements that perform the following tests:
If variable amount1 is greater than 10 and variable amount2 is less than 100, then display the greater of the two.
5) In the answer space below, write the code for a short program that prompts the user to input an integer between 10 and 20, inclusive.
If the user inputs an integer outside this range, your code should not exit, but instead it should loop continue to prompty the user until a valid value is entered.
Hint: Use a while block.
Explanation / Answer
Q.The C++ compiler has a built-in safety mechanism to prevent while blocks from entering an endless loop.
Answer: Flase, There is nothing like safety mechanism in C++ to prevent the endless loop.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.