19CSCI04I Internet Programming (202-2023) - Send
19CSCI04I Internet Programming (202-2023) - Send
Final Examination,
2022-2023
Informatics and Computer Science
Module Title Internet Programming
Instructions to students:
Page 1 of 6
b) Represent the following XML to its corresponding JSON [9 marks]
<employees>
<employee>
<firstName>John</firstName>
<lastName>Doe</lastName>
</employee>
<employee>
<firstName>Anna</firstName>
<lastName>Smith</lastName>
</employee>
<employee>
<firstName>Peter</firstName>
<lastName>Jones</lastName>
</employee>
</employees>
c) For the following HTML, could you tell what does javascript do. [6 marks]
<html>
<body>
<ul>
<li>Yellow</li>
<li>Green</li>
<li>Blue</li>
<li>Orange</li>
</ul>
<script>
var list = document.getElementsByTagName("li");
document.writeln("<h1>The unordered list
consists of: " + list.length + " elements</p>");
for(var i = 0; i<list.length;i++)
{
list[i].style.backgroundColor = list[i].innerHTML;
}
</script>
</body>
</html>
Page 2 of 6
Q2 Create two pages,
a) The first page, send.php, that has a form with the following controls: three text
box to collect the user name, password, and email.
b) You should check that the user entered a value in the user name, password and
email text fields.
c) The second page, recieve.php, receives this data and checks whether user
name exists in the database or not. If it exists then show statement “user is
existing”, otherwise insert this data in user table.
d) The database name is “users” and database username is “root” and password is
empty.
e) The table name in the database is “user” and its fields are “Uname”, “Upass”
and “Email”.
[Q2 Total: 25 marks]
Page 3 of 6
Q 3 Use the XML code listed here to do the following:
<?xml version="1.0" encoding="UTF-8"?>
<shiporder orderid="889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">
<orderperson>John Smith</orderperson>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>
Page 4 of 6
Q4 Answer the following Questions
a) Give a comparison between GET and POST methods in the form element
[6 marks]
b) Give a comparison between Cookies and Session [6 marks]
c) Give a comparison between Traditional web applications vs. Ajax
applications [7 marks]
d) Explain the function preg_match and mention its parameters [6 marks]
Page 5 of 6
Page 1 of 1