





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






Autumn Examinations 2011
Module Code: SOFT
School: Computing
Programme Title: Higher Certificate in Computing – Year 2 BSc in Computing – Year 2 BSc (Hons) in Software Development & Computer Networking – Year 2 BSc (Hons) in Web Development – Year 1
Programme Code: KCOME_6_Y KCOMP_7_Y KDNET_8_Y KWEBD_8_Y
External Examiner(s): Mr Aidan Quilligan Internal Examiner(s): Mr C.E. Manning
Instructions: Answer ALL questions. All questions carry equal marks.
Duration: 2 hours
Sitting: Autumn 2011
Requirements for this examination:
Note to Candidates: Please check the Programme Title and the Module Title to ensure that you are attempting the correct examination. If in doubt please contact an Invigilator.
Question 1.
The function goodPPS validates a PPS Number using formatting rules and a check letter. If the number appears to be valid then the function returns true. Otherwise it returns false.
Some portions of the code have been removed. Complete the program by filling in the missing parts. Write your answers in an answer book.
Details of the check letter algorithm are on the Appendix
Question 2.
This webpage inputs a Euro Banknote serial number from text input box and checks that the number appears valid using formatting rules and a checksum. If the number is valid the background of the text input box is set to green, text saying the number is OK appears, and an image of a tick symbol appears. If the number is invalid the background of the text input box is set to red, text saying the number is not OK appears, and an image of an X symbol appears.
Details of the check sum algorithms are in the Appendix
The code in Part (d) attempts to ensure that the first character is a letter. It is incorrect. Write the correct code.
Euro Bank Note
//make sure it's 12 characters long if(euroNum.length != 12) { valid = false; } (d) //make sure 1st character is a letter var check = euroNum.slice(0,1); if(!(check >= "0") || (check <= "9")) { valid = false; }
//make sure remaining characters are numbers for(num = 1; num < 12; num++) { var number = euroNum.slice(num, num+1); if (e)
valid = false; }
// convert the letter to number A = 1, B=2, C=3 etc
var letterASCII = euroNum.charCodeAt(0);
(f)
//convert last 11 digits from string to integer var number = parseInt(euroNum.slice(1,12)); euroNumTotal = number + letterValue; //add the serial number and the check digit
EuroBanknote Checker by CIT Student
Euro Bank Note:
Enter Euro Bank Note Number
Appendix - Input Formats & Check sum calculations
Irish PPS Numbers are 7 digits followed by a single check letter. The letter is calculated as follows:
The total is set to zero The first 1st digit is multiplied by 8 and the product added to the total The second 2nd digit is multiplied by 7 and the product added to the total The 3rd digit is multiplied by 6 and the product added to the total
and so on until
The 7th digit is multiplied by 2 and added to the total
A modulus 23 is preformed on the total. If this modulus is 0 then the check letter is W. Otherwise the check letter is the letter at the position of the modulus in the alphabet (1=A, 2=B, 3=C)
x 8 x 7 x 6 x 5 x 4 x 3 x 2 40 21 6 15 4 27 14 Total = 127 MOD 23 is 12. Letter 12 is L