2023 June-1
2023 June-1
function Validation()
{
if(test())
{
alert("Values entered")
}
else
window.preventDefault();
}
Consider the following HTML page: Part (c) to (f) are based on this page.
Design
Code
<html><head></head>
<body>
<form id="form1" name="form1" method="post" action="">
Enter a Value
<label for="txtValue"></label>
<input type="text" name="txtValue" id="txtValue" />
<input type="submit" name="button" id="button"
value="Submit" />
</form></body></html>
Page 1 of 2
Write separate JavaScript functions to the scenarios given below.
c) Assume that the page accepts three numbers (a, b, h) separated by a comma. Write
a JavaScript function called calculateArea() to calculate and display the area of a
Trapezium. If user enters characters or incorrect values, function should display
an error.
Area = ½(a+b) * h
Input: 5,5,10
Output: 50 (6 marks)
d) Assume that the page accepts a date. Write a JavaScript function called
checkDate() to check whether the given date is 1 or more years past than the
system date. If the given date match with the criteria, method should print the date
in a readable format. If not, function should display an error.
(5 marks)
e) Assume that the page accepts String as the value. Write a JavaScript method called
printHashTags() to print each word with a Hash tag. Words should be printed in
simple letters.
Example :
Input : Redbull gives you wiings
Output :
#Redbull
#gives
#you
(5 marks)
#wiings
f) Assume that the page accepts amount in LKR as the value. Write a JavaScript
method called convertMoney() to convert the LKR amount to US Dollars. The
method should accept only integers. If an invalid value is entered, error message
should be displayed.
(4 marks)
Exchange Rate : 1$ = 315LKR
Page 2 of 3
Question Two (25 Marks)
“Kithula” is a local company established in 2015. They manufacture and sell food products like treacle,
Sri Lankan sweets and of cause premium Kithual Raa . Company has several factories around the
country and the Head office is in Colombo. Now company exports products to Australia and USA and
looking for more partners from other countries.
a) Write one e-commerce solution that “Kithula” can adapt under each (5 marks)
classification given below:
i. B2B
ii. B2C
iii. Intra-Business
iv. Collaborative Commerce
v. Mobile Commerce
b) Write one e-commerce solution that “Kithula” can adopt under each (3 marks)
technology given below:
i. EDI
ii. Electronic Market
iii. Internet Commerce
c) When applying e-commerce to the above-mentioned context:
iii. What would be the benefits to the customer? Name two. (2 marks)
iv. What would be the benefits to the business? Name two. (2 marks)
d) Write two ways in which you could achieve visibility to the company website. (1 mark)
e) Which delivery method can be used in the above context? Justify your answer. (2 marks)
f) What is G2C? List out 4 areas where G2C concept can be implemented. (3 marks)
1. <?php session_start();
2. ?>
3. <html>
4. <head>
5. <link rel="stylesheet" type="text/css" href="css/loginStyle.css"
/>
6. </head><body>
7. <form id="form1" name="form1" method="post"
action="addComment.php">
8. <table width="628" border="0" align="center">
BLOCK B - To display the image
Page 4 of 5
24. }}?>
25. </div></td></tr></table></td></tr> </table></form></body>
26. </html>
<a href='Comment.php?id=".$imageID."&path=".$picpath."'>
Note : $imageID – (holds the ID of the image ) and $picpath (hold the path of the image) are variables
defined by the programmer.
a) Complete the code on Block A. The code should check whether the user is an
authorized user. Unauthorized users should be redirected to the login.php page.
Note: A session called “UserName” is created if he/she is an authorized user. It
contains the name of the user. (4 marks)
b) What are the four parameters that should be passed to mysqli_connect method in
Line 12? (2 marks)
c) Complete the code on Block B, to display the image. You can refer the output given
(4 marks)
in figure 1.
Page 5 of 6
Figure 1 : Comment.php page
d) Complete the code on Block C, to display the Comments one after the other.
You can refer the output given in figure 1. (4 marks)
Page 6 of 7
e) Write the SQL query to be stored as the value of variable $sql (Line 18) to
retrieve the comments given from the database for the particular image.
The structure of the database table is as follows:
Table Name : tblComment
Field Name Type
commentID Auto Generated / Primary key
description Varchar (1000)
imageID Varchar (50)
email Varchar (20) (4 marks)
f) Assume you are using a Cookie to store the path of the image instead of passing
via the URL. Write the php code segment to create the cookie.
(2 marks)
(2 marks)
g) Write a php code segment to delete all sessions.
(3 marks)
h) Differentiate cookies and sessions. Write three points
Page 7 of 8
Question Four (25 Marks)
Page 8 of 9
g) SSL stands for Secure Sockets Layer and, in short, it's the standard technology
for keeping an internet connection secure.
i. Illustrate how the SSL protocol works. (2 marks)
ii. Explain how confidentiality is achieved in SSL. (1 mark)
iii. Explain how integrity is achieved in SSL. (1 mark)
iv. Explain how authentication is achieved in SSL. (1 mark)
Extra Question for those who could not answer well: (5 marks)
i. Explain any area that you have studied, which was not asked in the paper?
Page 9 of 9