CSIS-401: Web Design Final Exam Name: _______________________ Multiple Choices: Put you answer in the space provided on the right column. 1. Following HTML and CSS standards helps make your web pages a. display faster b. less accessible c. forward compatible d. only a and c are true, b is not true e. a, b, and c are all true Answer ____ 2. Which is an example of purely presentational HTML markup a. <p> paragraph content </p> b. <b> bold text </b> c. <div id=“pagetitle”>My Website</div> d. <img class= “playerphoto” src= “Jordan.jpg” title=”Michael Jordan” /> Answer ____ 3. Which example is the most semantic e. <p> paragraph content </p> f. <b> bold text </b> g. <div id=“pagetitle”>My Website</div> h. <img class= “playerphoto” src= “Jordan.jpg” title=”Michael Jordan” /> Answer ____ 4. CSS a. is a markup language b. stands for Core Style Sheet c. defines the presentational layer of a web page d. none of the above are true Answer ____ 5. What is NOT part of the client tier? a. HTML code b. cookies c. session variables d. JavaScript e. DOM Answer ____ 6. JavaScript a. is a language used to define the structural layer of a web page b. is used in the database tier c. is typically used to communicate with the web server d. is used to manipulate the browser Answer ____ 7. If you want to insert content/data from an external source into a web page, which language will NOT help? a. CSS b. SQL c. JavaScript d. PHP Answer ____ 1/10 8. Which of the following is most likely to happen if your page uses HTML instead of XHTML? a. The page will NOT load in most web browsers b. The page may not be compatible with come XML-based systems. c. Both a and b are correct Answer ____ 9. Which of the following is a full-featured programming language? a. CSS b. PHP c. HTML d. SQL e. All of the above are full-featured programming languages Answer ____ 10. In this CSS code, what is being set? body { color: #990000; } a. Text Color of only paragraphs b. Background Color of the entire web page c. Text Color of the entire web page d. Background Color of the body element Answer ____ 11. Which of the following must be true in order to use PHP code in a web page? a. The web server must have PHP processor b. The code must be inside the <head> tag c. The code must be inside a <script> tag d. All of the above Answer ____ 12. What PHP variable is used to access URL variables? a. $_FORM b. $_FILES c. $_GET d. $_POST Answer ____ 13. What PHP function is used to start a user session? a. session_start() b. session_init() c. session() d. $_SESSION Answer ____ 14. What has higher priority? a. Styles define in a linked style sheet b. Embedded styles c. Inline styles Answer ____ 15. Which of the following is NOT a built-in associative array used by PHP? a. $_URL b. $_FILES c. $_GET d. $_POST Answer ____ 15.5. What do ninja’s and princesses have in common? Think about it…really thing about it…. _________________________________________________________________________________________ 2/10 16. Consider the following regular expression and select the most correct answer: Answer ____ ^[a-zA-Z][a-z0-9]+$ a. b. c. d. The pattern must start with a capital letter The pattern must contain exactly two characters The pattern must contain at least one letter The pattern must contain at least one numeric digit 17. Consider the following regular expression and select the most correct answer: Answer ____ ^[a-z0-9]+@[a-z0-9]+.com$ a. b. c. d. The pattern must end with .com The pattern can only contain one dot The pattern can NOT have any capital letters All of the above are true 18. You can make a web page more accessible by a. putting it on the a web server b. using standard HTML and CSS c. providing alternative style sheet for printers and screen readers d. using a big font e. a, b, and c are all correct; d is not really true f. a, b, c, and d are all correct Answer ____ 19. Select the most correct statement a. Radio buttons are used when multiple options can be selected b. Check boxes are used when multiple options can be selected c. Radio buttons can be used to submit a form. d. Check boxes can be used to submit a user text entry Answer ____ 20. Using a single linked style sheet for an entire web site is Answer ____ a. bad because the style sheet can be big and take a long time to download b. bad because the style sheet gets downloaded repeatedly every time a page is requested c. good because you can control the site’s appearance in one central place d. good because it hides all your styles and people can’t steal your website code 21. What is the current standard for the structural layer of web pages? a. XHTML 1.0 b. CSS 2.0 c. PHP 4 d. all of the above Answer ____ 22. Which of the following does NOT reside on the server side? a. Apache software b. Session variables c. PHP files d. Web browser software Answer ____ 3/10 22. When is a cookie saved on a user’s web browser? a. Only when a user submits a form. b. Whenever a user requests a web page. c. If a web page is loaded that includes JavaScript code that sets the cookie d. If PHP is used to send back an http response header that sets the cookie e. a, b, c, and d are all true. f. Only c and d are true. Answer ____ 23. Cookies and session variables can be used to. a. Prevent browser actions from happening more than once b. Logout users after a period time c. Keep track of user activity d. All of the above Answer ____ 24. Which of the following is not a scripting language used by web servers to connect to databases and dynamically generate web pages. a. PHP b. XML c. ASP d. ColdFusion Answer ____ 25. Consider the following PHP code: $var = “3” . “5”; $var will most likely be: a. Integer 8 b. Integer 15 c. String “35” d. Integer (ascii value of character 3 times ascii value of character 5) Answer ____ 26. Which HTML tag is the most semantic a. <i> b. <b> c. <p> Answer ____ 27. Which CSS attribute is used to center text? a. font-align b. text-align c. align d. center Answer ____ 28. Which CSS attribute is used to change the font size? a. font-size b. text-size c. size d. font-family Answer ____ 29. Which CSS attribute is used to make text italic? a. text-decoration b. text-style c. italic d. font-style Answer ____ 4/10 30. In a 3-tier web architecture, which tier is responsible for rendering a web page? a. server b. client c. database Answer ____ 31. By default, the <p> tag is a. inline b. block c. float left d. centered Answer ____ 32. Which of the following is a mark-up language? a. CSS b. PHP c. HTML d. SQL e. all of the above are markup languages Answer ____ 33. Which of the following is a query language? a. CSS b. PHP c. JavaScript d. HTML e. SQL f. XML Answer ____ 34. Why was ColdFusion so important? a. It was the first server-side scripting language to support database connectivity b. It was the first web server software c. It was the first open source web development language d. It was the first client-side scripting language that could manipulate the browser Answer ____ 35. Why is PHP so widely used a. It is supported commercially by Microsoft and Oracle b. It is free, open source, and constantly expanded and updated c. It is built into the Firefox web browser d. It is endorsed by Princess Cinderella Answer ____ 36. In a standards-compliant web page, what is the outer-most structural tag? a. <head> b. <body> c. <html> d. <script> Answer ____ 37. What language is commonly used to manipulate the behavioral layer of a web page? a. JavaScript b. SQL c. XML d. CSS Answer ____ 5/10 For questions 38-41, consider the following code: $fname = $_POST[“firstname”]; run_query("SELECT lastname WHERE First='$fname"); 38. What is $_POST? a. An associative array b. A PHP variable c. A data structure containing all the form variables d. All of the above Answer ____ 39. Which of the following is a PHP variable? a. run_query b. firstname c. fname d. First Answer ____ 40. Which of the following is a PHP function name? a. run_query b. firstname c. fname d. First e. SELECT Answer ____ 41. What is "SELECT lastname WHERE First='$fname"? a. a string passed into a function b. a string representing an SQL query c. a regular expression d. a and b are both true, c is not e. a, b, and c are all true Answer ____ 42. Answer ____ A web browser will automatically send the cookies set by a server back to the server for all http requests to the server. Why? a. b. c. d. Otherwise, the server could never see if it set a cookie on the browser Otherwise, the server would have to send a separate request when it needed to check a cookie value The browser initiates all contact with the server, the server can not send a request to the browser All of the above are true 43. Which of the following is not a PHP function used to interface with MySQL? a. mysql_post b. mysql_select_db c. mysql_connect d. mysql_query e. mysql_dance_with_princess Answer ____ 43.5. What is Dr. Breimer’s favorite Disney Princess and why? It’s OK, you can say, I won’t be offended. __________________________________________________________________________________________ 6/10 For questions 44-49, consider the following PHP code: <table border="0" cellpadding="5" cellspacing="1" bgcolor=“black"> <?php $results = run_query("SELECT * FROM princesses"); while ($row = mysql_fetch_array($results)) { echo '<tr>'; for ($x = 0; $x < 7; $x++) echo '<td bgcolor="white">', $row[$x], '</td>'; echo '</tr>'; } ?> </table> 44. Will this PHP code generate a standards-compliant web page? a. No, because it doesn’t print proper HTML and DOCTYPE headers b. No, because you can NOT mix HTML and PHP code together c. Yes, because it generates HTML code d. Yes, because the output is nested in a table. 45. What does this PHP code do exactly? a. It tries to fit a glass slipper on all the princesses at the table b. It prints the first 7 rows of the princesses table c. It prints the first 8 rows of the princesses table d. It prints the first 7 columns of all the rows of the princesses table e. It prints the first 8 columns of all the rows of the princesses table 46. In the code above, what does $results store? a. It stores the output of the run_query function b. It stores the SQL query c. It stores one row of data d. It stores one column of data e. It stores a delicious cheese sandwich 47. What does the while loop do? a. For each loop, it generates a table row b. It loops until the mysql_fetch_array function returns null (fals) c. It loops for each row that is fetched d. It does all of the things: a, b, and c 48. What does the for loop do? a. For each loop, it generates table data (a column) b. It sets the background color of the table c. It loops for each row that is fetched d. It does all of the things: a, b, and c 49. What might prevent the code above from printing all the data in the princesses table? a. The while loop may not fetch all the rows b. If there are 9 or more fields, the for loop will only print the first 8 fields c. The SQL query does not select all the fields d. The actual data is never printed; only the table structure is printed 7/10 True or False: Circle the correct answer (True of False) in the right column 50. HTML has tags and functions to connect to database servers. True or False (circle one) 51. JavaScript is typically used to access a web page’s DOM. True or False (circle one) 52. In PHP, $myvar and $myVar are the same variable True or False (circle one) 53. Relative URLs always start with http:// True or False (circle one) 54. In a 3-tier web architecture the web server and the database server can be installed on the same computer. True or False (circle one) 55. SQL stands for Structured Query Language True or False (circle one) 56. Microsoft and Netscape were the two parties in the browser wars? True or False (circle one) 57. The Internic is the name of the organization that makes recommendations about the standards for HTML and CSS True or False (circle one) 58. 640 X 480 is still the most popular screen resolution True or False (circle one) 59. PHP is used to define the structure of web pages True or False (circle one) 60. CSS is used to define the presentational layer of a web page True or False (circle one) 61. Apache is a scripting language similar to PHP True or False (circle one) 62. ASP is Microsoft’s commercial web server software True or False (circle one) 63. URL stands for Uniform Resource Language True or False (circle one) 64. The a in the <a> tag stands for anchor True or False (circle one) 65. The <script> is used to insert PHP code into a web page True or False (circle one) 66. The <head> tag includes the web page title True or False (circle one) 67. The <link> tag can be used to define a hypertext link True or False (circle one) 68. ASP and JSP are different server-side scripting languages True or False (circle one) 69. PHP stands for Princess-based Hypertext Preprocessor True or False (circle one) 70. MySQL is an open source database server True or False (circle one) 71. Oracle is a commercial alternative to MySQL True or False (circle one) 72. Storing data in a database (instead of files) help increase data dependence and increase data redundancy True or False (circle one) 8/10 Short Answer: Place very brief and specific answer in the spaces provided 73. What database server did we use in this course? _________________ 74. What HTML tag/element is used to insert an image? _________________ 75. What HTML tag/element is used to insert drop-down menu into a form? _________________ For questions 76-79, consider the following URL: http://www.abc-com.cn/html/home/etc/upload.php?extension=gif 76. What is the top level domain? _________________ 77. This URL points to what type of file? _________________ 78. How many folders are in the file path? _________________ 79. What is the name of the URL variable (the variable name, not its value)? _________________ For questions 80-82, consider the following CSS code: em { color: red; } strong { color: blue; } h1 {color: green; } strong em {color: yellow; } h1 em strong {color: purple; } 80. What color will the text be? <em><strong>text<strong></em> _________________ 81. What color will the text be? <strong><em>text</em></strong> _________________ 82. What color will the text be? <h1><em>text</em></h1> _________________ For question 83-85, consider the following CSS code: #myblockdiv { margin: 15px 20px 30px 45px; padding: 5px 10px 15px 20px; width: 700px; } 83. What is the top margin? _________________ 84. What is the left padding? _________________ 85. How much total width will myblockdiv actually take up? _________________ 86. Describe what is wrong with this CSS code: <b> { color: black; } _________________________________________________________________________________ 9/10 For questions 87-89, consider the following HTML form: <form method="post" action="addcomment.php"> Subject: <input name="subject" type="text" size="40" class="mytextbox"> <br /> Name: <input name="username" class="mytextbox" type="text" size="40"> <br /> Comment: <br /> <textarea name="comment" cols="60" rows="8"></textarea> <br /> <input type="submit" value="Submit"> </form> 87. How many form variables are defined in the form above? _________ 88. How many form elements are defined in the form above? _________ 89. Assuming this form was loaded in a web browser, what exactly happens when the user clicks the submit button, i.e., submits this form? 90. Write the PHP code to print the form variables in the form above. 91. Write the CSS code to add a pink background color to a class selector called “princess” ______________________________________________________________________________ 92. Write the HTML code to make the word Siena an absolute hyperlink to www.siena.edu ______________________________________________________________________________ 93. While it might be more difficult to design a website with a database back-end, it might be a lot easier to maintain a database-driven website. Why? Explain at least two reasons why database-driven websites are easier to maintain. (1) ________________________________________________________________________________ (2) ________________________________________________________________________________ 94. Describe three of the four main advantages of standardization in the web design world. (1) ________________________________________________________________________________ (2) ________________________________________________________________________________ (3) ________________________________________________________________________________ 95. What did Frosty the Snowman first say when he came to life? ____________________________________ 10/10