CSC 443 Midterm, Fall 2008

Lebanese American University · Web Programming · 5 pages

All CSC 443 files
CSC 443 Midterm, Fall 2008, page 1

Stuck on a question? A tutor can walk you through it.

CSC 443 Midterm, Fall 2008, page 2 CSC 443 Midterm, Fall 2008, page 3 CSC 443 Midterm, Fall 2008, page 4 CSC 443 Midterm, Fall 2008, page 5

More CSC 443 files

Show the text of this exam
CSC 443– Web Programming Midterm Examination December 1, 2009, 4:30-5:45 p.m. Instructor: Haidar M. Harmanani Instructions: Check P each item below q This is a Closed Book exam. Write your name on the top of each page. You are allowed only half an A4 page with one side of notes only. q You have 115 minutes. Consider the points of each question and pace yourself accordingly. q Explain every possible result when asked. State any assumptions that maybe required for an answer if unclear or missing. q Grades will only be given for clear and concise answers. q Put your answers in the space provided only. No other spaces will be graded or even looked at. q This exam has 9 pages including this one. It has problems for a total of 110 points. q Follow the instructions as indicated. Failure to do so will result in loss of points. Good luck! Social Club Name: ID: Page 2 of 5 Part I: Multiple Choice Questions Grading: 2 points per question/-2 points for every two incorrect answers. 1. Which statement is false? (A) HTTP stands for Hypertext Transfer Protocol. (B) W3C is an standard organization for the World Wide Web. (C) The Web client and server are communicated through HTTP. (D) none of above 2. The default port for the HTTP server is: (A) 22 (B) 25 (C) 79 (D) 80 3. Which is a Web server? (A) IIS (B) Mozilla Firefox (C) lynx (D) none of above 4. What is the correct HTML for inserting an image? (A) <image src=”car.gif” alt = ”image of a car”> (B) <img alt = ”image of a car” >car.gif</img> (C) <img href=”car.gif alt = ”image of a car”> (D) <img src=”car.gif” alt = ”image of a car”> 5. Which CSS tag is designed for a phrase in a line to appear in a different font size or color? (A) <section> (B) <span> (C) <division> (D) <div> 6. What is the correct HTML for making a checkbox? (A) <checkbox> (B) <input type=”checkbox”> (C) <check> (D) <input type=”check”> 7. Which is not a way to specify a comment in PHP? (A) # a comment (B) // a comment (C) /* a comment */ (D) none of above 8. Which PHP function can be used to delete an element of an array? (A) delete (B) unset (C) undef (D) none of above 9. Which function can be used to specify a cookie in PHP? (A) setcookie (B) cookie (C) defcookie (D) none of above Social Club Name: ID: Page 3 of 5 10. In a relational database, a table has at least one column that uniquely identifies the rows of the table. The value in this special column is called: (A) unique key (B) unique key (C) primary key (D) special key 11. In PHP which statement is used to get the keys and values of an array? (A) while (B) foreach (C) for (D) none of the above 12. Which PHP function returns a file handle for reading and writing and new data is written to the end of the file. (A) $fp = fopen ("data", "a+") (B) $fp = fopen ("data", "r+") (C) $fp = fopen ("data", "rw") (D) none of the above 13. Which statement is true? (A) A cookie is stored in the server. (B) A cookie has no expiration time. (C) In PHP the getcookie function is used to get a cookie. (D) none of the above 14. Which is the SQL keyword used to specify the conditions on which rows are to be selected? (A) exits (B) where (C) from (D) condition 15. Which SQL command is used to remove rows from a table? (A) remove (B) erase (C) drop (D) delete 24. Which SQL command is used to change one or more of the values of a row? (A) change (B) modify (C) update (D) revise 25. Which SQL command removes a table from a database? (A) remove table (B) drop table (C) delete table (D) erase table Social Club Name: ID: Page 4 of 5 Part II: Quick Questions Grading: 50 points Instructions: Please answer the following questions in the indicated space only. 1. Consider the following partial tables in a database [25 Points]: Table 1: Artist Table 2: Album Artist ID Firstname Lastname Artist ID Title Released 1001 Avril Lavigne 1001 Eragon 2006 2002 Alanis Morissette 2002 The Collection 2005 3003 Sarah McLachlan 3003 Wintersong 2006 Use SQL to query the database and answer the following questions: (a) Create the Artist table [6 Points]. (b) Insert (’2002’, ’So Called Chaos’ ,’2004’) into the Album table [6.5 Points] (c) Get a list of the album title and the first and last name of the singers whose album is released in 2006 [6.5 points] (d) Delete all albums released by ”Natalie Imbruglia” [6 points] Social Club Name: ID: Page 5 of 5 2. HTML and PHP [25 Points] Write an HTML document that is used to collect the information about a movie. The HTML document has a form with three text input box to collect the title, the director’s name, and the released year of a movie respectively. The input data is sent to a PHP program that can be accessed at http://csc443.lau.edu.lb/php/querymovie.php [10 Points] Given the following tables: Movie database Movie Table Host name web Field Type Account name movie Title varchar(20) Password moviegogo Director varchar(25) Database name Movie Released Year integer Please complete the PHP code below and add the following functions [15]: • Collect the information of a movie from the three text input boxes specified in the above HTML document. • Insert the collected movie information into the Movie table of the Movie database in MySQL DBMS. • Display a list of the movies that have the same director as the movie that is just inserted into the database. Social Club