1. Linux IV – Perl Programming
Take Home – Prelim Laboratory Examination
Directly print your code to short bond paper using notepad or DOS type command. Do not, copy
paste it to other application. This will have an effect to the code.
Staple the bond paper with this questionnaire, being the first page, before submitting it.
Write your printed name at the upper left side of every bond paper you’ve used and affix your
signature on top of the printed name.
Put it in a short brown envelope and write your full name, year and section, and subject in front of
the envelope.
Submit your exam papers personally on or before 12:00 nn. of January 03 2011, Monday. Time
will be based on the wall clock located at the stairway in ITCC.
Non-compliance with the above instructions would invalidate your exam and thus will require you
to take the special exam
Name: ___________________________________ Year and Section: ______________
1. Write a program that reads lines of input containing numbers, each of which is separated by a
space, and prints out the following:
a. The total/sum of numbers for each line
b. The grand total/sum of all number
Signal the end of input using Ctrl-D.
2. Write a program that reads a list of numbers (on separate lines) until end-of-input and then
prints for each number the corresponding person's name from the list shown below.
1. joell
2. michelle
3. lorie
4. eds
5. grace
6. cory
7. reinier
8. tina
9. rochelle
10. ruth
2. (Hardcode this list of names into your program)
Example:
if the input numbers were 1, 4, 3, 4, and 4,
the output names would be joell, eds, lorie, eds, and eds.