Spl prelim lab 2011 2012

384 views

Published on

SPL-Perl Take Home Prelim Laboratory Exam

Published in: Business, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
384
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Spl prelim lab 2011 2012

  1. 1. 5057775-228600914400-165735 Colegio de San Juan de Letran-Calamba<br />School of Computer Studies and Technology<br />PRELIMINARY EXAMINATION<br />STRUCTURE OF PROGRAMMING LANGUAGES - LABORATORY <br />Name:_______________________________Date: ____________________<br />Yr & Section: ___________________________Prepared by: VSRivera<br />Using Perl, create a program that will accomplish the following:<br />M A I N M E N U<br />Multiplication<br />Division<br />Exit<br />Choice: <br />Multiplication – the user should be able to input 2 numbers, the multiplicand and the multiplier. It should output the product of the 2 numbers using repeated addition.<br />Sample Output:<br />Insert Multiplicand: 5<br />Insert Multiplier: 3<br />Product: 15<br />The multiplicand is added to itself multiplier times, that is, if you are going to add 5 to itself 3 times the sum is the same as the product of 5 multiplied to 3.<br />5 + 5 + 5 = 15<br />Division - the user should be able to input 2 numbers, the dividend and the divisor. It should output the quotient of the 2 numbers using repeated subtraction.<br />Sample Output:<br />Insert Dividend: 15<br />Insert Divisor: 3<br />Product: 15<br />The divisor is subtracted from the dividend while the dividend is greater than or equal to the divisor, that is, if you are going to subtract 3 times from 15 while the value is greater than 3, then the number of times 3 will be able to subtract from 15 is the same as the quotient of 15 divided by 3.<br />15 – 3 = 12 – 3 = 9 – 3 = 6 – 3 = 3 – 3 = 0<br />Count the number of times the value 3 was able to subtract from 15 while the difference is greater than or equal to 3.<br />Give an appropriate error message if the value of the divisor is greater than the dividend.<br />Output the remainder if the dividend is not exactly divisible by the divisor.<br />Exit – terminates the program.<br />General instruction:<br />Print this exam paper, do not photocopy.<br />Print your program on a short bond paper (8.5” x 11”).<br />Staple the bond paper with this exam paper being the first page before submitting it.<br />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.<br />Put it in a short brown envelope. Write your complete name at the back of the envelope.<br />Submit the envelope personally on or before 12:00 P.M. of July 27, 2011, Wednesday. Time will be based on the wall clock located at the stairway in ITCC. Again, on or before 12:00 P.M. of July 27, 2011. If you think you cannot submit it on time, submit it before the date or the time of submission.<br />Softcopy of the program will be collected during our lecture class on July 27, 2011, Wdnesday.<br />Non-compliance with the instruction will mean non-submission, thus, will require you to take a special exam.<br />

×