0% found this document useful (0 votes)
2 views

2023 February

The document contains a series of programming and e-commerce questions, including JavaScript functions for form validation and calculations, as well as questions related to a publishing company's digital strategy. It covers topics such as e-commerce solutions, technical and non-technical limitations, benefits to customers and businesses, and security services in cryptography. Additionally, it includes practical coding tasks related to PHP and database interactions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

2023 February

The document contains a series of programming and e-commerce questions, including JavaScript functions for form validation and calculations, as well as questions related to a publishing company's digital strategy. It covers topics such as e-commerce solutions, technical and non-technical limitations, benefits to customers and businesses, and security services in cryptography. Additionally, it includes practical coding tasks related to PHP and database interactions.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Question One (25 Marks)

a) Explain the following code. (2 marks)

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


(‘Happy New Year 2024’)”>

b) Explain the following code. (3 marks)

function Validation()
{
if(allGood())
{
alert("Successfully Added")
}
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 8
Write separate JavaScript functions to the scenarios given below.

c) Assume that the page accepts a series of integer numbers separated by space. Write
a JavaScript function called calculateSum(). The functions should calculate the
sum and return the sum. If user has not entered integers, the method should return
false.

Input : 2 3 4 5 6 // the method should return 20


Input :2 s 5 7 f // the method should return false.
(5 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 month ahead than the
system date. If the given date match with the criteria, method should print the date
(5 marks)
in a readable format. If not, function should display an error.

e) Assume that the page accepts a distance in Kilometers (km) as the value. Write a
JavaScript method called convertDistance() to convert the km to miles. The
method should accept only integers. If an invalid value is entered, error message
(5 marks)
should be displayed.
Note : 1 km = 0.621 mile

f) Assume that the page accepts an ISBN number as the value. Write a JavaScript
function called validateISBN() to validate the ISBN number. If the user has
entered a correct value display an alert saying, “Value is accepted”. If the value is
incorrect, an error message should be displayed. (5 marks)

Every ISBN consists of thirteen digits and preceded by the letters ISBN. The
thirteen-digit number is divided into four parts, each part separated by a hyphen.
ISBN d d d d – d d d d – d d d – dd (d is a digit)
ISBN 1234-5678-245-33

Page 2 of 8
Question Two (25 Marks)

The funny side Publications Company, established in 1960, publish “The comic magazine” every two
months. Which is one of the best sellers. Other than their main magazine, the publishers print three
weekly newspapers. The papers cover local government events, business achievements, sports, and local
gossip. They offer advertising opportunities via supplementary materials that may be tailored toward
business. They also offer advertising in the papers as well.

The Comic magazine consists of comics art in the form of sequential panels that represent individual
scenes. The stories are written by in-house writers and as well as guest authors.

To be in the competitive market, the publishing company decided to start a digital version of “The
Comic Magazine”.

a) Write one e-commerce solution that the publishing company can adapt under (5 marks)
each classification given below:
i. B2B
ii. B2C
iii. Intra-Business
iv. Collaborative Commerce
v. Mobile Commerce
b) Write one e-commerce solution that the publishing company can adopt under (3 marks)
each technology given below:
i. EDI
ii. Electronic Market
iii. Internet Commerce
c) Describe three things to consider when internationalizing an ecommerce (2 marks)
business.

Page 3 of 8
d) 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)

e) Write two ways in which you could achieve visibility to the digital magazine. (1 mark)

f) Which delivery method can be used in the above context? Justify your answer. (2 marks)

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


commerce.

Question Three (25 Marks)

This question is based on lab practices.


In ThinkPad web site, assume we add PHP code segment to display comments of a particular image.

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/Style.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 8
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.
21. if(mysqli_num_rows($result)> 0)
22. {
23. while($row = mysqli_fetch_assoc($result))
24. {

BLOCK C - To display the comments one after the other

25. }}?>
26. </div></td></tr></table></td></tr> </table></form></body>
27. </html>

The page is accessed 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)

Page 5 of 8
c) Complete the code on Block B, to display the image. You can refer to the output
given in figure 1.

Figure 1 : Comment.php page (4 marks)

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

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)

Page 7 of 8
ii. Explain how integrity is achieved. (1 mark)
iii. Explain how authentication is achieved. (1 mark)

d) Name and explain four security attacks. Clearly indicate which service is (2 marks)
violated by each attack.
e) Consider two friends, Alice, and Bob, who wish to exchange sensitive
information via asymmetric cryptography.
i. Both parties must obtain digital certificates from a Certification
Authority. What is the purpose of having a specific authority to
produce digital certificates? (1 mark)

ii. How does the certification authority authenticate a certificate? (1 mark)

iii. How can Alice ensure that the certificate belongs to Bob? (2 marks)

iv. How can Alice send a message to Bob without violating


Confidentiality? (1 mark)

v. How can Alice send a message to Bob without violating


Integrity? (1 mark)

vi. How can Alice send a message to Bob without violating


Authentication? (1 mark)

vii. Name two disadvantages of using asymmetric cryptography. (2 marks)

viii. Suggest a solution to handle the disadvantage named in part vii. (1 mark)

ix. If an intruder steals the digital certificate of Bob, will it be a


threat? Justify your answer. (2 marks)

f) To obtain security services, first the browser must open a secure connection with
the server. They should follow the SSL protocol. Illustrate how the SSL protocol
works. (2 marks)

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 Question Paper

Page 8 of 8

You might also like