0% found this document useful (0 votes)
5 views9 pages

2023 June-1

The document consists of a series of programming and e-commerce questions, including JavaScript functions for various scenarios, e-commerce solutions for a company named 'Kithula', and PHP code segments for a web application. It covers topics such as form validation, area calculation, date checking, and security services in cryptography. Additionally, it addresses the implementation of cookies and sessions in web applications, as well as potential security threats in online transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views9 pages

2023 June-1

The document consists of a series of programming and e-commerce questions, including JavaScript functions for various scenarios, e-commerce solutions for a company named 'Kithula', and PHP code segments for a web application. It covers topics such as form validation, area calculation, date checking, and security services in cryptography. Additionally, it addresses the implementation of cookies and sessions in web applications, as well as potential security threats in online transactions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Question One (25 Marks)

a) Explain the following code. (2 marks)

<input type="button" value = "click me" onclick =


"window.open(‘http://happy.com’)”>

b) Explain the following code. (3 marks)

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:

i. What would be the technical limitations? Name two. (2 marks)

ii. What would be the non-technical limitations? Name two. (2 marks)

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)

g) Explain two advantages and two disadvantages to society because of e- (4 marks)


commerce.
Page 3 of 4
Question Three (25 Marks)

This question is based on lab practices.


In trash to cash web site, assume we add PHP code segment to allow the users to write a comment on
each and every advertisement posted.

1. <?php session_start();

BLOCK A - To check whether the session is set

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

9. <textarea name="txtComment" required="required" class="text">


</textarea>
10. <button type="submit" name="btnsubmit" >Post</button>
11. <?php
12. $con = mysqli_connect("1","2","3","4");
13. $_SESSION['id'] = $_GET['id'];
14. if(!$con)
15. {
16. die("Cannot connect to DB server");
17. }
18. $sql ="";
19. $result = mysqli_query($con,$sql);
20. if(mysqli_num_rows($result)> 0)
21. {
22. while($row = mysqli_fetch_assoc($result))
23. {

BLOCK C - To display the comments one after the other

Page 4 of 5
24. }}?>
25. </div></td></tr></table></td></tr> </table></form></body>
26. </html>

The page is access via the hyperlink given below.

<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)

a) Briefly explain following security services. (3 marks)


i. Non-Repudiation
ii. Availability
iii. Access Control
b) In Symmetric Cryptography
i. Explain how confidentiality is achieved. (1 mark)
ii. Explain how integrity is achieved. (1 mark)
iii. Explain how authentication is achieved. (1 mark)
c) In Asymmetric Cryptography
i. Explain how confidentiality is achieved. (1 mark)
ii. Explain how integrity is achieved. (1 mark)
iii. Explain how authentication is achieved. (1 mark)

d) Name two differences of Symmetric Cryptography and Asymmetric (2 marks)


Cryptography.
e) Is all internet traffic encrypted? Briefly explain your answer (2 marks)
f) You would be ordering headphone from daraz.lk. Since very sensitive data like
credit card information is passed, Server and the client should follow the
necessary protocols to obtain several security services.
i) Name four security threats for this kind of transaction. (2 marks)
ii) Assume daraz.lk has already obtained the digital certificate from a
Certification Authority. What is the purpose of having a specific
authority to produce digital certificates? (1 mark)
iii) How do we ensure that the certificate belong to Daraz? (1 mark)
iv) How does the certification authority authenticate the certificate? (1 mark)
v) If an intruder steals the digital certificate of the server, will it be a threat?
Justify your answer. (2 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?

End of the Paper

Page 9 of 9

You might also like