290W Exam 1 Solutions
Spring '99


 
HTML
====

(1) You have two directories (folders) named "past" and "present" that are sub-directories of your "www" folder. In the "past" folder is a file named register.html. How do you in that file make a hyperlink to the file firstalert.html in the "present" folder? (a) <A HREF="firstalert.html"> (b) <A HREF="../firstalert.html"> (c) <A HREF="present/firstalert.html"> (d) <A HREF="../present/firstalert.html"> (d)

(2) In the file register.html in the last question, you have an anchor <A NAME="ancestor">. How do you make a hyperlink to that anchor in that same file? (a) <A HREF="ancestor"> (b) <A NAME="#ancestor"> (c) <A HREF="#ancestor"> (d) <A HREF="ancestor.html"> (c)

(3) <OL TYPE=a START=2> <LI> oranges <LI> peaches <LI> apples <LI VALUE=3> grapes <LI> raisins </OL> What will precede "raisins" in the ordered list? (a) the number "4" (b) the letter "d" (c) the letter "e" (d) the letter "h" (b)

(4) Which of the following containers ignores all embedded HTML tags? (a) <PRE>...</PRE> (b) <CODE>...</CODE> (c) <XMP>...</XMP> (d) <DL>...</DL> (c)

(5) "<IMG SRC="slowpapa.jpg" LOWSRC="fastpapa.gif" ...>" Which image appears on screen first? (a) whichever is the smaller file (b) slowpapa.jpg because it is the SRC image (c) fastpapa.gif because it is the LOWSRC image (d) fastpapa.gif because it is a .gif image (c)

(6) You have <IMG ALIGN=MIDDLE SRC=...> followed by a paragraph (about 10 lines) of text. What happens? (a) The first line of the paragraph is aligned with the middle of the image. The second line and all others of the paragraph are under the image. (b) The first line of the paragraph is aligned with the middle of the image. The remainder of the paragraph continues down and around the image. (c) The first word of the paragraph is aligned with the middle of the image. The second word and all others of the paragraph are under the image. (d) The image is aligned so that it appears at about the middle of the paragraph which flows around it. (a)

(7) You want to have an image to the left and an image to the right with text flowing between them (like the stars on the CS 290W Website). How do you do this? (a) Make one image ALIGN=LEFT and the other ALIGN=RIGHT. (b) Make one image ALIGN=LEFT and the other has no alignment tag. (c) Make both images ALIGN=CLEAR. (d) Make one image BORDER=LEFT and the other BORDER=RIGHT. (a)

(8) What happens if you use both BGCOLOR and BACKGROUND attributes with the BODY tag? (a) The BGCOLOR is totally ignored. (b) The BACKGROUND is totally ignored. (c) The BGCOLOR is displayed first, replaced by the BACKGROUND when it arrives. (d) The BACKGROUND is displayed for 30 seconds, then replaced by the BGCOLOR. (c)

(9) Which best describes a TABLE CAPTION? (a) The lines of the caption will be no wider than the width of the table. (b) The default is ALIGN=BOTTOM. (c) The caption is always displayed at the top of the table. (d) The <CAPTION>...</CAPTION> must appear just before the <TABLE> tag. (a)

(10) Which TABLE attribute controls whether text inside a table cell is aligned to the TOP, MIDDLE, or BOTTOM of the cell? (a) ALIGN (b) CELLPADDING (c) VALIGN (d) VSPACE (c)

(11) What does <META HTTP-EQUIV="Refresh" CONTENT=10> mean? (a) Load the page named "Refresh" in 10 seconds. (b) Reload the last 10 pages in cache. (c) Reload this page every 10 seconds. (d) Reload this page in 10 seconds. (d) (12) In <FRAMESET COLS="200,*"> what does the * mean? (a) 200 (b) 800 (c) the entire framed area (d) the remainder of the framed area (d) (13) How can you make a Website in which the frames have no borders? (a) Use <NOFRAMES> tag. (b) Put BORDER=0 in outermost <FRAMESET> tag. (c) Put BORDER=0 in every <FRAME> tag. (d) Put SCROLLING=NO in every <FRAME> tag. (b) (14) Which <FORM> input type specifies a set of RELATED buttons? (a) TYPE=CHECKBOX (b) TYPE=RADIO (c) TYPE=RELATED (d) SELECT (b) (15) What does the VALUE attribute do when used with TYPE=SUBMIT? (a) Specifies the text on the submit button. (b) Specifies the value that will be sent to the cgi program when the submit button is clicked. (c) Specifies the text initially displayed in each text field. (d) Trick Question: VALUE cannot be used with TYPE=SUBMIT. (a) (16) Which of the following <FORM> features makes a "drop down menu" (that is, shows one possible value, but drops down a menu of all possible vales when clicked)? (a) <SELECT SIZE=1 ...> (b) <SELECT SIZE=3 ...> (c) <SELECT SIZE=DROP ...> (d) <OPTION SELECTED> (a) (17) <FORM METHOD=POST ENCTYPE="text/plain" ACTION="mailto:lizdole@purdue.edu"> What does the ENCTYPE attribute above do? (a) Sends an email message that is easily readable without a lot of special characters. (b) Sends an email message that can only contain lower case letters -- that is no upper case letters will appear. (c) Specifies that this information is to be emailed instead of given to a cgi program. (d) Trick Question: ENCTYPE is not an attribute! It should be a separate HTML tag somewhere inside the <FORM>...</FORM> container. (a) (18) Under what condition does a FORM not need a submit button to submit information to a cgi program? Assume that there is no TYPE=IMAGE field anywhere in the form. (a) The form has no TYPE=RESET button. (b) The form has no TYPE=TEXT fields. (c) The form has one SELECT tag with SIZE=1. (d) The form has only one TYPE=TEXT field. (d) Programming Language Principles =============================== (19) Which operating system is used when you telnet to mentor.cc.purdue.edu? (a) Windows 95 (b) Pico (c) Telnet (d) Unix (d) (20) Which of the following executes each statement in a programming language at "run time"? (a) interpreter (b) compiler (c) source code (d) input/output (a) (21) In most programming languages how would x + y * z - c / e be evaluated? (a) x + (y * (z - c)) / e (b) x + (y * z) - (c / e) (c) (x + y) * (z - (c / e)) (d) (x + y) * (z - c) / e (b) (22) Which of the following is equivalent to ...? count++; (a) count = count + 1; (b) count = 1; (c) count = ++; (d) count = count; (a) (23) Which Boolean operator is normally used to test if two values are the same? (a) == (b) sameas (c) ++ (d) || (a) (24) What is the difference between an if and an if...else statement? (a) The if specifies a block of statements to execute if the expression is false. (b) The if...else specifies a block of statements to execute if the expression is false. (c) The if...else specifies three or more blocks of statements to be executed. (d) No difference. (b) (25) What statement is like an if statement with multiple branches? (a) mult (b) while (c) select (d) switch (d) (26) The standard for loop looks like this for (A; B; C) {...} What are A, B, and C respectively? (a) expression, initialization, increment (b) expression, increment, initialization (c) initialization, expression, increment (d) initialization, increment, expression (c) (27) How many times is the initialization statement in a for loop executed? (a) never (b) just once (c) every time before going through the block of loop statements again (d) every time except the last pass through the block of loop statements (b) (28) What does a "break" statement inside a loop do? (a) causes the loop never to be entered (b) immediately terminates the loop (c) skips this iteration of the loop, but the loop can continue if the expression is still true (d) skips a group of statements (but not all of them) in the loop statement block (b) (29) Which of the following is a good reason to use a function? (a) Enhance program readability (b) Save precious microseconds at run time (c) Make the program larger (d) Encourage duplicate statements in various places in the program (a) (30) How is a character string usually represented in a programming language? (a) as a single character (b) as an array of characters (c) as a function (d) Trick Question: Character strings cannot be represented in a programming language! (b) JavaScript ========== (31) In JavaScript how do you declare the variable gamma in which you plan to store only integer values? (a) gamma; (b) int gamma; (c) val gamma; (d) var gamma; (d) (32) Which tag introduces some JavaScript statements? (a) <JAVASCRIPT> (b) <SCRIPT LANGUAGE="JavaScript"> (c) <JAVA> (d) <SCRIPT LANGUAGE="Java"> (b) (33) <INPUT TYPE=TEXT SIZE=6 NAME=code VALUE=999> appears in a FORM. What JavaScript statement will change this field to 127? (a) form.code = 127; (b) form.code.value = 127; (c) value=127; (d) code=127; (b) (34) <INPUT NAME=calc VALUE=Calculate TYPE=BUTTON __________ = computeProduct(this.form)> What goes in the blank above to run the JavaScript function computeProduct whenever this button is clicked? (a) HREF (b) onPress (c) onClick (d) run (c) (35) form.answer.value = form.one.value + form.two.value; Suppose that the user supplies the value 35 to field one and 24 to field two. What will be in field answer? (a) 59 (b) 3524 (c) 0 (d) NaN (b) (36) What will appear in the HTML file if the... function heading (level, text) { document.write("<H", level, ">", text, "</H", ">") } ... is called by heading (3, "Concerts")? (a) <H>3 Concerts</H> (b) <H3>Concerts</H3> (c) <H3>Concerts</H> (d) <H3 Concerts>text</H3> (c) (37) If you use... confirm ("Would you like to order the tickets now?") ...what will be returned if the user clicks "OK"? (a) OK (b) "Would you like to order the tickets now?" (c) "Yes" (d) true (d) (38) If you use... prompt ("What concert tickets shall I check?", "Goo Goo Dolls") ...what will be displayed on screen? (a) A prompt box with label "What concert tickets shall I check?" and text field that is empty, but may be changed (b) A prompt box with text field that contains "What concert tickets shall I check?" (which may be changed) and label "Goo Goo Dolls" (c) A prompt box with label "What concert tickets shall I check? Goo Goo Dolls" (d) A prompt box with label "What concert tickets shall I check?" and text field that contains "Goo Goo Dolls" (which may be changed) (d) (39) If the user of the prompt box above types "Wallflowers" into the text field, what string will the prompt return to the JavaScript function? (a) "Wallflowers" (b) "Goo Goo Dolls" (c) "What concert tickets shall I check?" (d) true (a) (40) Which of the following will in 30 seconds change the Web page in the current window to butterflies.html and do nothing else? (a) location = ("butterflies.html", 30000); (b) window.open("butterflies.html", 30000); (c) setTimeout('location = "butterflies.html"', 30000); (d) setInterval('location = "butterflies.html"', 30000); (c) (41) <SELECT NAME=which SIZE=1> <OPTION>Rubies <OPTION>Diamonds <OPTION SELECTED>Pearls <OPTION>Opals </SELECT> Which of the following correctly tests to see if Diamonds is the choice selected? (a) if (form.which=="Diamonds") (b) if (form.which.selectedIndex.2==SELECTED) (c) if (form.which.selectedIndex==1) (b) if (form.which.selectedIndex==2) (c) (42) Which document object property CANNOT be changed dynamically? (a) lastModified (b) bgColor (c) fgColor (d) vlinkColor (a) (43) What event handler can be used when someone begins to type in a text field? (a) onType (b) onBlur (c) onChange (d) onFocus (d) (44) For which of the following does the event handler onMouseOver NOT work? (a) text which is a hyperlink (b) an image which is a hyperlink (c) an image which is NOT a hyperlink (d) a clickable image map (c) (45) <INPUT TYPE="button" VALUE="Calculate" onClick="doit(this.form)"> What does "this" refer to? (a) the function doit (b) the form (c) the button (d) the character string "this" (c) (46) What does it mean to "preload an image"? (a) preload ("images/papa.gif"); (b) var pic = new Image(); (c) Include JavaScript code, NOT in a function, like pic.src = "images/papa.gif"; (d) Include JavaScript code, IN a function, like pic.src = "images/papa.gif"; (c) (47) Which of the following will open a new window (not the current one being viewed) and display the color.html file? (a) location="color.html"; (b) setTimeout('location = "color.html"', 3000); (c) setInterval('location = "color.html"', 3000); (d) window.open("color.html"); (d) (48) This page can open a new window containing the <A HREF="javascript:visit()">Purdue Website</A>. Why is "javascript:" used above? (a) Because the visit function is in the javascript folder. (b) Because this is a place where the Web browser does not expect JavaScript code. (c) Because the name of the function is javascript:visit. (d) Trick Question: "javascript:" should NOT be used above! (b) (49) Which of the following displays "Visit our online Gift Shop" whenever nothing else is there? (a) status = "Visit our online Gift Shop"; (b) onMouseOut = "Visit our online Gift Shop"; (c) default = "Visit our online Gift Shop"; (d) defaultStatus = "Visit our online Gift Shop"; (d) (50) Which of the following attributes in a FORM tag will only email the form contents if the user clicks "OK"? (a) onSubmit="confirm('Are you sure?')" (b) onSubmit="return(confirm('Are you sure?'))" (c) onClick="confirm('Are you sure?')" (d) ACTION="return(confirm('Are you sure?'))" (b)


Any questions or comments please send mail to Becky Koutsis Last updated on February 26, 1999
Back to the exams page.
Return to homepage of CS 290W -
Advanced World-Wide Web