Assignments    Calendar/Schedule    Table of Contents    Resources    |    MY Assignments    My HOME

Martha's Final Exam Practice - COIN 70b

CODE: red = intended answer; blue = actual answer, in addition or instead of intended; red = did not answer during exam; correct answer

  1. Server-Side Includes (SSIs)
    A. Include text files in our pages, as they are loaded
    B. Insert the values of the HTTP variables in the page sent back to the browser
    C. Execute other programs or scripts, such as CGI and ISAPI applications
    D. all of the above
SOURCE: Server Side Includes
  1. The encoding performed by escape() is like the URL encoding used to encode query strings and other portions of a URL that might include spaces, punctuation, or characters outside the standard ASCII character set.
    A. true
    B. false
URL Encoding & Decoding
  1. frames always load in a particular order
    A. true
    B. false
SOURCE: Frameset Communication

var str = "Apples are round, apples are juicy, and apples are sometimes red.";
var replStr = /apples/g;
var newStr = str.replace(replStr, "oranges");

  1. Using the information above newStr will be
    A. Apples are round, oranges are juicy, and apples are sometimes red.
    B. Apples are round, oranges are juicy, and oranges are sometimes red.
    C. oranges are round, apples are juicy, and apples are sometimes red.
    D. oranges are round, oranges are juicy, and oranges are sometimes red.
SOURCE: Regular Expression Methods - g=global; i=case-insensitive
  1. the code of the scripts that run on the server will be visible in the browser
    A. true
    B. false
SOURC: Wikipedia: Client-side Scripting - "In contrast, server-side scripts, written in languages such as Perl, PHP, and server-side VBScript, are executed by the web server when the user requests a document. They produce output in a format understandable by web browsers (usually HTML), which is then sent to the user's computer. The user cannot see the script's source code (unless the author publishes the code separately), and may not even be aware that a script was executed. The documents produced by server-side scripts may, of course, contain client-side scripts."
  1. Which of the following are methods
    A. alert
    B. prompt
    C. open
    D. write
SOURCE: Window Methods: alert, prompt, open; Document Methods: write
  1. An example of Server-Side Includes (SSIs) notation is
    A. <INCLUDE="includes/header.txt">
    B. <% EXEC CMD = "/utils/cmdtest.exe?10024" %>
    C. <SCRIPT LANGUAGE="JavaScript1.1" SRC="formcheck.js">
    D. none of the above
SOURCE: Server Side Includes
  1. Which one(s) is/are correct?
    A. alert()
    B. document.alert()
    C. window.alert()
    D. none of the above
SOURCE: Window Methods: alert, prompt, open; Document Methods: write; JavaScript Dialog Boxes: alert
  1. parseFloat("Height is 3.14 meters") will return
    A. 3
    B. 314
    C. 3.14
    D. NaN
SOURCE: Built-in Functions: parseFloat
  1. if navigator.appVersion equals 4.0 (compatible; MSIE 4.01; Windows NT)
    parseInt(navigator.appVersion) will return an error
    A. true
    B. false

SOURCE: Navigator Object Properties

TEST:

document.write(example + " of how to use concatenation");
document.write(example, " of how to use concatenation");

  1. the statements above produce the same results
    A. true
    B. false

TEST:

  1. An important reason to specify names for the windows and frames is that those names can be used as the value of the TARGET attribute of the <A>, <MAP>, and <FORM> tags
    A. true
    B. false

SOURCE: <a> Target Attribute; <map> Attributes (target for area, not map); <form> Attributes;

CONTRARY: Window Object - "An important reason to specify names for the windows and frames is that those names can be used as the value of the TARGET attribute of the <A>, <MAP>, and <FORM> tags. This tells the browser where you want the results of activating a link, clicking on an image map, or submitting a form to be displayed."

  1. cookies can be created either from the server or the browser
    A. true
    B. false
SOURCE: Webmasterworld.com (no Server-side Cookie storage); Velocity Reviews (no server-side cookies); Felgel.com (yes); Unofficial Cookie FAQ (yes!): "Cookies can be set from the browser-side or from the server-side. "
  1. "JavaScripts" can be run either on the browser or on the server
    A. true
    B. false
SOURCE: What is JavaScript? - "JavaScript works on the client side...Generally, only Client-Side script[listed as a limitation]" vs. Wikipedia: Server-Side JavaScript - "Server-side JavaScript (SSJS) refers to JavaScript that runs on server-side. This term was coined because the language is predominantly used on the client-side, i.e. client-side JavaScript (CSJS)."
  1. How do you refer to the third element of the second form on a page?
    A. document.forms[2].elements[2]
    B. document.forms[0].elements[1]
    C. document.forms[1].elements[2]
    D. document.forms[1].elements[3]
SOURCE: Hierarchy of JavaScript Objects
  1. Which Method can you use to determine the 6th character in a text string called "txt"?
    A. txt.position(6)
    B. txt.charAt(5)
    C. txt.charAt(6)
    D. txt(6)
SOURCE: String Objects
  1. <body bgcolor="#FF0000">
    body {background-color: #FF0000;}
    are "equivalent"
    A. true
    B. false
SOURCE: CSS-Colors and Backgrounds
  1. Which Method do you use to turn "2 is a number" into an actual number?
    A. charAt()
    B. substring()
    C. indexOf()
    D. parseInt()

SOURCE: String Objects; Built-in Functions; could use eval(indexOf(0)), or eval(charAt(0)); or...

  1. Properties of objects are, in many ways, just like JavaScript variables and can contain any type of data, including arrays, functions, and other objects.
    A. true
    B. false
SOURCE: Glossary: Objects; Properties; JavaScript Oject Summary; Variables; Objects, Properties & Methods; Objects, in JS the Definitive Guide: "Objects are composite data types: they aggregate multiple values into a single unit and allow us to store and retrieve those values by name. Another way to explain this is to say that an object is an unordered collection of properties, each of which has a name and a value. The named values held by an object may be primitive values like numbers and strings, or they may themselves be objects. "; Variables as Properties
  1. The client initiates a CGI process by:
    A. By clicking a hypertext link that runs the script directly
    B. "Submit" button in an HTML form
    C. calling an object’s property
    D. none of the above
SOURCE: CGI Process - "CGI programs were shown to be invoked by a URL. The URL could be entered directly into a Web browser or stored in a Web page as a hypertext link or the destination for HTML form information." Get and Post Methods - "The client initiates a CGI process by clicking any of the following on an HTML page:
  1. The units 'px' and 'pt' make the font size absolute, while '%' and 'em' allow the user to adjust the font size as he/she see fit.
    A. true
    B. false
SOURCE: CSS - Fonts

var ArrayName = new Array(4);

  1. ArrayName can never have more than four elements
    A. true
    B. false
SOURCE: Arrays
  1. Ways to "deaden" a link:
    A. javascript:void(null)
    B. javascript:void("")
    C. javascript:void('')
    D. javascript:void()
SOURCE: Manipulating the Value of a Text Field
TEST:
Coin 70b Home Page
Coin 70b Home Page
Coin 70b Home Page
Coin 70b Home Page
  1. A client browser can make a CGI request to a server by either of two methods:
    A. Post
    B. Push
    C. Get
    D. Put
SOURCE: GET and POST Methods
  1. The expiry date of a cookie by default is 24 hrs
    A. true
    B. false
SOURCE: Cookies "A cookie without a valid (future) expiry date will not be stored on your machine but will be available for the duration of the current session (ie. until you log off)." Truth about Cookies
  1. text-transform: capitalize;
    Transforms john doe into JOHN DOE
    A. true
    B. false
SOURCE: CSS - Text - "capitalize - Capitalizes the first letter of each word. For example: "john doe" will be "John Doe". "

For questions 27 & 28.

<% for (i = 1; i <= 7; i++) { %>
<FONT SIZE="<% = i %>">Hello World!</FONT><BR>
<% } %>

  1. The above code is syntactically correct for an Active Server Page
    A. true
    B. false
  2. SOURCE: ASP - Hello World

    CODE: <% for (i = 1; i <= 7; i++) { %> <FONT SIZE="<% = i %>">Hello World!</FONT><BR> <% } %>

<FONT SIZE="1">Hello World!</FONT><BR>
<FONT SIZE="2">Hello World!</FONT><BR>
<FONT SIZE="3">Hello World!</FONT><BR>
<FONT SIZE="4">Hello World!</FONT><BR>
<FONT SIZE="5">Hello World!</FONT><BR>
<FONT SIZE="6">Hello World!</FONT><BR>
<FONT SIZE="7">Hello World!</FONT><BR>

The HTML above is produced by the code above question 27
A. true
B. false

  1. HTTP was designed to be a stated (stateful) protocol
    A. true
    B. false
SOURCE: Stateful vs. Stateless

Use the following information to answer questions 30 – 32

function writeFld() {
     var fld = "Yo!";
     document.forms[1].elements[2].value = fld;
}

function writeRtn(expression) {
     var fld = expression;
     return fld;
}

<FORM>
    <INPUT TYPE="text" NAME="Name" VALUE="bla bla bla">
    <INPUT TYPE="button" VALUE="Write"
      onClick="document.forms[1].Name.value= 'Yo!';">
    <INPUT TYPE="button" VALUE="writeFld" onClick="writeFld();">
    <INPUT TYPE="button" VALUE="writeRtn"
      onClick="document.forms[2].elements[2].value= writeRtn('Yo!');">
</FORM>

<FORM>
    <INPUT TYPE="text" NAME="Name" VALUE=""><BR>
    <INPUT TYPE="text" VALUE=""><BR>
    <INPUT TYPE="text" VALUE=""><BR>
    <INPUT TYPE="submit" VALUE="Push me" onClick="alert('Yo');">
</FORM>

TEST:




  1. Pressing Button "A" will put "Yo!" into text box
    A. 1
    B. 2
    C. 3
    D. none of the above
  1. Pressing Button "B" will put "Yo!" into text box
    A. 1
    B. 2
    C. 3
    D. none of the above (#4)
  1. Pressing Button "C" will put "Yo!" into text box
    A. 1
    B. 2
    C. 3
    D. none of the above (undefined)
  1. The open() command can have the following "arguments"
    A. URL
    B. WindowName
    C. featureList
    D. none of the above
SOURCE: Window Object - The syntax of the open() method is fairly straight forward:

windowHandle = window.open([URL [, windowName [, features]]])

  1. By default JavaScript allows you to manipulate files in general on a user’s computer
    A. true
    B. false
SOURCE: What Can You Do with JS?; What Can't You Do?
  1. Active Server Pages allows you to manipulate files in general on the server
    A. true
    B. false
SOUCRCE: Intro to ASP; ASP Basics; "The Server object provides access to methods and properties on the server. Most of these methods and properties serve as utility functions. The most frequently used method is the one that creates an instance of an ActiveX component (Server.CreateObject). "

Use the following information for question 36

<SELECT NAME="SendFree">
    <OPTION VALUE="Select1">Please select one</OPTION>
    <OPTION VALUE="Corp">Corporate Portal White Paper </OPTION>
    <OPTION VALUE="Seybold">Patricia Seybold Report </OPTION>
    <OPTION VALUE="Both">Both </OPTION>
</SELECT>

  1. cSendFree = form.SendFree.options[form.SendFree.selectedIndex].value
    A. cSendFree == Seybold
    B. cSendFree == Patricia Seybold Report
    C. cSendFree == ""
    D. none of the above

Use the following information for question 37

<TR>
   <TD>
     <INPUT TYPE="checkbox" NAME="Project" VALUE="intranet">Intranet<BR>
     <INPUT TYPE="checkbox" NAME="Project" VALUE="extranet">Extranet<BR>
  </TD>
  <TD>
     <INPUT TYPE="checkbox" NAME="Project" VALUE="kmgmt">Knowledge Mgmt.<BR>
     <INPUT TYPE="checkbox" NAME="Project" VALUE="none">No Project<BR>
  </TD>
</TR>

1.gif (3202 bytes)

var Projects = -1;

for (i = 0; i < form.Project.length; i++) {
     if (form.Project[i].checked) {
          Projects = i;
     }
}

  1. Projects will equal
    A. -1
    B. 1
    C. 2
    D. none of the above

SOURCE: Forms - Checkbox; Checkbox Test

CODE for Checkbox Test:

function testButton(form){  	
var alertStr = "";  	  	
for (Count = 0; Count < 3; Count++){  		
	if (form[Count].checked) alertStr += "CheckBox " + (Count + 1) + " is checked\n";  	}  	  	
	if (!alertStr) alertStr = "No CheckBox was selected";  	  	
alert (alertStr);  }  

 

  1. "form validation" can done either on the browser or on the server
    A. true
    B. false
SOURCE: Form Validation Overview
  1. <h1 id="old">Old Header</h1>
    <script>
    document.getElementById("header").innerHTML = "New Header";
    </script>

    Old Header gets changed to New Header
    A. true
    B. false

SOURCE: JS and HTML DOM
  1. <h1 onClick="document.getElementById('p1').style.color='red'">Click Me!</h1>

    If you click on 'Click Me!' it will turn red
    A. true
    B. false

REASON: "To change the style of an HTML element: document.getElementById(id).style.property=new style"
SOURCE: JavaScript and CSS
  1. <table width="100%">
    <tr>
    <td bgcolor="blue" onMouseOver="changeColor('blue')"> </td>
    </tr>
    </table>

    <form>
    <input id="x" type="text" value="Mouse over the color" size="20">
    <input id="y" type="button" value="Mouse over the color">
    </form>

    <script>
    function changeColor(color) {
        document.getElementById('x').style.color = color;
    }
    </script>

    TEST:

    The MouseOver will change the text in the input field to blue
    A. true
    B. false
  1. <SELECT NAME="list1" MULTIPLE="4"> is a valid statement
    A. true
    B. false
SOURCE: The Select Element - "Using the MULTIPLE attribute, you can enable the user to select more than one choice in a scrollable selection list: <SELECT NAME="test" SIZE="2" MULTIPLE>"; JavaScriptKit.com - Multiple is "Boolean that indicates whether this SELECT allows more than one option to be selected simultaneously."

Use the following information for Questions 43 & 44
The "code" below resides on qstring.asp.

<A HREF="qstring.asp?Size=Medium&amp;Color=Yellow">
This link will demonstrate the Request.QueryString object.
</A>
<P>
The current value of Size is <% = Request.QueryString("Size") %><BR>
The current value of Color is <% = Request("Color") %>

  1. This example uses which method
    A. GET
    B. POST
    C. CGI
    D. none of the above
SOURCE: GET and POST Methods; REASON: "The GET Method transfers the data within the URL itself. Under the GET Method, the browser might initiate the HTTP transaction as follows:

GET HTTP/1.1 /cgi-bin/addrform.pl?first=John&last=Smith "

  1. The current value of Color is (before the hyperlink is clicked)
    A. ""
    B. Yellow
    C. results in an error message
    D. none of the above
SOURCE: example - result: Request.QueryString
  1. Response.Write(Server.HTMLEncode("Welcome to Altötting near München")) is equivalent to Welcome to Alt&#246;tting near M&#252;nchen
    A. true
    B. false
SOURCE: Testing HTMLEncode REASON: "Response.write(Server.HTMLEncode("Welcome to Altötting near München ")) %> OR if done through HTML

Welcome to Alt&#246;tting near M&#252;nchen

"