Sample Questions for Exam 1

  1. Explain why some HTML tags come in an opening and closing pair and some are used alone. Give examples of each.

If an action begins at one point in the text and ends at a later point, it requires a paired tag to mark the beginning and ending of its action. For example, <h1> is a paired tag.

If an action occurs at a single point in the text, it can be written with a single tag. For example, <br> is a single tag.

  1. True or false: <head> and <h1> both create bold heading text?

False. <head> begins the head o the document. <h1> starts heading text.

  1. Name the two main parts of an HTML document.

The two main parts are the head and the body. You could plausibly argue that tags and text are the two main part, too.

  1. Give an example of a tag with an optional attribute.

The <table> tag has the optional attribute ‘border’: <table border>. Of course, there are many others.

  1. Give an example of a tag with a required attribute.

The ‘img’ tag must have a ‘src’ attribute.

  1. Give the three tags that are necessary to create a basic HTML table.

The <html>, <head>, and <body> paired tags should appear on any page.

  1. What is the relative address of the file MATC1101/web/target.html from the file MATC1101/lab/linker.html ?

The relative address is ../web/target.html.

  1. Name two types of input devices that have values, and describe the effect of those values on the page.

The value of a text box gives the text that appears in the box when the page loads. The value of a button gives the text that appears on the button.

  1. Which is redder, #101055 or #F01055?

#F01055 is redder.

  1. What is the problem with the following body tag: <body bgcolor=”#000000”>?

This makes the background black while leaving the text black. The text will be invisible.

  1. Give an example of a job a client-side program can do.

A client –side program can do any task that requires only data contained in the program or provided by the client, while returning results only to the client. For example, a multiple choice sample test works well as a client-side program. Client-side programs are also widely used for data validation.

  1. What is the effect of the following HTML and JavaScript? <input type=”button” value=”Try it.” onclick=”alert(‘Don’t do that again.’)”>

When the client clicks the button, an alert will pop up, saying, “Don’t do that again.”

  1. What JavaScript command can be used to create a name for a sequence of commands?

You can use the command

function functionName()

{

...

}

to group the commands between the braces under the name “functionName()”.

  1. If a JavaScript program reads values from two text boxes into variables ‘x’ and ‘y’, what line of JavaScript creates a variable ‘z’ with the value equal to the value of ‘x’ divided by the value of ‘y’?

var z=x/y;

  1. If a JavaScript program reads values from two text boxes into variables ‘x’ and ‘y’, what line of JavaScript creates a variable ‘z’ with the value equal to the value of ‘x’ followed by the value of ‘y’?

var z=x+y;

  1. An image of an HTML page is appended. Give the HTML code to create that page.

(Just view the source.)

  1. The code for a web page is appended. Sketch the appearance of the page and describe the behavior.

(Just run the page.)