Vous êtes sur la page 1sur 15

1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Par t A - Multiple Choice Questions: Total 10 Mar ks

Circle the most appropriate option for each question.

Question 1 (2 mar ks):


Which of the following CSS properties and values can be used to hide an element?

a) hide: true
b) display: none
c) z-index: -1
d) visibility: off

Question 2 (2 mar ks):


Which of the following javascript statements can be used to change the width of an element
with the ID 'mydiv' to 40%?

a) document.getElementById('mydiv').width = '40%';
b) document.getElementById('mydiv').style.width('40%');
c) document.getElementById('mydiv').style.width = ' 40%';
d) document.getElementById('mydiv').style.width = 40%;

Question 3 (2 mar ks):


Which of the following Javascript statements correctly displays the last element of an array
called 'products'?

a) console.log(products.get());
b) console.log(products[-1]);
c) console.log(products[products.length - 1]);
d) console.log(products[products.length]);

1 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 4 (2 mar ks):


Which of the following CSS selectors will match all img tags inside an element with a class
'shopping-cart'?

a) img #shopping-cart
b) .shopping-cart,img
c) .shopping-cart img
d) .shopping-cart #img

Question 5 (2 mar ks):


Which tag do you use to embed a CSS stylesheet in an HTML document?

a) style
b) link
c) a
d) href

END OF PART A

2 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Par t B - Technical Skills: Total 20 Mar ks

Write your answer in the space below each question.

Question 1 (5 mar ks):


Write the HTML5 code required to create a form that looks like the following screen design.
Only write the FORM element and its contents (you do not need to include an entire web
page, and you do not need to include any javascript in your solution).

• For the email field, make sure that the user can only enter a valid email address.
• The user can only select one day (either Friday, Saturday, or Sunday)
• The form elements are grouped together with the caption 'Options'

3 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

<fieldset>
<legend>Options</legend>
Preferred Day: <br />
<input type="radio" name="day" /> Friday <br />
<input type="radio" name="day" /> Saturday <br />
<input type="radio" name="day" /> Sunday <br />

<br />

Email: <input type="email" />


</fieldset>

1 mark: email field (only 0.5 mark if type=”text”)


2 marks: radio buttons (only 1 mark if missing name attribute)
2 marks: fieldset and legend (1 mark each)

4 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 2 (5 mar ks):


Complete the missing javascript code to make change the background color of a text field to
yellow when the user clicks on the text field.

Here is the partially completed code (some code has been omitted as indicated by the ellipses
"…"). The space marked with the arrow is where the missing javascript belongs. Write the
missing javascript on the next page.

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title> </title>
<script>
...
</script>
<style></style>
</head>
<body>
<input type="text" id="myfield" onclick="highlight()"/>
</body>

</html>

Write your Javascript on the next page.

5 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

function highlight(){
document.getElementById('myfield').style.backgroundColor = 'yellow';
}

1 mark: correct function definition including name (0.5 marks if wrong name)
1 mark: document.getElementById('myfield')
1 mark: style
1 mark: backgroundColor (only 0.5 marks if hyphenated or incorrect camel case)
1 mark: 'yellow' or rgb() or #hexcode (0.5 marks if missing quotes)

6 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 3 (5 mar ks):


Write down the CSS style definition required to style the body so that it has:

a) a correct CSS selector


b) a 2em padding on all sides
c) a width of 80%
d) a font family set to Arial
e) a background image set to the file "sky.png"

body{
padding: 2em;
width: 80%;
font-family: arial;
background-image: url('sky.png');
}

1 mark each for a - e

7 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 4 (5 mar ks):


Complete the missing javascript code in order to count how many elements are in a javascript
array representing a shopping cart (some code has been omitted as indicated by the ellipses
"…").

• Create the function checkIfOnline() so that when the user clicks on the button,
the player’s name input by the user is read from the text field. Loop through the array,
and if the player is in the array then alert the message "The player is online".
Otherwise if the player is not in the array, alert the message "The player is
offline".

Here is the partially completed web page.

...
<script>
var playersOnline = new Array();
playersOnline.push("Rob");
playersOnline.push("Ali");
playersOnline.push("Sue");
playersOnline.push("Shaz");
playersOnline.push("Matt");
playersOnline.push("Aaron");

</script>
...

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


<button onclick="checkIfOnline()">Check</button>

...

Write your Javascript on the next page.

8 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

function checkIfOnline(){
var p = document.getElementById('player').value;

if(playersOnline.indexOf(p) != -1){
alert('The player is online');
}else{
alert('The player is offline');
}
}

1 mark: function definition (0.5 marks if incorrect name)


1 mark: get player value
1.5 marks: alert if online
1.5 marks: alert if offline

Nb: could be done with loop, indexOf(), every(), filter(), find(), findIndex()

9 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

END OF PART B

10 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Par t C - Shor t Answer Questions: Total 10 Mar ks

Write your answer in the space below each question.


Question 1 (2 mar ks):
Describe what a server side and client side language is.

Server side language runs on the server, e.g PHP

Client side language runs within the browser, e.g. Javascript

Question 2 (2 mar ks):


What is the function of a Web Server and an FTP Server?

Web Server: responds to HTTP requests


FTP Server: facilitates file transfer to/from a server

11 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 3 (2 mar ks):


Describe two (2) ways in which you can specify CSS style information for a document.

Linked
Embedded
Inline
Through javascript

Question 4 (2 mar ks):


What is the function of a Domain Name System (DNS) server?

Looks up IP address from domain name

12 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

13 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

Question 5 (2 mar ks):


Describe two (2) ways to optimise how your site is indexed by a search engine.

meta tags
robots.txt
alt attributes for img tags
descriptive filenames
sitemap file
descriptive title tag

14 of 15
1621ICT - Web Design & Development Deferred Final Examination, Semester 3, 2016

END OF PART C

END OF EXAMINATION

15 of 15

Vous aimerez peut-être aussi