The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 327 Weeks Ago, 4 Days Ago |
| Questions Answered: | 12843 |
| Tutorials Posted: | 12834 |
MBA, Ph.D in Management
Harvard university
Feb-1997 - Aug-2003
Professor
Strayer University
Jan-2007 - Present
CMPSC 101
SAMPLE FINAL EXAM
Final Exam: [300 points] The final exam is given during final exam week. You will need
to arrange for a proctor for this exam; more details on how to do this will be posted. The
final exam will have three programming problems: easy (35%), medium (35%) and hard
(30%). The final exam is worth one third of your semester grade; if you do not do the
book work and projects yourself, you will not do well on the final and may not do well in
the course. If you stay engaged in the course and follow along you should do well in the
final exam.
This sample final exam is meant to help you gauge how well you might do in the final
exam. Although we can not enforce a time limit on this sample, try to do the entire thing
within 90 minutes (this is how long you will have to do the exam).
Do not access any materials not included here while doing the exam. There is a
reference sheet supplied – you may use that as a quick reference when you are having
trouble remembering particular syntax.
Package up all three problems into one Word doc as you have done for the labs
throughout the course, and submit the document to the drop box provided. Next, go
back and confirm that the submission is in the drop box! Good luck! PROBLEM 1 (Easy)
Write a program that asks the user for a number between 1 and 30, then displays the
following message based on the table below. Note that you should only have one output
per run (in the order of priority shown in the table).
If the number is:
Less than 1
Between 1 and 19
(inclusive)
Between 18 and 30
(inclusive)
Between 9 and 22
(inclusive)
Between 3 and 29
(inclusive)
Over 30
Not in any of the above
categories Display:
And Even Too low
Adam Or Even Betty Or Even Charlie And Odd Debbie
Too high
No category! DO NOT WRITE A SEPARATE TEST FOR EACH NUMBER OR YOU WILL RECEIVE
A ZERO!
Examples:
Please enter a number between 1 and 30: 2
Adam
Please enter a number between 1 and 30: 3
Debbie
Please enter a number between 1 and 30: 15
Charlie
Please enter a number between 1 and 30: 1
No category! PROBLEM 2 (Medium)
Write a program that prompts the user for numbers from cin. Stop reading numbers
when the input value is zero. Display the total of the odd entries and the even entries.
For example:
Entry 1: 34
Entry 2: 87
Entry 3: 10
Entry 4: 72
Entry 5: 26
Entry 6: 64
Entry 7: 0
Odd entries add up to: 70
Even entries add up to: 223
NOTE THAT “odd” and “even” here refer to the position in the list, not whether the data
value is odd or even!
Another example:
Entry 1: 22
Entry 2: 33
Entry 3: 44
Entry 4: 55
Entry 5: 66
Entry 6: 77
Entry 7: 88
Entry 8: 99
Entry 9: 11
Entry 10: 0
Odd entries add up to: 231
Even entries add up to: 264 PROBLEM 3 (Hard)
Write a program that reads in names from stdin. Stop reading names when the name
is "***DONE***". There will not be more than 100 names, although there may be way
fewer. Next, display the second half of the list as shown below:
Reading: Charles
Reading: Debbie
Reading: Larry
Reading: Jerry
Reading: Elaine
Reading: Frank
Reading: George
Reading: Harry
Reading: Adam
Reading: Igor
Reading: Betty Ann
Reading: ***DONE***
There are 11 names in the list
Listing names 5 through 10
->Frank
->George
->Harry
->Adam
->Igor
->Betty Ann
NOTE: Round down if necessary when figuring where the “middle” is; i.e., half of 11 is
5.5, so start the list from 5 as shown in the example above. Remember that the first
array entry is slot zero.
ALSO NOTE: The string ***DONE*** must not appear when displaying the second half
of the list.
-----------