Page 1

M275, Web Development Using PHP and MySQL First Semester 2013 -2014

Assignment Booklet Cut-off date December 10th, 2013 Plagiarism Warning: As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote other persons’ work in your TMA. Any act of plagiarism will be penalized as per the AOU's rules and regulations.

Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work): I hereby declare that this submitted TMA work is a result of my own efforts and that I have not plagiarized any other person's work. I have provided all references of information that I have used and quoted in my TMA work. Name of Student:……………………………….. Signature:…………………………………………... Date:……………………………………………………


This assignment should be submitted electronically. You should write your solutions to the questions in a single Word document, which is named using your short ID (6 digits), your full name, the course code and the TMA. Your file name should look like as follows: M275-TMA-FirstSemester-2013_2014_YourBranchName-YourIDYourFullName.doc

Submit your document to your tutor on or preferably before the cut-off date shown above. This TMA assesses your work of the course covering the material from PART 2 TO PART 4 in M275. The total marks for each question are shown at the beginning of each question. You are requested to provide answers to ALL questions. You should include the source code for the programming exercises with brief programmers’ comments. Furthermore, you are kindly requested to provide screen shots that show your name and ID for programming questions. Marks are allocated as follows: Question Question 1 Question 2 Question 3 Question 4 Total

Allocated marks 20 20 20 40 100


Question 1: [20 marks] 1) Consider an array of integers that contain the numbers 1, 2, 30, 11, 17 and 3. Write a PHP code that loops through this array, counting and printing out the number of odd integers within the given array. [5 marks]

2) What is a function? And what is it useful for in programming?

[5 marks]

3) Using PHP, implement a function that calculates recursively the factorial of a given number below 100. The function should return 0, in case the passed value exceeds 100. [10 marks] Question 2: [20 marks] 1) Explain the concepts: object, class and constructor, stating what they are useful for. [5 marks] 2) Write a PHP code that creates a class called “Book”. Objects of the class “Book” share the same publisher (e.g. Springer). They all have titles, authors’ names and publishing years. Implement a method within the class “Book” that prints out the above properties of a certain book, that is, its title, author’s name and the publishing year [10 marks] Example for the desired output: “This book has the title: Computational Complexity It was published by Springer in 2012. The author of the book is Robert Meyers. 3) A) Explain what “object inheritance” means and what it is useful for.

[5 marks]

B) Create a class that does nothing but inherits the properties of the class “Book”. Let the name of the class be “Field”. To show inheritance, create an object (e.g. aBook) of the class “Field”, passing the printing method in part 2) of Question 2 to that object.

Question 3 [20 Marks] 1) Explain what a database (in general) is, providing a definition of a relational database [5 marks]

2) Why does the design of the database matter? And how does normalization contribute to a good database design? [5 marks]


3) List three types of table relationships in relational databases with brief description of each type? [5 marks]

4) Using the eLibrary (available through the LMS), search for other forms than the three normal forms presented in class. Your answer should include names, brief descriptions of these forms and a brief comparison between these forms and the three rules discussed in the lecture. [5 marks]

Question 4 [40 marks] Using PHP and MySQL database engine develop a photo sharing system (Instigram-like) that implements the following basic functionalities: 1) Membership registration (7 marks) 2) Photo uploading (7 marks) 3) Photo comments (7 marks) 4) Admin area (to administrate the entire content management system) (12 marks) 5) Log-in log-out module (7 marks)


M275 tma firstsemester 2013 2014