Name: ________________________________________________________________
UD Email: _____________________________________________@ udel.edu
Are you classified as a freshman (circle one): YES NO
Circle your lab section number:
020 (Mon 9:05) 021 (Mon 10:10) 022 (Mon 11:15)
030 (Wed 9:05) 031 (Wed 10:10) 032 (Wed 11:15)
Total Points: ???
A hint about allocating your time:
You need to answer 100 points worth of questions in 50 minutes, so....
(2 pts) Which of the following is a backslash?
\/(2 pts) 232 is approximately which of the following
(2 pts) 231 is approximately which of the following
(4 pts) For this question, please refer to program p01.cc on the code handouts distributed with this exam.
The program p01.cc is designed to test whether the function discriminant(), defined separately in disc.cc, is working correctly.
On line 25, there is some code missing. Which of the following will correctly complete this program?
if ( expectedValue = actualValue)if ( expectedValue == actualValue)if ( fabs(expectedValue-actualValue) < tolerance )if ( fabs(expectedValue-actualValue) > tolerance )if ( fabs(actualValue-expectedValue) > tolerance )(4 pts) For this question, please refer to program p01.cc
Lines 9-12 contains which of the following?.
(4 pts) For this question, please refer to program p01.cc
Line 21 contains which of the following?.
(4 pts) For this question, please refer to the file p01.cc
On line 9, a, b and c are:
(4 pts) For this question, please refer to the file p01.cc
On line 21, 4.0, 6.0 and 9.0 are:
(4 pts) For this question, please refer to p02.cc
What is the output of this program?
3
7
21
(4 pts) For this question, please refer to p03.cc
What is the output of this program?
3
7
21
(4 pts) For this question, please refer to p04.cc
Which of the following will be the output of this program?
b d aa c
d aa c b
aa b c d
b d c aa
b d c aaa
(4 pts) Consider the following message:
strauss.udel.edu% CC testQuadEqn.cc Undefined first referenced symbol in file int howManyRoots(double,double,double) testQuadEqn.o ld: fatal: Symbol referencing errors. No output written to a.out strauss.udel.edu%
Which of the following is the best explanation for this message?
testQuadEqn.o does not exist.testQuadEqn.cc does not exist.testQuadEqn.cc contains a syntax error, and therefore did not compile.testQuadEqn.o contains a syntax error, and therefore did not compile.testQuadEqn.cc contains a function call that has no matching function definition.(4 pts) The octal number 36, when converted to binary is:
(4 pts) The base 16 number 36, when converted to binary is:
( 4 pts) The binary number 0110 0011 when converted to decimal is:
(4 pts) The binary number 0110 0011 when converted to base 8 is:
cin >> x;cout << x; using std::cin;stream.insert(); stream::insert();
(4 pts) Which of the following for loops will correctly print the following sequence:
5 4 3 2 1 0
for (i=5; i<=0; i--) cout << i << endl;
for (i=5; i>=0; i--) cout << i << endl;
for (i=5; i<=0; i++) cout << i << endl;
for (i=5; i>=0; i++) cout << i << endl;
(4 pts) Which of the following for loops will produce a so-called "infinite loop", terminating only when the user hits CTRL/C or CTRL/Z, or when the integer value "wraps around" from a large positive number to a large negative number?
for (i=10; i<=0; i--) cout << i << endl;
for (i=10; i>=0; i--) cout << i << endl;
for (i=10; i<=0; i++) cout << i << endl;
for (i=10; i>=0; i++) cout << i << endl;
(4 pts) Which of the following is a correct explanation of this command?
CC -c lab03.cc
(30 pts) Write a complete C++ program to solve the following problem, including
Problem Statement: Ask the user of the program to input three integers that are all different. You should then print out only one word: either odd, even or error, computed as follows:
Your program should provide appropriate prompts to the user for entering the three numbers.
Here is some sample input and output:
| input | output |
|---|---|
| 9 3 2 | odd |
| 7 8 1 | odd |
| -2 0 -5 | error |
| 3 9 4 | even |
| 5 5 1 | error |
| 2 2 2 | error |
| 1 3 1 | error |
| 4 3 7 | even |
| 0 1 2 | odd |
| 0 2 5 | even |