Covey PDF Download. Greene Ph. Avedesian PDF Download. Little PDF Download. Laudon, Jane P. Laudon PDF Download. Fitzpatrick PDF Download. Kelsey, Alice S. Whittemore, Alfred S. Evans, W. Nolan Jr. Robb PDF Download.
Daft PDF Download. Baarsen PDF Download. Wincel, PhD, Thomas J. Kull PDF Download. Edwards, Stephen J. Wayne PDF Download. Berger, John B. Mitchell, Ronald H. Clark PDF Download. Esselstyn Jr. Ciccarelli, J. Morris, Albert A. Maisto PDF Download. White PDF Download. Bekey PDF Download. Delves, Seamus J. Martin, Dennis R. Burton, Ivan M. Roitt PDF Download. Ball, Joyce E. Dains, John A. Flynn, Barry S. Solomon, Rosalyn W.
Stewart PDF Download. Wheelen, J. David Hunger, Alan N. Palsson PDF Download. Cogswell PDF Download. Mason PDF Download. Short PDF Download. Lewis, J. Mishani PDF Download.
Heinlein PDF Download. Doris PDF Download. Davis PDF Download. Kouzes, Barry Z. Posner PDF Download. Wiersbe PDF Download. Chapter 2 - Test Questions These test questions are true-false, fill in the blank, multiple choice, and free form questions that may require code. The multiple choice questions may have more than one correct answer. You are required to mark and comment on correct answers.. Mark all of the correct answers for full credit. True False:. The if, while and for statements control only one statement.
Explanation: The operator uses short-circuit evaluation. The first member of this expression is true; the truth value of the complete expression can be determined from this; consequently, the second expression is not evaluated.
There is no divideby-zero error. Explanation: Unfortunately, the expression compiles without error and runs. When compared to 1, this is false. You want to determine whether time has run out.
The following code correctly implements this. Explanation: The expression always evaluates to false. This cannot be what the programmer intended. Corrected code is! It returns the opposite bool value. The value of time is converted to a bool. The value of time is certainly nonzero, hence! The value on the left false is converted to a 0 value of that type. The value of limit is unlikely to be a negative number and we are concerned about time running out, so it is unlikely that time is zero.
This is false. The value of count is 0; limit is Evaluate: count! Explanation: The first expression evaluates to false, the value of the expression is determined by the second expression. The second expression is true so the expression evaluates to true. Answer: true 9. In a do-while loop, a continue statement terminates the loop.
If true, the body executes, otherwise the loop terminates. A break statement is used in loops only. Answer: False. Explanation: In addition to its use in loops, a break statement is used in the switch statement to transfer control to the next statement after the switch block.
When a loop is nested in side another loop, a break or continue statement terminates or restarts the outermost loop of the nested loop structure. Answer: False Explanation: A break or continue terminates or restarts only the innermost loop containing the break or continue. Assume variables first and second are declared to be double and are initialized. Write a sequence of lines of code that cause the values stored in first and second to be exchanged if the value of first is not less than second.
Assume variables first, second, and max are declared to be double and are initialized. Write a sequence of lines of code that cause the larger of the values in first and second to be stored in max. A numeric integer grade is between 50 and Using integer division or otherwise obtain a int value that is 5, 6, 7, 8, or 9 from the numeric grade.
Write code using a. Write Boolean expressions that represent the given English expressions. Assume any variables used have been declared and initialized. Answer: a. Use the condition operator x? You should assume that any variables you use have been declared and initialized appropriately.
What is the output from each of the following loops? The only output is a carriage return. Write the following do-while statement with a while construct, and maybe some extra code.
Write a program that reads in exactly 10 integers and outputs the sum. Write a program that reads in and sums the squares of positive integers until a value that 0 or less is read in. For each of the following situations, tell which type loop while, do-while, or for would be best in that situation: a Reading a list of an unknown number of homework grades for a single student. Answer: a A while loop because the list of grades may be empty.
There may be more than one correct answer. You must give all correct answers for full credit. An explanation is required. Which control construct repeats a sequence of statements zero or more times? Does the value of this depend on the value of x? Explain, and give the expression that the programmer probably meant. Answer: c This expression is always true. The value does not depend on x.
These bool values convert to int values 0 or 1 when compared to int value The expression evaluates to true for all values of x. Answer: a , c , and d.
0コメント