Hons. B.Sc. Degree in Computer Games Development
Web Development and Databases
March 2011
Instructions to candidates:
Answer any four questions – all questions carry equal marks. Start your answer at the top of a new page in your answer booklet. Be sure to read each question carefully, noting the marks allocated to each part.
Question 1.
(a) Within a typical web application, the HTML content that is provided by the web server can be either static or dynamic. Define each of these terms, providing one example of static content and one example of dynamic content. [4] (b) A standardized mechanism exists for creating dynamic content on the web and it is built into
the majority of the world's web servers. Identify the standard (name it) and provide a brief
description of how it works. [5]
(c) What is the generic name given to processes that conform to the programming standard you
identified in part (b) of this question. [1]
(d) Draw a diagram that details the process of a web request being transformed into a web response as processed using the mechanism identified in part (b) of this question. Be sure to clearly draw and label the browser and web server on your diagram. [5] (e) With reference to the mechanism identified in part (b) of this question, describe what
happens to the programmed process's input and output when the process is used to create
dynamic content on any web server. [5]
(f) When creating dynamic content, the generated response has two parts. What are they are and why is it important to always include a value for the first one? [5]
Question 2.
(a) Most web applications can be designed to conform to the MVC pattern. What do the letters
“M”, “V” and “C” stand for? [3]
(b) Provide a brief, one-paragraph description of each of the MVC components. [6] (c) With reference the MVC pattern, identify and describe the use of an example of each MVC
component (in other words: when working on the web, what constitutes an “M”, what constitutes a “V” and what constitutes a “C”)? [6] (d) Why would a modern web developer want to conform to the MVC pattern? [2] (e) Within the context of web development, what is a templating engine and why would a web
Question 3.
With reference to database technologies:
(a) What does the word schema mean? [2]
(b) What two rules must not be broken when ensuring that your table data is atomic? [4] (c) In addition to atomic data, what other condition must hold in order to ensure your table data
conforms to the first normal form? [2]
(d) Study the following data table:
--- | Food | Ingredients | --- | Bread | flour, eggs, milk | ---
| Salad | lettuce, tomato, eggs | ---
Is the data in this table atomic? Why or why not? [3] (e) Study the following data table:
--- | Lecturer | Student1 | Student2 | --- | Paul | Harry | Mary | --- | Joe | Pat | Harry | ---
Is the data in this table atomic? Why or why not? [3] (f) Describe an issue you might have with the structure of the data in part (d) of this question.
Suggest (and provide) a change in structure that might help with the issue you have
identified. [4]
(g) Describe an issue you might have with the structure of the data in part (e) of this question. Suggest (and provide) a change in structure that might help with the issue you have
identified. [4]
Question 4.
(a) Expand the acronym CRUD as it relates to database technology, providing a one-line
description of each expanded letter. [4]
(b) Relate CRUD to SQL's query language and provide the SQL equivalent to each the
expanded CRUD letters. [4]
(c) Study this short Python program:
import sqlite3 connection = sqlite3.connect('test.sqlite') cursor = connection.cursor() cursor.execute("""SELECT DATE('NOW')""") connection.commit() connection.close()
What does this short program do? [2]
(d) For each of the six lines of code, provide a one-line description of what each line does. [12] (e) Identify the line(s) of code that you would need to amend if you decided to adjust this code
to work with another database engine technology. Why did you change the line(s) you
chose? [3]
Question 5.
(a) “By 2015, the vast majority of serious software development within the games area will be web-based”.
Take a moment to consider the above statement.
You have recently been hired by an established games development company. They have asked you to prepare a short 12-slide presentation to be delivered to the company's
Question 6.
Carefully study this Python function:
1. def get_athlete_from_id(athlete_id): 2. connection = sqlite3.connect(db_name) 3. cursor = connection.cursor()
4. results = cursor.execute("""SELECT name, dob FROM athletes WHERE id=?""", 5. (athlete_id,)) 6. (name, dob) = results.fetchone()
7. results = cursor.execute("""SELECT value FROM timing_data WHERE athlete_id=?""", 8. (athlete_id,)) 9. data = [row[0] for row in results.fetchall()]
10. response = { 11. 'Name': name, 13. 'DOB': dob, 14. 'data': data, 15. 'top3': data[0:3] 16. } 17. connection.close() 18. return(response)
(a) Provide a one-paragraph description of what this function does? [5] (b) Why does this function need two SQL SELECT statements? [2] (c) What is the purpose of the “?” placeholder in each of the SQL SELECT statements? [3] (d) Within which type of application would you envisage this function being used? [2] (e) Describe in detail what lines 6 and 9 do, being sure to concentrate on the difference between calls to the fetchone() and fetchall() methods. [6] (f) What type of data structure is returned by the function on line 18? [2] (g) Why is the call to close() important on line 17? Describe what would happen if this line of
code was missing from the function and the function was called 1000 times in quick