CMPSCI 120 Fall 2013 Midterm Exam #2 Solution Key Friday, November 8, 2013 Professor William T. Verts NAME: Question Points 1 20 2 20 3 20 4 20 5 20 TOTAL 100 Score
<1> 20 Points Quick Answers. Do any 10 for full credit (2 points each); do more for extra credit (1 point each over 10). rw----r-- r-xr-xr-x ug+w,o-w index.html index.html glop.gif public_html blank mkdir public_html No New #1DE2EB Cyan or Teal or Turquoise #2FD No favicon or <NOFRAMES> <INS>.PNG or.jpg What are the permissions on the file mine.html after the command chmod 604 mine.html (use rwxrwxrwx form)? If the permissions on mine.html are currently r--r-x---, what are the permissions after the command chmod a+x,go+r mine.html? What pattern do I use in the chmod mine.html command to add write permission to user and group, but deny it from others? What is the name of the actual resource file returned from http://elsrv3.cs.umass.edu/~verts/? What is the name of the actual resource file returned from http://elsrv3.cs.umass.edu/~verts/frog/? What is the name of the actual resource file returned from http://elsrv3.cs.umass.edu/~verts/frog/glop.gif? What UNIX folder is used to store xyz.html in the following URL? http://elsrv3.cs.umass.edu/~verts/xyz.html I log in to my UNIX account via PuTTY/ssh, and type the command emacs index.html Will the editor screen show the file or be blank? I log in to my UNIX account and want to create a folder called public_html. What command will I type? Do I need to create the public_html folder more than once? I change my UNIX password through PuTTY/ssh. When I log in to the same account with WinSCP/Fugu, do I use the old password or the new? I want to create a color where the red value is 29, the green value is 226, and the blue value is 235. What is the HTML code for this? Approximately what visible color is described by the color definition in the previous problem? What is the short hex version of the color #22FFDD? Is the color Cornsilk browser safe? Cornsilk is #FFF8DC What is the special name for the tiny graphic images that can appear in the title bar or tabs for a Web page? What do I type in to encode the Euro ( ) symbol into a Web page? What HTML tag is used to activate HTML code when frames are not supported by a browser? What HTML tag is recommended instead of the deprecated <U> tag? I have a.bmp of a photograph of a natural scene. What file format(s) should I convert it to in order to use it in my Web page? Page 1 of 5
<2> 20 Points What HTML code is written out by the following JavaScript fragment? (The fragment is located somewhere between <BODY> and </BODY>.) <SCRIPT TYPE="text/javascript"> <!-- document.writeln ("<TABLE BORDER>") N = 1 ; while (N <= 3) { document.writeln ("") ; document.writeln ("<TD>", N, "</TD>") ; document.writeln ("<TD>", N*N, "</TD>") ; document.writeln ("") ; N = N + 1 } document.writeln ("</TABLE>") --> </SCRIPT> <TABLE BORDER> <TD>1</TD> <TD>1</TD> <TD>2</TD> <TD>4</TD> <TD>3</TD> <TD>9</TD> </TABLE> <2½> 5 Points EXTRA CREDIT When the HTML from problem 2 is rendered on screen by the browser, what will it look like? Page 2 of 5
<3> 20 Points Design an HTML table to look like the diagram to the right. The News link is to www.cnn.com, and the Weather link is to www.weather.com. <TABLE BORDER> <TD COLSPAN="2"> <A HREF="http://www.cnn.com"> News </A> </TD> <TD ROWSPAN="2"> 2013</TD> <TD>Verts</TD> <TD> <A HREF="http://www.weather.com/"> Weather </A> </TD> </TABLE> Page 3 of 5
<4> 20 Points The following image shows a 400 200 pixel graphic containing four objects: a circle, a rectangle, and two polygons. Complete the HTML code below to turn the image, called My Map.png, into a client-side image map, where the circle and rectangle both link to www.frog.edu, the triangle links to www.toad.edu, the 4-point polygon links to www.newt.com, and the background of the image links to www.bat.com. In the image the gray grid (normally not shown) is at a 10-pixel spacing, and all coordinates are shown. All points of interest are on 10-pixel boundaries (i.e., a point might be at coordinates <30,20>, but not at <32,18>, for example). <IMG SRC="My%20Map.png" USEMAP="#WhateverMyMapNameIs"> <MAP NAME="WhateverMyMapNameIs"> </MAP> <AREA SHAPE="rect" COORDS="10,10,240,80" HREF="http://www.frog.edu/"> <AREA SHAPE="circle" COORDS="100,100,40" HREF="http://www.frog.edu/"> <AREA SHAPE="poly" COORDS="180,100,130,180,230,180,180,100" HREF="http://www.toad.edu/"> <AREA SHAPE="poly" COORDS="200,100,250,180,310,180,360,100,200,100" HREF="http://www.newt.com/"> <AREA SHAPE="default" HREF="http://www.bat.com/"> Page 4 of 5
<5> 20 Points Fill in the Web page code below as follows: 1. In the <STYLE> </STYLE> block, define all H1 headings to be colored PowderBlue and centered, and all HR tags to be 75% of the current browser width. 2. In the <SCRIPT> </SCRIPT> block, write the JavaScript code to compute the square root of 2 and write out the answer inside its own H1 heading. 3. In the Links section, write the HTML code for a hypertext link to www.cs.umass.edu with the clickable link an image called Computer.png. 4. In the last H1 heading, override the color style to make this one tag green instead of the default value, and fill in the blank with the code for the copyright symbol. <HTML> <HEAD> <TITLE>My Web Page</TITLE> <STYLE TYPE="text/stylesheet"> </STYLE> </HEAD> H1 {color:powderblue ; text-align:center} HR {width:75%} <BODY> <H1>Welcome!</H1> <SCRIPT TYPE="text/javascript"> <!-- May be document.writeln ("<H1>") ; combined into document.writeln (Math.sqrt(2)) ; one statement document.writeln ("</H1>") ; --> </SCRIPT> <H1>Links</H1> <A HREF="http://www.cs.umass.edu/"> <IMG SRC="Computer.png"> </A> <H1 STYLE="color:green" >Copyright 2013</H1> </BODY> or </HTML> Page 5 of 5