HTML5, CSS3, and JavaScript: Tutorial 12 test questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

2

A value of _____ is returned when the rule.type property describes the @charset rule.

False

An index value of 0 inserts a CSS rule at the end of a style sheet.

3

Case-Based Critical Thinking Questions Case 12-1 Consider the following code that Wilson has written in HTML: <html> <head> <title>Historic Documents</title> </head> <body> <h1>Dept. of History</h1> <p>The <b>constitution</b> online.</p> </body> </html> Identify the value that the node.nodeType property will return for the "Dept. of History" node.

2

Case-Based Critical Thinking Questions Case 12-2 Samantha has been asked by her university to create a website that contains a list of all the subjects that the students in Computer Science and Information Science can take up during each semester in college. She wants to create a nested list that will contain an h1 heading level for a student's chosen subject stream, h2 heading level for the semester number, h3 heading level for the name of the subject, and h4 heading level for its subdivisions. While creating the nested list, Samantha has to include Computer Science as a new list item. Identify the level of the newly inserted item

2

Case-Based Critical Thinking Questions Case 12-2 Samantha has been asked by her university to create a website that contains a list of all the subjects that the students in Computer Science and Information Science can take up during each semester in college. She wants to create a nested list that will contain an h1 heading level for a student's chosen subject stream, h2 heading level for the semester number, h3 heading level for the name of the subject, and h4 heading level for its subdivisions. While creating the nested list, Samantha has to include Computer Science as a new list item. Identify the level of the newly inserted item.

4

Case-Based Critical Thinking Questions Case 12-3 Natasha has created the following nested list: <ol> <li>h1 text</li> <li>h1 text <ol> <li>h2 text</li> <li>h2 text <ol> <li>h3 text</li> <li>h3 text <ol> <li>h4 text</li> </ol> </li> </ol> </li> <li>h1 text</li> </ol> Natasha wants to add a new entry to the accompanying list, which requires her moving from the h3 heading level to the h1 heading level. Identify the number of levels Natasha needs to traverse to add the new entry to the list.

8

Case-Based Critical Thinking Questions Case 12-3 Natasha has created the following nested list: <ol> <li>h1 text</li> <li>h1 text <ol> <li>h2 text</li> <li>h2 text <ol> <li>h3 text</li> <li>h3 text <ol> <li>h4 text</li> </ol> </li> </ol> </li> <li>h1 text</li> </ol> Identify the total number of times the parentNode property will be applied if Natasha wants to move from the h4 heading level to the h1 heading level.

document.styleSheets.length

Case-Based Critical Thinking Questions Case 12-4 Jonathan has created a web document and has included multiple stylesheets in it. He wants to access details of the stylesheets included in the web document using stylesheet properties. Which of the following properties will provide Jonathan with the exact number of stylesheets loaded into the web document?

document.styleSheets[0].insertRule("h3 {color: magenta;}", 4);

Case-Based Critical Thinking Questions Case 12-5 William has created the following style sheet rule for his website. <style id="hStyles"> h1 {color: violet;} h2 {color: yellow;} h3 {color: black;} h4 {color: blue;} </style> While creating the website, William wants to add a new style sheet rule to the code. h3 { color: magenta; } Identify the correct syntax for adding the style as the fifth rule in the accompanying code.

It describes the style sheet object containing the style sheet inserted via the @import rule.

Identify a true statement about the sheet.parentStyleSheet property.

var levelUp = prevLevel - headLevel; for (var i = 1; i <= levelUp; i++) { outlineList = outlineList.parentNode.parentNode; }

Identify the correct syntax to move up a node tree.

4

Identify the integer value returned by the rule.type property if it is describing the @media rule.

node.replaceChild(new, old)

Identify the method that eliminates the old node and exchanges it with a new node.

document.createElement(elm)

Identify the method used to create an element node with the name elm.

Text

Identify the node type when the node.nodeType property returns a value of 3.

document.createComment(text)

The _____ method can be used to create a comment node containing the comment text.

node.removeChild(old)

The _____ method discards the old node from node.

sheet.cssRules

The _____ property represents the object collection of style guidelines within a style sheet.

True

The document object model supports several methods to create, attach, and set the values of attributes.

False

The innerHTML property is equally effective for large document structures as it is for small fragments of HTML code.

True

The insertrule()method is used to add style rules to an embedded style sheet.

False

The selectorText property can only be used to read the text of a Cascading Style Sheets (CSS) rule.

True

The style sheet properties that are read-only cannot be changed in JavaScript.

var linkElem = document.createElement("a"); linkElem.innerHTML = n.innerHTML; linkElem.setAttribute("href", "#" + n.id);

Which of the following codes inserts text for each item as a hyperlink?

node.appendChild(new)

Which of the following methods affixes the new node as a child of a specified node?

document.createTextNode(text)

Which of the following methods creates a node containing the text string text?

node.insertBefore(new, child)

Which of the following methods includes or embeds a new node directly ahead of a child node?

document.createAttribute(age)

Which of the following methods is used to create an attribute node with the name age?

node.attributes

Which of the following methods returns the collection of attributes associated with node?

for (var n = node.firstChild; n !== null; n = n.nextSibling) { commands }

Which of the following methods uses familial reference to loop through a collection of child nodes?

node.hasAttribute

Which of the following properties returns the Boolean value true when an element contains an attribute?

attribute node

Which of these nodes is absent from a node tree?

sheet.href

Which of these properties describes the URL of a styleSheet file?

True

Style sheets loaded into a web document, both external sheets and embedded style sheets, are part of an object collection.

True

All the versions of Internet Explorer before IE9 do not support element node properties.

True

An attribute node contains an attribute that can be attached to an element node.

False

One advantage of the counter variable method over familial references method is that it also provides the flexibility to insert new nodes into a document within the for loop without having to recalculate the length of the child nodes collection.

True

The node.childNodes describes a collection of all of the nodes that are direct children of node.

True

The node.firstElementChild property is applicable only to element nodes.

False

The node.nodeType property returns the value of a node.

False

The node.previousSibling expression describes the sibling after node.

False

Each parent node can contain only one child node.

True

Element nodes do not have a value for the nodeValue property.

sheet.insertRule(rule, index)

Identify the syntax for adding new rules to a style sheet.

for (var i = 0; i < node.childNodes.length; i++) { commands }

Identify the syntax for looping through a collection of child nodes using the counter variable method

null

Identify the value of the node.nodeValue property for the element node.

2

Identify the value returned by the node.nodeType property for an element node.

document.styleSheets [document.styleSheets.length-1]

Jonathan wants to access the last style sheet in the object collection document.styleSheets. Which of the following syntaxes should he use to reference the last style sheet?

document.styleSheets[0]. cssRules[1].selectorText = "h3"; document.styleSheets[0]. cssRules[1].style.color = "green"; document.styleSheets[0] .cssRules[1].style.fontSize = "1.2em";

Joshua has created a web page and implemented CSS in it. He has applied the style property to inline styles that can also be used with style rules and with style sheets. However, he wants to change a CSS rule in the stylesheet from h2 { color: blue; } to h3 { color: green; font-size: 1.2em; }

True

The contents of an HTML file are arranged in a hierarchical structure, starting from the root html element itself and moving down to the text strings contained within individual page elements.

False

To create or set an attribute for an element, the createAttribute () method is used.

True

To represent an element name in the nodeName property, only lowercase letters are used.

True

When the node.nodeType property returns a value of 8, it indicates that the node is a comment.

<link href="esd.css" rel="stylesheet" />

William has created a page view style sheet and saved it in a file named esd.css. Which of the following tags should William add to the document head to apply the style sheet?

sheet.deleteRule(0)

William has created the following style sheet rule for his website. <style id="hStyles"> h1 {color: violet;} h2 {color: yellow;} h3 {color: black;} h4 {color: blue;} </style> Which of the following syntaxes must William apply to the style sheet to remove the color violet completely from the website?


Set pelajaran terkait

Business Communication Essentials Ch 2

View Set

DSM ch. 10, DSM (ch. 6,, A&P Lecture Ch. 8,9,11, DSM ch 9, DSM ch. 8, HW (CH. 6-10, DSM (ch 7,

View Set

CH 12: The Correlational Research Strategy

View Set