Student, Perfect Midterm Exam March 24, 2006 Exam ID: 3193 CS-081/Vickery Page 1 of 5 NOTE: It is my policy to give a failing grade in the course to any student who either gives or receives aid on any exam or quiz. INSTRUCTIONS: For each question, circle the answer of the one best choice. All questions count equally. 1. What is a DTD, and why is it important? A. It stands for Day-Time-Direction, and is used to tell the server what time zone and type of language the browser uses. B. It stands for Dom Tree Development, and it is used to tell Javascript what window to pop up, depending on the time zone and whether the browser is Internet Explorer or not. C. It stands for Dom Tree Dither, and tells the browser whether to use Internet Explorer or Apache. D. It stands for Document Type Definition, and it is the part of the DOCTYPE that tells the browser what version of HTML or XHTML was used to write the web page. E. It stands for Dreamweaver Topic Descriptor, and it is used to tell Apache what the username and password are. 2. What is wrong with this fragment of an XHTML web page: <H1>CS-081 Rocks!</H1> A. You cannot put an exclamation point inside a heading. B. The closing tag should be <H1/>. C. There should be no closing tag. D. XHTML tag names have to be lower case. E. The font attribute is missing. 3. How can you tell whether Firefox is interpreting a page in standards compliant mode or quirks mode? A. Select Page Info from the Tools menu. B. Double-click the Tidy icon at the top of the page. C. Double-click the Firebug icon on the Help menu. D. Use Tools Options to turn standards compliant mode on or off. E. View the page using Opera or Internet Explorer. 4. Trick question: What does Firefox do with the information from <?php to?>. A. This is a trick question because the PHP, running on the server, processes that information and Firefox never sees it. B. This is a trick question because <?php and?> are handled by JavaScript, not Firefox. C. This is a trick question because <?php and?> are interpreted as alert() functions by Firefox. D. This is a trick question because <?php and?> are converted into Firebug commands by Internet Explorer. E. This is not a trick question at all: Firefox converts that information into PHP source code and sends it to the server. 5. Pretend a, b, and c are valid tag names in XHTML, and describe this piece of code: <a><b></b><c></c></a> A. a and b are siblings in the DOM tree. B. b and c are siblings in the DOM tree. C. a and c are siblings in the DOM tree. D. a and b and c are all siblings in the DOM tree. E. c is a parent of a in the DOM tree.
Exam ID: 3193 CS-081/Vickery Page 2 of 5 6. How could this piece of XHTML code be made valid? <td> <tr>there were some mistakes</tr> <tr>the first one</tr> <tr>the second one</tr> <tr>the third one</tr> </td> A. Nothing, it is already valid. B. There should be only three <tr> tags, not four. C. Change all the <tr> and </tr> tags to <td> and </td> tags, and change the current <td> and </td> to <tr> and </tr>. D. The <tr> and </tr> tags should be <li> and </li>. E. The <tr> and </tr> tags should be <ol> and </ol>. 7. Which sentence correctly describes this piece of code: <img src= images/peaches.jpg alt= Peaches Picture /> A. The value of this img attribute is images/peaches.jpg B. The value of this img tag is Peaches Picture. C. This img attribute has a src and an alt tag. D. This img tag has two attributes, named src and alt. E. These peaches are indescribeably delicious. 8. What is wrong with the following code: <html> <body> <h1>this Is a Tale Of Woe</h1> </body> <head> <title>once upon a time there was a Woe.</title> </head> </html> A. The title is too long. B. The first and last tags should be <xhtml> and </xhtml>. C. The <title> and </title> tags should be capitalized. D. The h1 element should be in the head, not the body. E. The body should come after the head, not before it. For questions 9 through 11, assume a Windows computer named transparentrocks.com is running a web server with the document root at C:\Apache\htdocs. (Note that this is different from the lab setup.) And assume there is a web page at C:\Apache\htdocs\MySite\index.php on that computer. 9. Which URL could be used to access the web page? A. C:\Apache\htdocs\MySite\index.php B. \htdocs\mysite\index.php C. http:\\transparentrocks.com\mysite\index.php D. http://transparentrocks.com/index.php E. http://transparentrocks.com/mysite 10. Assume index.php contains: <img src= images/peaches.jpg alt= peaches /> What is the actual path to the picture on the Windows computer? A. Document_Root/images/peaches.jpg B. C:\images\peaches.jpg C. C:\MySite\peaches.jpg D. C:\Apache\htdocs\MySite\images\peaches.jpg E. C:\Apache\htdocs\MySite\peaches.jpg
Exam ID: 3193 CS-081/Vickery Page 3 of 5 11. If the picture was at C:\Apache\htdocs\images\peaches.jpg, what would the img tag need to look like in order to reference it? A. <img src= images/peaches.jpg alt= C:\Apache\htdocs /> B. <img src=../images/peaches.jpg alt= peaches /> C. <img alt= peaches src= peaches.jpg /> D. <img alt= C:/Apache/htdocs/images src= peaches.jpg /> E. <img src=.\images\peaches.jpg alt= Pretty Peaches Picture /> 12. What happens if you do not use an alt attribute in an img tag in an XHTML document? A. The picture will not be displayed. B. The picture will be distorted. C. The page will not validate. D. The browser will print an error message. E. Nothing, because the alt attribute is optional. 13. What happens if you do not use a tfoot element inside a table? A. Nothing, because tfoot is an optional part of tables. B. The last row in the table will not be displayed. C. The thead section will appear at the bottom of the table instead of at the top. D. The page will not validate. E. The cells in the footer will be all merged into one. 14. How could you create the Merged Cells part of this table: A B C D Merged Cells G H I A. <td colspan= 2 >Merged Cells</td> B. <td rowspan= 2 >Merged Cells</td> C. <tr colspan= 2 >Merged Cells</tr> D. <tr scope= 2 >Merged Cells</tr> E. <tcell rows= 2-3 >Merged Cells</tcell> 15. Why does tfoot come before tbody in a table? A. Because you have to use the tags in alphabetical order. B. Because tables are constructed from the ground up. C. Because you can t have table legs without feet. D. To help screen readers speak the contents of the table in an efficient order. E. To make room for the tbody. 16. How do you add a caption to a table? A. Put the table inside an <h2> tag. B. Use the caption attribute of the <table> tag. C. Put a <caption> tag after the <table> tag. D. Put a <caption> tag inside the </table> tag. E. Use the alt attribute of the <table> tag. 17. What does the Javascript expression document.getelementsbytagname( a ) do? A. It displays a popup window. B. It displays a message box. C. It adds a paragraph to a document. D. It adds a link to a document. E. It gets a list of all the <a> tags in a web page.
Exam ID: 3193 CS-081/Vickery Page 4 of 5 18. What does the Javascript expression window.open( peaches.jpg, Peaches ) do? A. It displays a popup window with a picture in it. B. It displays a popup window with the word Peaches in it. C. It puts a picture in the window containing the script. D. It tells the server to look in the Peaches directory for a picture. E. It creates a link the user can click on in order to see a picture. 19. Can you be sure that the Javascript expression in the previous question will actually work? A. No, the user might have Javascript disabled. B. No, the user might have Popups blocked. C. No, the user s browser might not support Javascript. D. All of the above E. Yes, it always works. 20. How to you connect a web page to a style sheet? A. Use an <a> tag in the <head> of the page. B. Use a <link> tag in the <body> of the page. C. Use a <link> tag in the <head> of the page. D. Use a <a> tag in the <body> of the page. E. Use a <script> tag in the <html> of the page. 21. Which CSS selector can be used to apply a rule to all elements with the class name important? A. h1 B. important C.!important D. #important E..important 22. Which CSS selector can be used to apply a rule to the single element with the id of key? A. key id B..key C. #key D.!key E. key 23. What does the CSS selector ul li apply to? A. All <li> elements that are inside a <ul> element. B. All <li> and all <ul> elements. C. All <ul> elements that have <li> elements inside them. D. All <ul> elements with a class name of li. E. All underlined links. 24. What does the CSS selector ul, li apply to? A. All <li> elements that are inside a <ul> element. B. All <li> and all <ul> elements. C. All <ul> elements that have <li> elements inside them. D. All <ul> elements with a class name of li. E. All underlined links. 25. Which of the following is pure red? A. #f0f0f0 B. rgb(10, 20, 30) C. #ffff00 D. #abc E. #f00
Exam ID: 3193 CS-081/Vickery Page 5 of 5 26. What is wrong with this rule? h1 {background-color: white; color: #fff; } A. The text will be invisible because the colors are the same. B. You can t mix color names and hexadecimal representation in the same rule. C. The name of the second property should be foreground-color rather than color. D. There should be a # before the h1 E. The h1 should be <h1>. 27. What does background-attachment: fixed; do? A. It makes the background image remain stationary even if the contents scroll. B. It makes the background of the element scroll along with the contents. C. It prevents the background of the element from blocking the foreground. D. It fixes an error in Internet Explorer. E. It sings an Opera. 28. Background images can only be applied to an entire web page, not to individual elements like headings or paragraphs. A. True B. False 29. Once a web page has been displayed, its appearance cannot be changed unless it is reloaded from the server. Circle all correct answers for this one. A. False because PHP can be used to change the appearance after the page has been displayed. B. False because Javascript can be used to change the appearance after the page has been displayed. C. False because the user might change the text size after the page has been displayed. D. False because the user might change the browser window size after the page has been displayed. E. False because the user might change the color settings on the monitor after the page has been displayed. 30. What is the decimal equivalent of hexadecimal 12? A. 10 B. 12 C. 14 D. 16 E. 18 31. What does the Javascript statement x = 3; do? A. It changes the value of a variable named x to the value 3. B. It passes the value 3 to a function named x. C. It tests whether x is equal to 3 or not. D. It tells Firebug that x and 3 are interchangeable. E. It causes the web page to have three lines more than it did before. 32. What can the <object> tag be used for? A. To change a Javascript object into a variable. B. To change a Javascript object into a function. C. To call a Javascript function when an event occurs. D. To simulate tabbed browsing. E. To includes a Flash movie in a page.