35 Questions * 3 Points Each = 105 Points
Any points earned beyond 100 are considered extra credit.
Exam Rules/Notices:
1. Do not fill in the section or the test form. Fill in your name and your student ID# on the answer sheet (write it in
AND fill in the bubbles). An incorrect student ID number will result in a zero for this exam.
2. Make sure you have all 35 questions to this exam. You should answer every question. All questions only have
one best answer. Please be careful when filling in your answers, any answer determined to be unreadable by
Instructional Data Processing will be considered incorrect. Only the answer on your answer sheet can be
considered when grading. An operator precedence table and ASCII table are provided on the back of this exam.
3. NO QUESTIONS WILL BE ANSWERED DURING THE EXAM. We do not answer questions during the
exam due to the limited number of staff members present. It is easier for us to “throw out” a test question with an
error than it is to answer questions or to make an announcement during the examination period. Manage your
time accordingly!
4. You must assume that all C programs and code segments are implemented on the guru.itap machine and
would be compiled with the gcc compiler as set up during the first week of the semester. When segments of
code are presented you may assume that the appropriate include statements are present and that the code would be
inside of a fully operational function or program.
5. Protect your work and keep your focus on your own exam. It is considered dishonest if you copy from
another student or to permit another student to copy from you. If a spotter has any reason to suspect questionable
behavior, you may be asked to move to another seat. Anyone found to violate course policies will receive a
failing grade for the course and will be referred to the Office of the Dean of Students.
6. You are NOT permitted to use any resources during this exam. This includes but is not limited to; texts,
notes, calculators, cell phones, MP3 players, and computers. If your cell phone audibly rings during the exam
you will be required to immediately submit your exam and leave the testing facility.
7. When you are finished with the exam, please proceed back to the lobby to submit your answer form and to exit
the facility. You will be required to show photo identification before we can accept your work. You will
keep this exam form. You may not return to your seat once you have submitted your exam.
8. Your score (and exam answers) will appear on Blackboard as soon as possible. Do not contact course staff
members about mistakes (if any) until answers are posted.
9. When time is called ALL writing must stop. You are not permitted to continue to make revisions to any answer
on your exam once time has been called.
10. Schedule reminders:
◦ There are no TA evening hours in SC 189 this evening.
◦ All lecture and lab sections are meeting this week! See your syllabus regarding how you will be compensated
for tonight's exam.
NO QUESTIONS WILL BE ANSWERED DURING THE EXAM.
, Use the example output below for problems 1 – 3
Enter the beginning balance: 15000
Enter the interest rate as a percentage: 3.75
Enter the value deposited at the end of each year: 500
Enter the desired ending balance: 22500
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Beginning balance: 15000 (USD)
Interest rate: 3.8%
Annual deposits of: 500 (USD)
Desired ending balance: 22500 (USD)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Number of years: 7
Actual ending balance after 7 years: $ 23328.52
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1. Which of the following print statements would correctly display the desired ending balance as seen in the
example output provided above?
A) printf("Desired ending balance: %9d (USD)\n", end);
B) printf("Desired ending balance:%9d (USD)\n", end);
C) printf("Desired ending balance:%10d (USD)\n", end);
D) None of the above.
2. Which of the following print statements would correctly display the interest rate as seen in the example
output provided above?
A) printf("Interest rate: %17.1f%% \n", rate);
B) printf("Interest rate:%18.1f% \n", rate);
C) printf("Interest rate:%17.1f%% \n", rate);
D) None of the above.
3. Which of the following print statements would correctly display the actual ending balance as seen in the
example output provided above?
A) printf("Actual ending balance after %2d years: $%12.2f\n", terms, fnl);
B) printf("Actual ending balance after %2d years: $ %10.2f\n", terms, fnl);
C) printf("Actual ending balance after %2d years: $%11.2lf\n", terms, fnl);
D) None of the above.
Use the code segment below for problems 4 – 5
double x; 4. Which of the following is the first line of output
int y = 32; generated by the code segment on the left?
A) x: 0.0
x = pow(y, );
B) x: 1.0
y = (double) y / 3 + 0.5; C) x: 2.0
D) None of the above.
printf("x: %.1f\n", x);
printf("y: %.1f\n", (double) y);
5. Which of the following is the second line of output generated by the code segment above?
A) y: 11.0 C) y: 11.2
B) y: 11.1 D) none of the above.