Perl take home final exam
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

Perl take home final exam

  • 1,542 views
Uploaded on

Take Home Final Exam of 4CS and 4IT

Take Home Final Exam of 4CS and 4IT

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
1,542
On Slideshare
1,542
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
43
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Linux IV – Perl ProgrammingTake Home - Final ExaminationLINUX IV – PERL PROGRAMMING  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 name, course, and subject in front of the envelope.  Submit your exam papers personally on or before 10:00 P.M. of March 14, 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 thespecial examGood luck and thank you for a wonderful semester!Create a PERL script that will perform the following:Name: ___________________________________ LINUX IV – PERL PROGRAMMINGTEST I – PERL PROGRAMMINGCELLPHONE TRANSACTIONTransaction Menu 1. View account Balance 2. Share-A-Load 3. Load 4. Text 5. Call 6. Exit Choice:Conditions:The following are the conditions for call and text options: - the user could only text if he/she has at lest 1 peso load o if the account has less than 1 peso, then the message “Message Sending Failed!” will be displayed o 1 peso per text - The user can only call if he or she has at least 8 pesos in his/her account - The user can share-a-load if he/she has enough balance in his/her accountSample OutputView Account BalanceYour account balance as of today is 12.50Share-A-LoadEnter Mobile Number: 09228545127Amount: 10Confirmation:Your Share-A-Load has successfully sent!1 peso service fee for the share-a-load transactionYour current balance as of now is 1.50TextEnter Mobile Number: 09228545127Message: Congratulations Pare!
  • 2. Confirmation:Message has been successfully sentCallEnter Mobile Number: 09228545127Confirmation:Your do not have enough balance to make this call! Please reload now.LoadEnter Mobile Number: 09228545127Amount: 100Confirmation:100 peso has been loaded to your accountYour current balance is 101.50
  • 3. LINUX IV – WRITTEN  Exam should be accomplished using your own hand writing using ballpen of blue ink only.  Write your answers in a short bond paper (8x11); do not write at the back of the bond paper. 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 name, course, and subject in front of the envelope.  Submit your exam papers personally on or before 10:00 P.M. of March 14, 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 thespecial examGood luck and thank you for a wonderful semester!Name: ___________________________________ LINUX IV – PERL PROGRAMMINGTEST II – WRITTENWrite a program that reads a line of input and prints out the following: • 11 if the line consists of a non-zero integer • 00 if the line consists of 0 or a stringSuppose the value of $num is 2010. What string is assigned to $text in each of the following cases?a $text = "This string contains $num.";b $text = "$num is my favorite number.";c $text = Assign $num to this string.;What is the value of the following expressions?a. 17 * 2 ** 3 / 9 % 2 << 2b. 0 && (171567 * 98275 / 1174.5 ** 4)c. 1171 ^ 904d. "abc" . "de" x 2Assume the following assignments have been performed:@list = (1, 2, 3);$scalar1 = "hello";$scalar2 = "there";What is assigned to the array variable @newlist in each of the following cases?a. @newlist = @list;b. @newlist = reverse(@list[1,2]);c. @newlist = ($scalar1, @list[1,1]);d. ($dummy, @newlist) = @list;e. @newlist[2,1,3] = @list[1,2,1];f. @newlist = <STDIN>;Assume that the following assignments have been performed:@list1 = (1, 2, 3, 4);@list2 = ("one", "two", "three");
  • 4. What is the value of $result in each of the following cases?($dummy, $result) = @list1;$result = @list1;($result) = @list2;($result) = @list1[1..2];$result = $list2[$list1[$list1[0]]];$result = $list2[3];