Professional Documents
Culture Documents
1. Define the roles of HTML, CSS, JavaScript and PHP in a website? Explain the purpose of
GET and POST in PHP with examples. [CO1] [5 Marks]
4 Very Good Properly defined the roles of 3 of HTML, CSS, Javascript and
PHP in a website. The others were missing or incorrect. One of
the purpose of GET or POST isn’t well defined.
1 Poor Only one of the roles of HTML, CSS, JavaScript and PHP is
defined properly.
2. Write a PHP script which takes four numbers as inputs using a POST request in an
HTML form and prints the maximum number, minimum number and the average.
[CO2] [5 marks]
5 Excellent The program can take 4 numbers as inputs using POST request
and prints the maximum number, minimum number and the
average.
MZC 183DA
4 Very Good The program can take 4 numbers as inputs using POST request
and prints 2 of maximum number, minimum number and the
average.
3 Good The program can take 4 numbers as inputs using POST request
and prints 1 of maximum number, minimum number and the
average.
2 Average The program can take 4 numbers as inputs using POST request.
1 Poor The program can take at least one number as inputs using POST
request.
3. Each person in Italy has a unique identifying ID code issued by the national tax
office after the birth registration: The Fiscal Code (Codice Fiscale). [CO3] [5 Marks]
Given a JavaScript object containing the personal data of a person (name, surname,
gender
and date of birth) return the 11 code characters as a string following these steps:
o At least 3 consonants then the first three consonants are used. (Newman -
> NWM).
o Less than 3 consonants then vowels will replace missing characters in the
same order they appear (Fox -> FXO | Hope -> HPO).
o Less than three letters then "X" will take the third slot after the consonant
and the vowel (Yu -> YUX).
Generate 3 capital letters from the name, if it has:
o Exactly 3 consonants then consonants are used in the order they appear
(Matt -> MTT).
o More than 3 consonants then first, third and fourth consonant are used
(Samantha -> SNT | Thomas -> TMS).
o Less than 3 consonants then vowels will replace missing characters in the
same order they appear (Bob -> BBO | Paula -> PLA).
o Less than three letters then "X" will take the the third slot after the
consonant and the vowel (Al -> LAX).
Generate 2 numbers, 1 letter and 2 numbers from date of birth and gender:
o Take the last two digits of the year of birth (1985 -> 85).
o Generate a letter corresponding to the month of birth (January -> A |
December -> T) using the table for conversion included in the code.
o For males take the day of birth adding one zero at the start if is less than 10
(any 9th day -> 09 | any 20th day -> 20).
MZC 183DA
o For females take the day of birth and sum 40 to it (any 9th day -> 49 | any
20th day -> 60).
Examples
fiscalCode({
name: "Matt",
surname: "Edabit",
gender: "M",
dob: "1/1/1900"
}) ➞ "DBTMTT00A01"
fiscalCode({
name: "Helen",
surname: "Yu",
gender: "F",
dob: "1/12/1950"
}) ➞ "YUXHLN50T41"
fiscalCode({
name: "Mickey",
surname: "Mouse",
gender: "M",
dob: "16/1/1928"
}) ➞ "MSOMKY28A16"
Notes
• Code letters must be uppercase.
• Date of birth is given in D/M/YYYY format.
Write a JavaScrpit program to print the fiscal code.
MZC 183DA
5 Excellent The program accurately prints the fiscal code based on the
provided object.
4 Very Good The program prints the fiscal code with one minor logical
mistake.
3 Good The program prints the fiscal code with two logical errors.
2 Average The program can process the object but exhibits the completely
wrong fiscal code.
4. Write a JavaScript program which accept a number as input and insert dashes (-) between
each two even numbers. For example, if you accept 025468 the output should be 0-254-
6-8. [CO3] [5 Marks]
5 Excellent The program can take input through prompt and print the exact
formatted output.
4 Very Good The program can take input from prompt but contains one
minor error in the code.
3 Good The program can take input from prompt but contains several
minor logical errors in the code.
2 Average The program can take input through prompt but contain major
mistakes in the code.