Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

School of Information Technology and Electrical Engineering

EXAMINATION

Semester One Final Examinations, 2019

INFS7202 Web Information Systems

Part A:

20 Multiple choice questions 0.5 mark each (total 10 marks)

Answer multiple choice questions on the exam paper

1.   PHP variable names are case sensitive:

A.  True

B.  False

2.   PHP server scripts are surrounded by which delimiters:

A.  …?>

B.  <&>…

C.



D.  

3.   How to write Hello World” in PHP:

A.  echo “Hello World”;

B.  System.out.println(“Hello World”)

C. Hello World

D.  Document.write(“Hello World”)

4.   How to get information from a form that is submitted using “post” method in PHP:

A.  Request.QueryString

B.  Request.Form

C.  $_GET[ ]

D.  $_POST[ ]

5.   When using the GET method in HTTP protocol, form variables are displayed in the URL:

A.  True

B.  False

6.   What is the correct way to free a specified session variable in PHP:

A.  unset($view)

B.  session_unset($view)

C.  session_unset($_SESSION[‘view’])

D.  unset($_SESSION[‘view’])

7.   What is the correct way to create a PHP array:

A. $fruits = (‘apple’, ‘pineapple’, ‘banana’);

B. $fruits = array(‘apple’, ‘pineapple’, ‘banana’);

C. $fruits = new  ArrayList(‘apple’, ‘pineapple’, ‘banana’);

D. $fruits = new array(‘apple’, ‘pineapple’, ‘banana’);

8.   In PHP, if a cookie is set using setcookie(“user”, time() + 600), how long does the cookie will last:

A.  10 hour

B.  10 minutes

C.  1 second

D.  600 milliseconds

9.   In PHP, which superglobal variable holds information about headers, paths, and script locations?

A.  $_GLOBALS

B.  $_SERVER

C.  $_COOKIE

D.  $_GET

10. In CodeIgniter, the default controller of an application can be set in the configuration file:

A.  database.php

B.  config.php

C.  autoload.php

D.  routes.php

11. In CodeIgniter, which one of the following can correctly display the validation errors?

A.  echo $this->validation_errors();

B.  echo $this->errors();

C.  echo errors();

D.  echo validation_errors();

12. Which one is NOT a logging level in CodeIgniter:

A.  info

B.  dev

C.  debug

D.  error

13. Which of the following is used to convert Javascript object to JSON string?

A.  JSON.parse()

B.  JSON.stringify()

C.  JSON.convertToString()

D.  JSON.converter()

14. Which of the following statements correctly compresses all the files in the folder “ ./uploads” into files.zip” in CodeIgniter?

A.  $this->zip->archive(‘ ./uploads/’, ‘files.zip’);

B.  $this->archive(‘ ./uploads/’, ‘files.zip’);

C.  $this->zip->archive(‘files.zip’, ‘ ./uploads/’);

D.  $this->archive(‘files.zip’, ‘ ./uploads/’);

15. Which of the following functions can create an HTML form opening tag for file uploading in CodeIgniter:

A.  form_open()

B.  open_form()

C.  open_form_multipart()

D.  form_open_multipart()

16. Which of the following variables is NOT valid in PHP?

A.  $000_my_Var

B.  $_000_ my_Var

C.  $my_000_Var

D.  $_myVar_000

17. Which of the following correctly loads multiple helpers (e.g., helper1, helper2 and helper3) in CodeIgniter?

A.  $this->load->helper(‘helper1, helper2, helper3’);

B.  $this->load->helpers(array (‘helper1, helper2, helper3’));

C.  $this->load->helper(array (‘helper1’, ‘helper2’, ‘helper3’));

D.  $this->load->helpers(array (‘helper1’, ‘helper2’, ‘helper3’));

18. Which of the following is not a cloud delivery model:

A.  IaaS

B.  BaaS

C.  Saas

D.  Paas

19. Given a piece of PHP code below, if it is accessed 10 times during a client's session, how often was line 6 executed for this client? Note that the numbers on the left have been added as a reference to line numbers and are not part of the code.

Line 1: if(!isset($_SESSION['count']))

Line 2: {

Line 3: $_SESSION['count'] = 0;

Line 4:        $_SESSION['name'] = $_POST['user_name'];

Line 5: }

Line 6: $_SESSION['count']++;

A.  0 time

B.  1 time

C.  9 times

D.  10 times

20. Based on the following two files, index.php and vars.php, what will be displayed in your browser when visiting index.php?

File index.php contains:

php

function foo()

{

global $color; include 'vars.php'; echo "A $color $fruit";

}

foo();

echo "A $color $fruit";

?>

A.  A green appleA green apple

B.  A green appleA

C.  A green

D.  None of the above


Part B:

Short answer questions (total 40 marks)

Answer multiple choice questions on the exam paper

Question 1. Internet Protocol Suite (6 Marks)

Question 1.1 (4 Marks)

Provide the full names of the following protocols and indicate which layers they belong to.

Protocol

Full name

Layer

TCP

IP

FTP

UDP


Question 1.2 (2 Marks)

Provide the full name of SOAP and describe its role in implementing Web services with a brief explanation.

Question 2. Web Application Development (12 Marks)

Question 2.1 (3 Marks)

MVC  is  a  software  architectural  pattern  that  divides  an  application  into  three interconnected  parts.  List  the  names  of these  three  parts  and  explain  how  they communicate  with  each  other  to process  an  item  search  request  in  the  following scenario.

Assume you have developed a student information system to manage student data. When an end-user submits a student ID to the system (Figure 2. 1), its corresponding student name is expected to be found from the backend database and be displayed (Figure 2.2). The database schema is provided (Figure 2.3).

Figure 2. 1: Student search form


Figure 2.2: Search result

Figure 2.3: Database schema

Question 2.2 (2 Marks)

List any two major differences between the Web services and the Web APIs with brief explanations.

Question 2.3 (2 Marks)

Describe the main purpose of Web caching with a brief explanation.

Question 2.4 (2 Marks)

List two major advantages of cloud

computing.

Question 2.5 (3 Marks)

The Ansible components include Inventory, Playbook, Play, Task, Role, Handler,    Template, Module and Variable. Choose the correct components to fill in the blanks below.

1. _________________ is a call to (a) specific Ansible _________________.

2. _________________ is the actual unit of code executed by Ansible on local host, remote host or through _______________.

3. ___________________ is one or more tasks executed on a given host.

4. ___________________ is a list of managed nodes.

Question 3. Database (3.5 Marks)

Question 3.1 (2 Marks)

Briefly explain the main differences between the relational database and NoSQL in terms of the data structure and scalability.

Question 3.2 (1.5 Marks)

MongoDB is a cross-platform document-oriented database program and it provides three ways to perform data aggregation. List the names of these three aggregation   methods. The explanation of each method is NOT required.

Question 4. AJAX and MySQL in native PHP (7 Marks)

Assume that the table Items” (Figure 4. 1) is created with a number of records, each of which is associated with four attributes, including item_name, size, price and type. Complete  the  scripts SearchItems.html”  and Search.php”  below  to  perform  a dynamic item search using AJAX. Display the prices of all retrieved items on the Web page after clicking the search” button, as illustrated by Search_Example_ 1 (Figure

4.2) and Search_Example_2 (Figure 4.3).

The search criteria are:

1) the “item_name” should include the query keyword

2) the type” must be equal to the query type     Note that: write down your answers on Page 18.

item_name

size

price

type

Stone Blast Frypan

28cm

19

kitchen

Bamboo Stackable Basket

Small

7

kitchen

Flan Pan

12cm

3

bakeware

Figure 4.1. Table Items

Figure 4.2. Search_Example_ 1

Figure 4.3. Search_Example_2

SearchItems.html

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>Search Itemtitle>

</head>

<body>

<!-- input form -->

<form>

<label for="keyword">Item Name:label>

<input type="text" id="keyword"/>

<label for="type">Type:label>

<input type="text" id="type"/>

<input type="button" onclick="showItem()" id="mybutton" value="Search"> </form><br/>

<p id="output">p>

body>

<script>

var output = document.getElementById("output"),

keywordInput = document.getElementById("keyword"),

typeInput = document.getElementById("type");

// generate dynamic search results by AJAX

function showItem(){

var keyword = keywordInput.value;

if (keyword == "") {

output.innerTEXT = "";

} else {

if (window.XMLHttpRequest) {

// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new ______;

} else {

// code for IE6, IE5

xmlhttp = new ActiveXObject("Microsoft.XMLHTT