Post on 14-Apr-2017
MICROSOFT
70-480 Programming in HTML5 with JavaScript and CSS3
986 questions
VCE Sources: 58
microsoft.actualanswers.70-480.v2014-06-27.by.harriet.100q.vce
microsoft.actualtest.70-480.v2012-12-04.by.fructuoso.69q.vce
microsoft.actualtest.70-480.v2012-12-04.by.miguelangelruiz.69q.vce
microsoft.actualtest.70-480.v70-480.by.prabhu.69q.vce
microsoft.actualtests.70-480.v2012-11-25.by.shibanus.69q.vce
microsoft.actualtests.70-480.v2012-12-17.by.adnan_mashwani.69q.vce
microsoft.actualtests.70-480.v2013-10-12.by.mary.169q.vce
microsoft.actualtests.70-480.v2013-10-23.by.sam.169q.vce
microsoft.actualtests.70-480.v2013-12-24.by.actualtests.38q.vce
microsoft.actualtests.70-480.v2013-12-26.by.mary.169q.vce
microsoft.actualtests.70-480.v2013-12-30.by.mary.169q.vce
microsoft.actualtests.70-480.v2013-12-31.by.mary.169q.vce
microsoft.beitcertified.70-480.v2013-02-14.by.anonymous.69q.vce
microsoft.braindump.70-480.v2012-11-11.by.sachinsnimbalkar.197q.vce
microsoft.braindump.70-480.v2012-12-25.by.hicham.69q.vce
microsoft.braindump.70-480.v2012-12-26.by.chandra.69q.vce
microsoft.braindump.70-480.v2012-12-26.by.hkayne.69q.vce
microsoft.braindump.70-480.v2012-12-29.by.anonymous.77q.vce
microsoft.braindump.70-480.v2013-01-09.by.guy.71q.vce
microsoft.braindump.70-480.v2013-01-12.by.azad.71q.vce
microsoft.braindump.70-480.v2013-04-04.by.azad.71q.vce
microsoft.braindump.70-480.v2013-04-08.by.umarali.71q.vce
microsoft.braindump.70-480.v2013-04-10.by.azad.71q.vce
microsoft.braindump2go.70-480.v2013-08-15.by.hakimali.84q.vce
microsoft.braindumps.70-480.v2014-04-14.by.tamara.31q.vce
microsoft.braindumps.70-480.v2014-06-05.by.nicole.181q.vce
microsoft.certdumps.70-480.v2013-12-09.by.mashwani.69q.vce
microsoft.certkey.70-480.v2013-09-28.by.nancy.69q.vce
microsoft.certkiller.70-480.v2013-09-28.by.annie.70q.vce
microsoft.certkiller.70-480.v2014-03-13.by.debra.31q.vce
microsoft.exactquestions.70-480.v2013-09-21.by.amy.135q.vce
microsoft.exactquestions.70-480.v2013-12-30.by.amy.102q.vce
microsoft.exactquestions.70-480.v2014-01-24.by.amy.135q.vce
microsoft.exactquestions.70-480.v2014-03-04.by.maria.130q.vce
microsoft.examcertify.70-480.v2012-09-08.by.saif.18q.vce
microsoft.examcollection.70-480.v2013-02-04.by.test.70q.vce
microsoft.passguide.70-480.v2013-10-10.by.rita.51q.vce
microsoft.passguide.70-480.v2013-12-20.by.rita.38q.vce
microsoft.passguide.70-480.v2015-08-18.by.exampass.177q.vce
microsoft.practicetest.70-480.v2013-04-07.by.shariq.71q.vce
microsoft.realtests.70-480.v2014-03-03.by.jhonson.53q.vce
microsoft.selftestengine.70-480.v2013-09-26.by.alice.71q.vce
microsoft.selftestengine.70-480.v2013-12-06.by.mark.169q.vce
microsoft.selftestengine.70-480.v2014-04-28.by.brandon.40q.vce
microsoft.test-papers.70-480.v2013-12-12.by.sgt.pepper.146q.vce
microsoft.test-papers.70-480.v2014-03-07.by.amelia.45q.vce
microsoft.test-papers.70-480.v2014-06-13.by.valerie.205q.vce
microsoft.test4prep.70-480.v2012-11-10.by.jragvzla.69q.vce
microsoft.test4prep.70-480.v2012-11-12.by.silence20.69q.vce
microsoft.test4prep.70-480.v2012-11-14.by.carnx.69q.vce
microsoft.test4prep.70-480.v2012-11-24.by.examterminator.69q.vce
microsoft.testinexam.70-480.v2013-01-03.by.fe.69q.vce
microsoft.testinside.70-480.v2013-09-26.by.testinside.71q.vce
microsoft.testinside.70-480.v2014-03-18.by.hobert.9q.vce
microsoft.visualexams.70-480.v2013-09-28.by.kathy.69q.vce
microsoft.visualexams.70-480.v2014-05-17.by.cindy.35q.vce
microsoft.visualexams.70-480.v2014-06-07.by.harvey.115q.vce
microsoft.yesuse.70-480.v2013-05-20.by.oho.71q.vce
Questions found: 4620
Duplicate questions: 3634
Unique questions: 986
This document is a free study guide, it likely contains errors.
-ColgateKid
QUESTION 1
?
A. 1980
B. 1992
C. 2000
D. 2002
Correct Answer: B
Explanation/Reference:
QUESTION 2
A. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5 Transitional//EN" "http://www.w3.org/TR/html4/
loose.dtd>
B. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/
loose.dtd>
C. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
D. <!DOCTYPE html>
Correct Answer: D
Explanation/Reference:
<!DOCTYPE html> is Doctype declaration for HTML5
QUESTION 3
Which Tag elements represent a top-level heading in your document, which browsers tend to render as text in
a large, bold font
A. h6
B. h7
C. h5
D. h1
Correct Answer: D
Explanation/Reference:
h1 Tag elements represent a top-level heading in your document, which browsers tend to render as text in a
large, bold font
QUESTION 4
Correct Code for Unordered lists group sets of items in no particular order
A.
B.
C.
D. <ul>
<il>Notepad</il>
<il>Textmate</il>
<il>Visual Studio</il>
</ul>
Correct Answer: B
QUESTION 5
how to add comments in your style sheet
A. //
B. /* */
C. ///
D. No of the above
Correct Answer: B
Explanation/Reference:
You can also add comments to your style sheets by using /* */ delimiters
QUESTION 6
CSS is an acronym for
A. Cascade Style Sheets
B. Cascadinng Sheet Style
C. Cascading Style Sheets
D. Cascading Style Sheets
Correct Answer: C
Explanation/Reference:
CSS is an acronym for Cascading Style Sheets
QUESTION 7
Which of the following list in basic selectors
A. element selector
B. class selector
C. id selector
D. All the Above
Correct Answer: D
Explanation/Reference:
The element selector identifies the group of all elements in the page with that name. For example, h2 {}
returns the set of all level two headings in the page.
. The class selector, identified by a period, returns the set of all elements in the page where the class
attribute is set to the specified value. For example, .myClass {} returns the set of elements where the class
attribute is set to "myClass".
. The id selector, identified by a hash, returns the set of all elements in the page where the id attribute is
set to the specified value. For example, #thisId {} returns the set of any elements where the id attribute is set to
"thisId"
QUESTION 8
Visual Studio Express 2012 for Web used as web application IDE
A. Paid Version
B. Trial Version
C. Free to download and install
D. All the above
Correct Answer: C
Explanation/Reference:
Visual Studio Express 2012 for Web Free to download and install
QUESTION 9
What are the four elements that define the basic structure of an HTML page?
A. DOCTYPE
B. <body>
C. <head>
D. <html>
Correct Answer: ABCD
QUESTION 10
Which of following statement is correct about <article> element & <section> element
A. An <article> element can contain a <section> element and vice versa not true
B. An <article> element can contain a <section> element
C. An <article> element can contain a <section> element and vice versa
D. An <section> element can contain a <article> element
Correct Answer: D
Explanation/Reference:
An <article> element can contain a <section> element and vice versa and this should be emphasized. There's
no single correct way to organize the content for a page.
QUESTION 11
CSS also provides the background shortcut property which enables you to set some or all of the elements just
described. You must set the values for these properties in the following order:
Build List and Reorder:
Correct Answer:
QUESTION 12
Which of the following items is NOT a property of the CSS box model?
A. Margin
B. Content
C. Border
D. Style
Correct Answer: D
Explanation/Reference:
Except Style
( ) Margin
( ) Content
( ) Border
() Style
( ) Padding
QUESTION 13
The combination of JavaScript and the XMLHttpRequest API Known as
A. Asynchrous java script API
B. AsyncJavaScript API
C. AJAX
D. XMLHttpRequest API
Correct Answer: C
Explanation/Reference:
The combination of JavaScript and the XMLHttpRequest API (commonly referred to as AJAX) enables a web
page to make asynchronous requests back to the web server. The JavaScript code for a page can use this
feature to query a server for more information, without requiring that the entire page be reloaded in the browser
QUESTION 14
JavaScript is a scripting engine with the same basic features as any other programming language.
Select One or More Feature from following List:
A. The ability to create objects with properties, methods, and events.
B. Functions for grouping statements into reusable chunks.
C. Conditional statements and loop constructs to control program flow.
D. Variables for storing information. Operators for performing calculations and comparisons.
Correct Answer: ABCD
Explanation/Reference:
All the Above supported by javascript
QUESTION 15
Microsoft's implementation of ECMA-262 is called as
A. JSScript
B. JScript
C. JavaScript
D. Non of the above
Correct Answer: B
Explanation/Reference:
Microsoft's implementation of ECMA-262 is called as JScript
QUESTION 16
All statements in JavaScript should be written on a single line and be terminated with a semicolon. The
exception to this rule is that you can split a large string over several lines (for readability)
A. document.write("An incredibly really \
very long greeting to the world");
B. document.write("An incredibly really" &_
"very long greeting to the world");
C. document.write("An incredibly really" +
"very long greeting to the world");
D. document.write("An incredibly really" &
"very long greeting to the world");
Correct Answer: A
Explanation/Reference:
by using a backslash. For example: document.write("An incredibly really \
very long greeting to the world");
QUESTION 17
Find the output of following
<script type="text/javascript">
x=10 + 10;
y="10"+10;
z="Ten"+10;
document.write("x= " + x + " y= " + y + "z= " +z);
</script>
A. x=20 y=1010 z= Ten10
B. x= 20 y= 1010z= Ten10
C. x= 20 , y= 0101, z= Ten10
D. x= 20 y= 1010z= 10Ten
Correct Answer: B
Explanation/Reference:
x= 20 y= 1010z= Ten10 in IE 10 in notepad mydemo.html open same in browser
QUESTION 18
What are true statement about function declaration
A. A set of JavaScript statements enclosed in a pair of curly braces. These statements run when the function
is invoked.
B. The function name. You use this name to run the function. It is case-sensitive
C. The function keyword indicates this is the start of a function definition.
D. A comma-separated list of values, called arguments, which you can pass to the function. This list is
enclosed in parentheses. If the function has no arguments, it should still have the pair of parentheses after
its name
Correct Answer: ABCD
Explanation/Reference:
All the above need to used while function declaration
QUESTION 19
if you wanted to calculate the total hotel bill for a guest, you might write the following function and call it like so.
A. function CalculateBill(numberOfNightsStay, nightlyRate) {
return (numberOfNightsStay * nightlyrate) + extras;
}
...
// elsewhere in the script
var TotalAmountOwed = CalculateBill(10, 100, 50);
B. function CalculateBill(numberOfNightsStay, nightlyRate, extras) {
numberOfNightsStay * nightlyrate) + extras;
}
...
// elsewhere in the script
var TotalAmountOwed = CalculateBill(10, 100, 50);
C. function CalculateBill(numberOfNightsStay, nightlyRate, extras) {
return (numberOfNightsStay * nightlyrate) + extras;
}
...
// elsewhere in the script
var TotalAmountOwed = CalculateBill(10, 100, 50);
D. function CalculateBill(numberOfNightsStay, nightlyRate, extras) {
return (numberOfNightsStay * nightlyrate) + extras;
}
...
// elsewhere in the script
var TotalAmountOwed = CalculateBill(10, 50);
Correct Answer: C
Explanation/Reference:
This is syntax of creating function so answer three correct equal parameter and calling function parameter no
should match.
function aName( argument1, argument2, ..., argumentN ) {
statement1;
statement2;
...
statementN;
}
QUESTION 20
Find the output of following code
<script type="text/javascript">
function Display( fname, mname, lname)
{
if(arguments.length==3)
document.write("My Name : " + arguments[0] + " " +arguments[1] + " " +arguments[4] );
else
document.write("Invalid name parameters");
}
//calling function Display
Display("Sachin","S", "Nimbalkar");
//calling function Display with two parameters
document.write("</br>");
Display("Sachin", "Nimbalkar");
</script>
A. Error
B. My Name : Sachin S undefined
Invalid name parameters
C. My Name : Sachin S Nimbalkar
Invalid name parameters
D. None of above
Correct Answer: B
Explanation/Reference:
arguments[4] is not defined so undefined will print
QUESTION 21
Find the output of following javascript
<script type="text/javascript">
var typeOfRoom="king";
switch (typeOfRoom)
{
case "Suite":
RoomRate = 500;
break; //Use break to prevent code in next case statement bein
case "King":
RoomRate = 400;
break;
default: // code to be executed if typeOfRoom does not match above cases.
RoomRate = 300;
}
document.write( "For " + typeOfRoom +" RoomRate = " +RoomRate);
</script>
A. For king RoomRate = 300
B. Error
C. For king RoomRate = 400;
D. For king RoomRate = 500
Correct Answer: A
Explanation/Reference:
Best Practice: Note that in the above switch example, if the value of typeOfRoom is suite or king, RoomRate
will be set to 300
because JavaScript is case sensitive. To solve this, make the text all lowercase using switch
(typeOfRoom.toLowerCase()) and
write all the case values in lower case.
QUESTION 22
Which of the following sentense is correct
A. JavaScript is an not language in which to write object-oriented web applications
B. JavaScript is an excellent language in which to write object-oriented web applications
C. JavaScript is an excellent language in which we can not write object-oriented web applications
D. None the above
Correct Answer: B
Explanation/Reference:
JavaScript is an excellent language in which to write object-oriented web applications
QUESTION 23
JavaScript provides APIs for JSON (JavaScript Object Notation)
A. for parsing JSON data (JSON.parsefy)
B. for converting data into JSON format (JSON.stringify)
C. for parsing JSON data (JSON.parse)
D. Non of the above
Correct Answer: BC
Explanation/Reference:
JSON has become increasingly important as it is currently the de facto format for passing data in an AJAX
request between a web page and a web server. JavaScript provides APIs for converting data into JSON format
(JSON.stringify), and for parsing JSON data (JSON.parse).
QUESTION 24
JavaScript provide several built-in object types String, Date , Array, RegExp etc
Find output of following javascript code
<script type="text/javascript">
var eventWelcome = new String('Welcome to your conference');
var len = eventWelcome.length;
var today = new Date(2012, 8, 1);
var seasonsArray = new Array("Spring", "Summer", "Autumn", "Winter");
var thirdSeason = seasonsArray[3];
var re = new RegExp("\\[dh\\]og");
if (re.test("dog"))
{ var ans= "og Found in text";}
else
{ var ans= "og Not Found in text";}
document.write("len = " + len + " today : " + today + " thirdSeason " + thirdSeason + " Ans of RegExp " +
ans);
</script>
A. len = 26 today : Sat Sep 01 2012 00:00:00 GMT+0530 (India Standard Time) thirdSeason Winter Ans of
RegExp og Found in text
B. len = 26 today : Sat Sep 01 2012 00:00:00 GMT+0530 (India Standard Time) thirdSeason Winter Ans of
RegExp og Not Found in text
C. len = 25 today : Sat Sep 01 2012 00:00:00 GMT+0530 (India Standard Time) thirdSeason Winter Ans of
RegExp og Not Found in text
D. len = 26 today : Sat Sep 01 2012 00:00:00 GMT+0530 (India Standard Time) thirdSeason Autumn Ans of
RegExp og Not Found in text
Correct Answer: B
Explanation/Reference:
len = 26 today : Sat Sep 01 2012 00:00:00 GMT+0530 (India Standard Time) thirdSeason Winter Ans of
RegExp og Not Found in text
QUESTION 25
What are mostly used method to get control contents ?
A. document.forms.contactForm.elements[0]
B. document.forms.contactForm.elements["nameBox"]
C. document.getElementById()
D. document.getElementsByName( )
Correct Answer: CD
Explanation/Reference:
Mention that the getElementById and getElementByName methods are the most commonly used ways of
obtaining a reference to an element
QUESTION 26
DOM Core API defines several methods to create new objects for a document Select One Or More From list
A. document.createElement(tagname)
B. document.createTextNode(string)
C. document.createAttribute(name, value)
D. document.createDocumentFragment
Correct Answer: ABCD
Explanation/Reference:
All the above
QUESTION 27
Find the correct statement
A. jQuery is an properatory JavaScript library that deals with cross-browser incompatibilities for you
B. jQuery is an open source JavaScript library that deals with IE browser incompatibilities for you
C. jQuery is an open source JavaScript library that deals with cross-browser incompatibilities for you
D. jQuery is an open source JavaScript library that deals with Mozila FireFox-browser incompatibilities for you
Correct Answer: C
QUESTION 28
how to add reference in your web page of jQuery (JavaScript file =jquery-1.8.0.min.js)
A. <link src="Scripts/jquery-1.8.0.min.js" type="text/javascript"></link>
B. <script src="Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
C. <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.min.js" type="text/javascript"></script>
D. All the above
Correct Answer: BC
Explanation/Reference:
jQuery is a JavaScript file that you reference in your page with a script tag. You can download it and reference a
local copy in your page.
<script src="Scripts/jquery-1.8.0.min.js" type="text/javascript"></script>
Alternatively, you can reference its location on one of several Content Delivery Networks (CDNs), which
ensures faster downloads and caching in the browser.
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.min.js" type="text/javascript"></script>
QUESTION 29
All variables in JavaScript are strongly typed, and you must specify the type of a variable when you create it.
True or False?
A. False
B. True
C.
D.
Correct Answer: A
Explanation/Reference:
False is correct answer
QUESTION 30
Which jQuery function indicates that the contents for a page have been loaded into the browser?
A. loaded
B. $
C. ready
D. bind
Correct Answer: C
Explanation/Reference:
<script type="text/javascript">
$(document).ready(function () {
$("#submit").click(
function () {
var userName = $("#NameBox").val();
$("#thankYouArea").replaceWith("<p>Thank you " + userName + "</p>");
})
});
ready() verifies that all content for page are loaded successfully. then proceed.
QUESTION 31
The [] attribute indicates that a field is mandatory and that the form should not be submitted if it is left blank. a)
compusary b) required c) * d) i dont know
Correct Answer: The required attribute indicates that a field is mandatory and that the form should not be
submitted if it is left blank.
Explanation/Reference:
The required attribute indicates that a field is mandatory and that the form
should not be submitted if it is left blank.
QUESTION 32
With HTML5, How you can control the upper and lower limits of numeric input
A. <input id="percentage" type="number" upperbound="100" lowerboumd="0" />
B. <input id="percentage" type="number" maximum="100" minimum="0" />
C. <input id="percentage" type="number" maxvalue="100" minvalue="0" />
D. <input id="percentage" type="number" max="100" min="0" />
Correct Answer: D
Explanation/Reference:
With HTML5, you can control the upper and lower limits of numeric input. The following code shows an
example:
<input id="percentage" type="number" max="100" min="0" />
QUESTION 33
What are best pratice in validation logic implementation on client side
A. On submit show all validation errors
B. show messagebox (alert) while entering data.
C. To dynamically use validation to change the color of the border
D. No of the above
Correct Answer: C
Explanation/Reference:
This technique works by detecting the validation state of the input control by using the valid and invalid pseudo-
classes, and providing a rule for the border color for each state.
input{
border: solid 1px;
}
input:invalid {
border-color: #f00;
}
input:valid {
border-color: #0f0;
}
QUESTION 34
Which is correct way to send forms data to the server by using the $.ajax() function,
use the POST method and add a JSON-formatted data property containing the data to be sent to the parameter
list
A. $.ajax({
url: '/luckydip/enterWithName',
type: 'POST',
timeout: 12000,
dataType: 'text',
data: {
firstName: myForm.fname.value,
lastName: myForm.lname.value
}).done(...
).fail(...
);
B. $.ajax({
url: '/luckydip/enterWithName',
type: 'POST',
timeout: 12000,
dataType: 'text',
data: {
('#myForm').serializeArray();
}
}).done(...
).fail(...
);
C. $.ajax({
url: '/luckydip/enterWithName',
type: 'POST',
timeout: 12000,
dataType: 'text',
data: {
('#myForm').serialize();
}
}).done(...
).fail(...
D. Non of the above
Correct Answer: A
Explanation/Reference:
The serializeArray() function generates a JSON-formatted array of field names and values
The serialize() function generates a list of fields and values formatted as a query string
Hint :
these methods will take the fields on a form and serialize the entire form in one statement. When using these
methods, you do not get to rename the fields, so they will be named just as they are on the form
while using data each field on a form in this way gives you precise control over which fields are sent and what
the properties of the object
Note
Care should be taken when using these methods because they will not include fields that are hidden or that
have a CSS display
attribute set to none. Note that there is no submit button value in the array. This is because, from a technically
accurate
viewpoint, the form was not submitted by using the usual form submission mechanism.
QUESTION 35
In the onreadystatechanged event handler for the XMLHttpRequest object, which property should you examine
to ensure that data has been returned, and what value should this property contain?
A. The readyState property should be set to 0.
B. The responseText property should be set to a non-null value.
C. The readyState property should be set to 4.
D. The status property should be set to 200 (HTTP OK).
Correct Answer: C
QUESTION 36
Which CSS rule can you use to download a font required by a web page?
A. @font-family
B. @font-style
C. @font-face
D. @font
Correct Answer: C
QUESTION 37
How do you select the first item in a list so that you can apply styling to it?
A. Use the li:first-child selector in CSS3.
B. Use the li:first-childeelement selector in CSS3.
C. Use the li:first-childtagcontent selector in CSS3.
D. Use the li:first-childvalue selector in CSS3.
Correct Answer: A
Explanation/Reference:
Use the li:first-child selector in CSS3.
QUESTION 38
Which of following example shows how to use the @font-face rule to download the TrueType® version of the
Roboto Regular font,
and use it to style some paragraphs. Using the @font-face Rule
A. @font-face {
font-family: 'RobotoRegular';
src: url('Roboto-Regular-webfont.rtf') format('truetype');
font-stretch: normal; // Default
font-weight: normal; // Default
font-style: normal; // Default
unicode: U+0-10FFFF; // Default
}
p {
font-family : RobotoRegular, "Segoe UI", Arial;
font-size: 14px;
}
B. @font-face {
font-family: 'RobotoRegular';
src: url('Roboto-Regular-webfont.ttf') format('truetype');
font-stretch: normal; // Default
font-weight: normal; // Default
font-style: normal; // Default
unicode: U+0-10FFFF; // Default
}
p {
font-family : RobotoRegular, "Segoe UI", Arial;
font-size: 14px;
}
C. @font-face {
font-family: 'RobotoRegular';
font-stretch: normal; // Default
font-weight: normal; // Default
font-style: normal; // Default
unicode: U+0-10FFFF; // Default
}
p {
font-family : RobotoRegular, "Segoe UI", Arial;
font-size: 14px;
}
D. non of the above
Correct Answer: B
Explanation/Reference:
The @font-face rule enables you to specify a font file to download, give it a name, and then use it in your CSS
rules just like
any other web-safe font such as Times, Arial, and Helvetica.
QUESTION 39
When you set the font-size property, the most common units used for that property are [] for print style sheets
and [] for screen style sheets. a) points b) picas c) millimeters d) pixels
Correct Answer: When you set the font-size property, the most common units used for that property are
[points] for print style sheets and [pixels] for screen style sheets.
Explanation/Reference:
When you set the font-size property, the most common units used for that property
are [points] for print style sheets and [pixels] for screen style sheets
QUESTION 40
Best Practise to adjust image height and width for setting to a maximum of the browser window height and
width minus Xpx This ensures you can always see the full image in your browser.
A. 05px
B. 10px
C. 15px
D. 20px
Correct Answer: A
Explanation/Reference:
You can also use the calc() function to calculate a measurement at runtime.
For example:
img {
max-height: calc(100vh - 5px);
max-width: calc(100vw - 5px);
}
QUESTION 41
The core CSS typographic properties enable you to style text by setting following properties
A. letter-spacing, line-height,
B. text-align, text-decoration,
C. text-transform properties
D. All the above
Correct Answer: D
Explanation/Reference:
all the above are Core properties
However, the CSS3 Text module defines several more properties that provide even greater control over the
layout of your text content. These properties include:
. The text-indent property, which indicates how far the first line of each new text block should be
indented.
text-indent: 3rem;
. The hyphens property, which indicates how the browser should hyphenate words when line-wrapping.
Possible values are none (no hyphenating), manual (use the ­ sequence in your text to indicate where
hyphens can be placed), and auto.
hyphens: manual;
-ms-hyphens : manual; // IE10
. The word-wrap property, which indicates whether the browser may break lines within words when line-
wrapping. Possible values are normal (the default is no), and break-word (the browser may break words at an
arbitrary point). It has been renamed overflow-wrap in CSS3, but at this time browsers only recognize the old
name.
word-wrap : normal;
. The word-spacing property, which enables you to set the spacing between words in a block of text.
You can use both relative and absolute measurements.
word-spacing : 5px;
word-spacing : 2rem;
. The text-shadow property, which enables you to apply shadowing to the selected text. A shadow is
defined by four properties:
. x-offset: How far to the right the shadow starts. Use a negative value to move it to the left.
. y-offset: How far below the shadow starts. Use a negative value to move it up.
. blur (optional): How wide the blur of the shadow is. The default is 0.
. color: Can be any color value. The default is black.
text-shadow: 0 1px 0 #000; // not supported in Internet Explorer 9 and earlier versions.
QUESTION 42
CSS enables you to define the layouts and the types of boxes that you can display on a web page select one or
more
A. block: Block boxes are formatted down the page one after another and respect padding, border, and margin
values.
display:block;
B. inline: Inline layout blocks are formatted one after another based on the baseline of their text content until
they break down onto another line, and so on. Inline blocks ignore height and width values.
display:inline;
C. inline-block: Inline-block layout blocks are formatted one after another based on the baseline of their text
content, but they keep their height and width values.
display:inline-block;
D. table: Table layout enables you to identify blocks on the page as tables, rows, columns, and cells. Blocks
are aligned by their edges rather than their content, and sized to fit the computed table.
display:table;
Correct Answer: ABCD
Explanation/Reference:
Select All the above and
flexbox: Flexbox layout is new in CSS3 and designed to be far more fluid than the others. You choose in which
direction boxes are laid out and how boxes are sized, depending on how any excess whitespace around blocks
should be handled.
display: flexbox; // for a block-level flexbox container
display: -ms-flexbox;
display: inline-flexbox; // for an inline flexbox container
display: -ms-inline-flexbox;
Note: Note that the display values for enabling flexbox layout were correct when written; the values may change
before the CSS3 Flexbox Module is finalized.
All of these layout models (possibly with the exception of flexbox, depending on the final implementation)
assume that blocks are arranged according to the normal flow of elements.
QUESTION 43
Which is correct statement about
A. In CSS1 and CSS2, pseudo-elements start with double colon (::). In CSS3, pseudo-elements start with a
colon (:) to differentiate them from pseudo-classes
B. In CSS1 and CSS2, pseudo-elements start with a colon (:). In CSS3, pseudo-elements start with a double
colon (::) to differentiate them from pseudo-classes
C. In CSS1 and CSS3, pseudo-elements start with a colon (:). In CSS2, pseudo-elements start with a double
colon (::) to differentiate them from pseudo-classes
D. Non of the above
Correct Answer: B
Explanation/Reference:
Officially However most browsers still use single colons.
QUESTION 44
There are five pseudo-classes for hyperlinks please connect to respective match
Drop and Connect:
Correct Answer:
Explanation/Reference:
There are several mnemonics for remembering the correct order (LVFHA) for link pseudo-classes. One is Las
Vegas fights Hell's Angels. Another is Let Victoria Free Her Armies.
QUESTION 45
There are three pseudo-classes that you frequently use for forms elements: (select only three)
A. input:unchecked selects all user interface elements that are unchecked.
B. input:enabled selects all enabled input controls.
C. input:checked selects all user interface elements that are checked.
D. input:disabled selects all user interface elements that are disabled.
Correct Answer: BCD
Explanation/Reference:
input:unchecked is wrong answer
QUESTION 46
You use the CSS color property to modify the color of text content. CSS3 extends this functionality by enabling
to apply color backgrounds, borders, outlines, column rules, and more
How many color defined in color module
A. 255
B. 127
C. 147
D. 512
Correct Answer: B
Explanation/Reference:
color: yellow;.
QUESTION 47
A red-green-blue (RGB) model value specified in
A. color: #ff0; /* three-digit hexadecimal notation*/
B. color: #ffff00; /* #rrggbb six-digit hexadecimal notation*/
C. color: rgb(255, 255, 0); /* a triplet of integers */
D. color: rgb(100%, 100%, 0%); /* triplet of percentage values */
Correct Answer: ABCD
Explanation/Reference:
Each of the three values represents the amount of red, green, and blue is included in the color,
with values for each between 0 and 255 (0 to 100%)
QUESTION 48
A red-green-blue-alpha (RGBA) model value of Color CSS value of as rgba(0,0,0,0) same as
A. color: transparent;
B. color: opacity;
C. color: white;
D. Non of the above
Correct Answer: A
Explanation/Reference:
The keyword transparent, which is the same value as rgba(0,0,0,0)
QUESTION 49
What is mean by (HSL) model in Color CSS value specified as a triplet of numbers
A. A hue-saturation-lightness The first is an integer indicating the percentage value for saturation. The
second is a angle of the color circle (0 = red, 120 = green, 240 = blue) . The third is also a
percentage value for lightness
B. A hue-saturation-lightness The first is an integer indicating the angle of the color circle (0 = red, 120
= green, 240 = blue). The second is a percentage value for saturation . The third is also a percentage
value for lightness
C. A hue-saturation-lightness The first is an integer indicating the angle of the color circle (0 = red, 120
= green, 240 = blue). The second is a percentage value for lightness. The third is also a percentage
value for saturation
D. Non of the above
Correct Answer: B
Explanation/Reference:
A hue-saturation-lightness (HSL) model value specified as a triplet of numbers. The first is an integer value
between 0 and 360 indicating the angle of the color circle (0 = red, 120 = green, 240 = blue). The second is a
percentage value for saturation where 0% is a shade of grey and 100% is full color. The third is also a
percentage value for lightness, where 0% is black, 100% is white and 50% is normal.
color: hsl(60, 100%, 50%);
QUESTION 50
What is use of Inherit keyword in CSS3
A. This indicates that the element should inherit the same color value as its child element
B. This indicates that the element should inherit the base color value as its parent element
C. This indicates that the element should inherit the same color value as its parent element
D. Non of the above
Correct Answer: C
Explanation/Reference:
The keyword currentColor. This indicates the same value should be used as that of the element's color
property. Writing color:currentColor is the same as writing color:inherit.
QUESTION 51
What is css for bluearrow.png will be repeated left to right along the top edge of the article element and
greenarrow.png will be repeated top to bottom along the left edge of the article element. The image declared
first in the list appears on top of the others, so bluearrow.png appears above greenarrow.png in the top left
corner of the article element
A. article {
background-image: url('bluearrow.png'), url('greenarrow.png');
background-repeat: repeat-y, repeat-x;
}
B. article {
background-image: url('greenarrow.png'),url('bluearrow.png') ;
background-repeat: repeat-x, repeat-y;
}
C. article {
background-image: url('bluearrow.png'), url('greenarrow.png');
background-repeat: repeat-x, repeat-y;
}
D. Non of the above
Correct Answer: C
QUESTION 52
What are two type of Gradients?
A. linear gradient
B. circular gradient,
C. square gradient,
D. radial gradient,
Correct Answer: AD
Explanation/Reference:
A linear gradient, which is a gradual change in color from the start color to the stop color. By default, the
start color is displayed at the top of the background and the end color at the bottom, although the direction of
the gradient may be changed.
background: linear-gradient(direction, start-color, [mid-color-list,] end-color);
e.g background: linear-gradient(30deg, blue, green, yellow);
. A radial gradient, which is a gradual change in color from a central point in the start-color outwards in
either a circle or an elliptical shape to the end color at the edge of the shape. Any number of intermediate colors
can be set in the list.
background: radial-gradient(position, shape, start-color, [mid-color-list,] end-color);
e.g background: radial-gradient(top right, ellipse, red, blue);
QUESTION 53
What are example of drawing shapes Using CSS3
A. You can draw Rectangle like this:
#rectangle-topleft {
width: 0;
height: 0;
border-top: 200px solid blue;
border-right: 200px solid transparent;
}
B. You can draw triangles like this:
#triangle-topleft {
width: 0;
height: 0;
border-top: 200px solid blue;
border-right: 200px solid transparent;
}
C. You can draw shapes such as circles and ovals by using the border-radius property to add curves to a
square.
#circle {
width: 200px;
height: 200px;
background: blue;
border-radius: 50%;
}
D. For example, to draw a square or rectangle, just use the height and width properties with a background
color:
#square {
width: 200px;
height: 200px;
background: blue;
}
Correct Answer:
Explanation/Reference:
All the Above are example of Drawing shap using css3
QUESTION 54
What is use of translate3d(x,y,z) in Transforming Elements in CSS3
A. Moves the one side element by the distance x along the x-axis, y along the y-axis, and z along the z-axis.
B. Moves the half side element by the distance x along the x-axis, y along the y-axis, and z along the z-axis.
C. Moves the partial element by the distance x along the x-axis, y along the y-axis, and z along the z-
axis.
D. Moves the whole element by the distance x along the x-axis, y along the y-axis, and z along the z-axis.
Correct Answer: D
Explanation/Reference:
Moves the whole element by the distance x along the x-axis, y along the y-axis, and z along the z-axis.
QUESTION 55
Find the output of following javascript code
<script>
var num=7;
function demonstrateScopingAndHosting(){
if(true){
var num=42;
}
alert("The value of num is"+num);
}
//calling function
demonstrateScopingAndHosting();
</script>
A. The value of num is7
B. The value of num is42
C. Error
D. Non of the above
Correct Answer: B
QUESTION 56
Inside which HTML element do we put the JavaScript?
A. <javascript>
B. <script>
C. <js>
D. <scripting>
Correct Answer: B
QUESTION 57
Where is the correct place to insert a JavaScript?
A. The <body> section
B. Both the <head> section and the <body> section are correct
C. The <head> section
Correct Answer: B
QUESTION 58
The external JavaScript file must contain the <script> tag
A. False
B. True
Correct Answer: A
QUESTION 59
How do you write "Hello World" in an alert box?
A. msgBox("Hello World")
B. alertBox="Hello World"
C. alert("Hello World")
D. alertBox("Hello World")
Correct Answer: C
QUESTION 60
How do you create a function?
A. function:myFunction()
B. function=myFunction()
C. function myFunction()
Correct Answer: C
QUESTION 61
How do you write a conditional statement for executing some code if "i" is equal to 5?
A. if (i==5)
B. if i=5
C. if i=5 then
D. if i==5 then
Correct Answer: A
QUESTION 62
How does a "while" loop start?
A. while (i<=10;i++)
B. while i=1 to 10
C. while (i<=10)
Correct Answer: C
QUESTION 63
How does a "for" loop start?
A. for (i <= 5; i++)
B. for (i = 0; i <= 5)
C. for (i = 0; i <= 5; i++)
D. for i = 1 to 5
Correct Answer: C
QUESTION 64
What is the correct JavaScript syntax to insert a comment that has more than one line?
A. //This comment has more than one line//
B. /*This comment has more than one line*/
C. <!--This comment has more than one line-->
Correct Answer: B
QUESTION 65
What is the correct way to write a JavaScript array?
A. var txt = new Array(1:"tim",2:"kim",3:"jim")
B. var txt = new Array:1=("tim")2=("kim")3=("jim")
C. var txt = new Array="tim","kim","jim"
D. var txt = new Array("tim","kim","jim")
Correct Answer: D
QUESTION 66
How do you round the number 7.25, to the nearest integer?
A. Math.round(7.25)
B. rnd(7.25)
C. round(7.25)
D. Math.rnd(7.25)
Correct Answer: A
QUESTION 67
What is the correct JavaScript syntax for opening a new window called "w2" ?
A. w2=window.open("http://www.w3schools.com");
B. w2=window.new("http://www.w3schools.com");
Correct Answer: A
QUESTION 68
How can you find a client's browser name?
A. navigator.appName
B. browser.name
C. client.navName
Correct Answer: A
QUESTION 69
Which of the following is correct?
A. jQuery is a JSON Library
B. jQuery is a JavaScript Library
Correct Answer: B
QUESTION 70
Which sign does jQuery use as a shortcut for jQuery?
A. the $ sign
B. the ? Sign
C. the % sign
Correct Answer: A
QUESTION 71
Is jQuery a library for client scripting or server scripting?
A. Server scripting
B. Client scripting
Correct Answer: B
QUESTION 72
Is it possible to use jQuery together with AJAX?
A. No
B. Yes
Correct Answer: B
QUESTION 73
A PowerBook G4 that only requires a 45-Watt AC adapter will charge its main battery faster if a 65-Watt
AC adapter is connected.
A. True
B. False
Correct Answer: B
QUESTION 74
With jQuery, look at the following selector: $("div.intro"). What does it select?
A. The first div element with id="intro"
B. All div elements with class="intro"
C. The first div element with class="intro"
D. All div elements with id="intro"
Correct Answer: B
QUESTION 75
Which jQuery method is used to set one or more style properties for selected elements?
A. css()
B. style()
C. html()
Correct Answer: A
QUESTION 76
What is the correct jQuery code for making all div elements 100 pixels high?
A. $("div").height="100"
B. $("div").height(100)
C. $("div").yPos(100)
Correct Answer: B
QUESTION 77
What scripting language is jQuery written in?
A. VBScript
B. JavaScript
Correct Answer: B
QUESTION 78
Which jQuery function is used to prevent code from running, before the document is finished loading?
A. $(document).ready()
B. $(document).load()
C. $(body).onload()
Correct Answer: A
QUESTION 79
Which jQuery method is used to switch between adding/removing one or more classes (for CSS) from selected
elements?
A. switchClass()
B. switch()
C. altClass()
D. toggleClass()
Correct Answer: D
QUESTION 80
Is jQuery a W3C standard?
A. Yes
B. No
Correct Answer: B
QUESTION 81
Rearrange step for DragDrop in HTML5
Build List and Reorder:
Correct Answer:
QUESTION 82
Some browsers support *.mp4, *.webm , *.ogy video formats so what should strategy while implementing video
tag ?
A. you can provide only versions of your video in different formats
B. you can provide two versions of your video in different formats
C. you can provide several versions of your video in different formats
D. None of the above
Correct Answer: C
Explanation/Reference:
To support multiple video formats, include one or more <source> tags within the <video> tag.
<video poster="MyPoster.jpg" autoplay controls>
<source src="MyVideos/MyVideo.mp4" type='video/mp4' />
<source src="MyVideos/MyVideo.webm" type='video/webm' />
<source src="MyVideos/MyVideo.ogv" type='video/ogg' />
<!-- You can embed Flash or Silverlight content here, as a fallback -->
<!-- You can also display some simple text in case the browser does not support the video tag -->
Cannot play video. Download video <a href="MyVideos/MyVideo.webm">here</a>
</video>
QUESTION 83
Can we create <video> elements programmatically by using Document Object Model (DOM) functions in
JavaScript code ?
A. Yes
B. No
C.
D.
Correct Answer: A
Explanation/Reference:
Creating a Video Player by Using JavaScript Code
function createVideoElement(nameOfVideoFile, nameOfHostElement)
{
// Create a video object and set its properties.
var newVideo = document.createElement("video");
newVideo.src = nameOfVideo;
newVideo.loop = true;
newVideo.autoplay = true;
newVideo.controls = true;
newVideo.poster = "ImageLoading.png";
// Add the video object to an existing element on the web page.
var hostElem = document.getElementById("videoDir");
hostElem.appendChild(newVideo);
}
QUESTION 84
Which is Correct statement about <video> and <audio> tags
A. The JavaScript API for audio is not similar to the API for video
B. The JavaScript API for audio is similiar to the API for video
C. The JavaScript API for audio is totally different from the API for video
D. Non of the above
Correct Answer: B
QUESTION 85
Location awareness is a key feature in many web applications which Runs on?
A. Desktop Applications
B. Web Application
C. Mobile devices and smartphones.
D. Non of the above
Correct Answer: C
QUESTION 86
To determine whether the browser is online or offline ?
A. The navigator.onLineStatus property, which indicates whether the browser is online or offline.
B. The navigator.Browsable property, which indicates whether the browser is online or offline.
C. The navigator.onLine property, which indicates whether the browser is online or offline.
D. Non of the above
Correct Answer: C
QUESTION 87
What methods are provided by the FileReader interface for reading files on the local file system?
A. readAsText(), readAsDataURL(), and readAsArrayBuffer().
B. readAsText(), readAsURL(), and readAsArrayBuffer().
C. readAsString(), readAsDataURL(), and readAsArrayBuffer().
D. readAsText(), readAsDataURL(), and readAsJSONArray().
Correct Answer: A
QUESTION 88
The F12 Developer Tools require that you have Visual Studio installed on your computer before you can use
them to debug JavaScript code. True or False?
A. True
B. False
C.
D.
Correct Answer: B
QUESTION 89
Which is correct statement about web application ?
A. web applications are statefull,
B. web applications are statehold,
C. web applications are stateless,
D. Non of the above
Correct Answer: C
QUESTION 90
How many way the Session Storage API provides to store and retrieve data
A. Only Two ways
B. Only Three ways
C. Only Four ways
D. Only One way
Correct Answer: B
Explanation/Reference:
Three ways to store and retrieve data:
a) getItem and setItem functions. The setItem function expects you to provide the key and the data to store.
The getItem function uses the key to return the data. If there is no data with the specified key, the value
returned is null.
sessionStorage.setItem("key","some text value");
var textFromSession = sessionStorage.getItem("key");
b) name-key pair. You can use array notation, and specify the key value as the array index.
sessionStorage["key"] = "some text value";
var textFromSession2 = sessionStorage["key"];
c) pseudo-properties. You can add a property for each key to the sessionStorage object.
sessionStorage.key = "some text value";
var textFromSession3 = sessionStorage.key;
QUESTION 91
The storage API to which both session and local storage conform includes a single event called storage
Which of following example shows how to subscribe to this event storage:
A. function myStorageCallback( e ) {
alert("Key:" + e.key + " changed to " + e.newValue);
}
window.addEventListener("storage", myStorageCallback, true);
B. function myStorageCallback( e ) {
alert("Key:" + e.key + " changed to " + e.Value);
}
window.addEventListener("storage", myStorageCallback, true);
C. function myStorageCallback( e ) {
alert("Key:" + e.key + " changed to " + e.newkey);
}
window.addEventListener("storage", myStorageCallback, true);
D. function myStorageCallback( e ) {
alert("Key:" + e.key + " changed to " + e.newValue);
}
window.addEventListener("storage", myStorageCallback, false);
Correct Answer: A
Explanation/Reference:
The event object passed to the event handler includes the following properties:
. key: The name of the value which has changed.
. oldValue: The original value before the change.
. newValue: The new value.
. url: The document whose script is the origin of the event.
. storageArea: A reference to the store that has changed (session or local).
QUESTION 92
Application Cache are mainly informational. They can be used to determine the status of the cache and are
useful if the cache is behaving in an unexpected manner.
Which of following example shows how to catch the error event of the application cache:
A. applicationCache.addEventListener( "error", function() {
alert( "Error while downloading resources to the application cache");
}, false );
B. applicationCache.addEventListener( "errors", function() {
alert( "Error while downloading resources to the application cache");
}, true );
C. applicationCache.addEventListener( "error", function() {
alert( "Error while downloading resources to the application cache");
}, true );
D. Non of above
Correct Answer: C
QUESTION 93
Developers have had some ability to tailor styles to types of devices
<link rel="stylesheet" type="text/css" href="core.css" media="XXXXXX" />
Which of following can be used as media type ?
A. all or print or screen or speech
B. all or print or screen
C. all or print
D. all or screen
Correct Answer: A
QUESTION 94
What mean by SVG ?
A. screen and vector-based
B. scale and vector-based
C. scalable and vector-based
D. Non of the above
Correct Answer: C
QUESTION 95
Which model used by Canvas API
A. The Canvas API uses a "fill-and-forget" model.
B. The Canvas API uses a "fuild-and-forget" model.
C. The Canvas API uses a "file-and-forget" model.
D. The Canvas API uses a "fire-and-forget" model.
Correct Answer: D
QUESTION 96
Which of following is correct statement about web socket ?
A. Web socket-enabled web applications are only supported on all Internet Information Services versions
B. Web socket-enabled web applications are only supported on Internet Information Services 7
C. Web socket-enabled web applications are only supported on Internet Information Services 8
D. Non of the above
Correct Answer: C
QUESTION 97
You are validating user input by using JavaScript and regular expressions. A group of predefined regular
expressions will validate two input fields:
. An email address in a function named validateEmail . A nine-digit number that allows optional hyphens after
the second and fifth character in a function named validateSSN
You need to use the correct expression to validate the input. Which expression should you insert into each
function? (To answer, drag the appropriate regular expression statement to the correct location. Each regular
expression statement may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 98
You develop a webpage by using HTML5. You create the following markup and code: (Line numbers are
included for reference only.)
You need to ensure that the values that users enter are only numbers, letters, and underscores, regardless
of the order.
Which code segment should you insert at line 04?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
Explanation/Reference:
Example:
Sometimes situations arise when user should fill a single or more than one fields with alphabet characters
(A-Z or a-z) in a HTML form. You can write a JavaScript form validation script to check whether the required
field(s) in the HTML form contains only letters. - See more at:
http://www.w3resource.com/javascript/form/all-letters-field.php#sthash.5Db50Bdm.dpuf
Javascript function to check for all letters in a field view plainprint?
function allLetter(inputtxt)
{
var letters = /^[A-Za-z]+$/;
if(inputtxt.value.match(letters))
{
return true;
}
else
{
alert("message");
return false;
}
}
To get a string contains only letters (both uppercase or lowercase) we use a regular expression (/^[A-Za-z]
+$/) which allows only letters. Next the match() method of string object is used to match the said regular
expression against the input value. Here is the complete web document.
- See more at: http://www.w3resource.com/javascript/form/all-letters- field.php#sthash.5Db50Bdm.dpuf
QUESTION 99
You are developing a customer contact form that will be displayed on a page of a company's website.
The page collects information about the customer.
If a customer enters a value before submitting the form, it must be a valid email address.
You need to ensure that the data validation requirement is met.
What should you use?
A. <input name="email" type="url"/>
B. <input name="email" type="text" required="required"/>
C. <input name="email" type="text"/>
D. <input name="email" type="email"/>
Correct Answer: D
Explanation/Reference:
The HTML5 specification says that the email input type is designed to hold either a single email address or an
email address list.
<label for="email">Email contact</label>
<input type="email" name="email" id="email">
Mobile devices get the most benefit from this type of form field, because the virtual keyboard layouts change to
make entering email addresses easier.
QUESTION 100
DRAG DROP
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter.
The query string parameter must display the @ symbol that is used in the email address.
You need to implement this functionality.
How should you develop the form?
(To answer, drag the appropriate code segment to the correct target or targets in the answer area.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
E.
Correct Answer: AB
Explanation/Reference:
http://www.w3schools.com/jquery/ajax_serialize.asp
http://www.w3schools.com/jsref/jsref_encodeuri.asp
QUESTION 101
You are developing an application that consumes a Windows Communication Foundation (WCF) service.
The application interacts with the service by using the following code. (Line numbers are included for reference
only.)
You need to authenticate to the WCF service.
What should you do?
A. At line 11, add the following lines of code.
,username: yourusername
,password: yourpassword
B. At line 11, add the following line of code.
,credentials: prompt
C. At line 06, replace the code with the following line of code.
url: "http://contoso.com/Service.svc/GetCountry?
Username=username&password=psssword",
D. At line 11, add the following line of code. The username and password will be stored in an XML file.
,credentials: credentials.xml
Correct Answer: A
Explanation/Reference:
See Jquery ajax
password
Type: String
A password to be used in response to an HTTP access authentication request.
username
Type: String
A username to be used in response to an HTTP access authentication request.
QUESTION 102
You are developing a web page that enables customers to upload documents to a web server.
The page includes an HTML5 PROGRESS element named progressBar that displays information about the
status of the upload.
The page includes the following code. (Line numbers are included for reference only.)
An event handler must be attached to the request object to update the PROGRESS element on the page.
You need to ensure that the status of the upload is displayed in the progress bar.
Which line of code should you insert at line 03?
A. xhr.upload.onloadeddata =
B. xhr.upload.onplaying =
C. xhr.upload.onseeking =
D. xhr.upload.onprogress =
Correct Answer: D
Explanation/Reference:
http://www.html5rocks.com/en/tutorials/file/xhr2/
https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html
Mary-Q105/6. Annie-Q4
QUESTION 103
You are developing a customer web form that includes the following HTML.
<label id="txtValue"></label>
Information from the web form is submitted to a web service.
The web service returns the following JSON object.
{
"Confirmation": "1234",
"FirstName": "John"
}
You need to display the Confirmation number from the JSON response in the txtValue label field.
Which JavaScript code segment should you use?
A. $("#txtValue").val = (JSONObject.Confirmation);
B. $("#txtValue").val(JSONObject.Confirmation);
C. $("#txtValue").text = (JSONObject.Confirmation);
D. $("#txtValue").text(JSONObject.Confirmation);
Correct Answer: D
Explanation/Reference:
.val()
Get or set the current value of the first element in the set of matched elements or set the value of every
matched element.
The .val() method is primarily used to get the values of form elements such as input, select and textarea. In the
case of <select multiple="multiple"> elements, the .val() method returns an array containing each selected
option; if no option is selected, it returns null.
.text()
Get or set the combined text contents of each element in the set of matched elements, including their
descendants, or set the text contents of the matched elements.
.val() works on input elements (or any element with a value attribute?) and .text() will not work on input
elements. .val() gets the value of the input element -- regardless of type. .text() gets the innerText (not HTML)
of all the matched elements:
Unlike the .html() method, .text() can be used in both XML and HTML documents. The result of the .text()
method is a string containing the combined text of all matched elements. (Due to variations in the HTML
parsers in different browsers, the text returned may vary in newlines and other white space.) Consider the
following HTML:
http://api.jquery.com/val/
http://api.jquery.com/text/
Mary-Q106/7. Annie-Q5
QUESTION 104
HOTSPOT
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service using binary format if possible . Retrieve and parse the data
from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, select the
appropriate options from the drop-down lists in the answer area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 105
You are developing a customer web form that includes the following HTML.
<input id="txtValue" />
A customer must enter a value in the text box prior to submitting the form.
You need to add validation to the text box control.
Which HTML should you use?
A. <input id="txtValue" type="text" required="required"/>
B. <input id="txtValue" type="text" pattern="[A-Za-z]{3}" />
C. <input id="txtValue" type="required" />
D. <input id="txtValue" type="required" autocomplete="on" />
Correct Answer: A
Explanation/Reference:
We can ensure that a user has required a form field by adding the required attribute like this:
<label for="name">Name</label>
<input type="text" name="name" autofocus required id="name">
<input type="text" name="name" autofocus required="required" id="name">
Mary-Q108/9. Annie-Q6
QUESTION 106
DRAG DROP
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
. All runners must enter their age.
. Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
. The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements. What should you do? (To answer, drag the
appropriate word or number to the correct location in the answer area. Each word or number may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 107
You are creating a class named Consultant that must inherit from the Employee class.
The Consultant class must modify the inherited PayEmployee method.
The Employee class is defined as follows.
function Employee() {}
Employee.prototype.PayEmployee = function ( ){
alert('Hi there!');
}
Future instances of Consultant must be created with the overridden method.
You need to write the code to implement the Consultant class.
Which code segments should you use? (Each correct answer presents part of the solution. Choose two.)
A. Consultant.PayEmployee = function ()
{
alert('Pay Consulant');
}
B. Consultant.prototype.PayEmployee = function ()
{
alert('Pay Consultant');
}
C. function Consultant ()
{
Employee.call(this);
}
Consultant.prototype = new Employee();
Consultant.prototype.constructor = Consultant;
D. function Consultant() {
Employee.call(this);
}
Consultant.prototype.constructor = Consultant.create;
Correct Answer: BC
Explanation/Reference:
You can assign a different this object when calling an existing function. this refers to the current object, the
calling object.
With call, you can write a method once and then inherit it in another object, without having to rewrite the
method for the new object.
Mary-Q111/12. Annie-Q8
QUESTION 108
You are modifying an existing web page. The page is being optimized for accessibility. The current page
contains the following HTML.
Standards-compliant screen readers must be able to identify the links contained within the navigation structure
automatically.
You need to create the navigation link structure in the page.
With which container tags should you wrap the existing markup?
A. <navmap> </navmap>
B. <div id="nav"> </div>
C. <nav> </nav>
D. <map> </map>
Correct Answer: C
Explanation/Reference:
new elements
<header> Defines a header region of a page or section.
<footer> Defines a footer region of a page or section.
<nav> Defines a navigation region of a page or section.
<section> Defines a logical region of a page or a grouping of content.
<article> Defines an article or complete piece of content.
<aside> Defines secondary or related content.
Mary-Q112/13. Annie-Q9
QUESTION 109
HOTSPOT
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which lines of code should you use? (To answer, select
the appropriate options from the drop-down lists in the answer area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 110
HOTSPOT
You are developing an HTML5 web application for displaying encyclopedia entries.
Each encyclopedia entry has an associated image that is referred to in the entry.
You need to display the image by using the correct semantic markup.
What should you do? (To answer, select the appropriate options from the drop-down list in the answer area.)
A. figure, label, label, figure
B. figure, title, title, figure
C. figure, figcaption, figcaption, figure
D. cit, figcaption, figcaption, cit
Correct Answer: C
Explanation/Reference:
http://www.w3schools.com/tags/tag_figcaption.asp
QUESTION 111
HOTSPOT
An HTML page has a canvas element. You need to draw a red rectangle on the canvas element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, select the appropriate options from the drop- down lists
in the answer area.)
Correct Answer:
Explanation/Reference:
QUESTION 112
You are developing an HTML5 page that has an element with an ID of logo. The page includes the following
HTML.
<div>
Logo:<br>
<div id="logo">
</div>
</div>
You need to move the logo element lower on the page by five pixels.
Which lines of code should you use? (Each correct answer presents part of the solution. Choose two.)
A. document.getElementById("logo") .style.position = "relative";
B. document.getElementByld("logo").Style.top = "5px";
C. document.getElementById("logo").style.top = "-5px";
D. document.getElementById("logo").style.position = "absolute";
Correct Answer: AB
Explanation/Reference:
http://www.w3schools.com/cssref/pr_class_position.asp
http://www.w3schools.com/cssref/pr_pos_top.asp
QUESTION 113
You are developing a web page by using HTML5 and C5S3. The page includes a <div> tag with the ID set to
validate.
When the page is rendered, the contents of the <div> tag appear on a line separate from the content above and
below it.
The rendered page resembles the following graphic.
The page must be rendered so that the <div> tag is not forced to be separate from the other content.
The following graphic shows the correctly rendered output.
You need to ensure that the page is rendered to meet the requirement.
Which line of code should you use?
A. document.getElementById("validate").style.display = "inline";
B. document.getElementById("validate").style.margin = "0";
C. document.getElementById("validate").style.padding = "0";
D. document.getElementSyId("validate").style.display = "block";
Correct Answer: A
Explanation/Reference:
The display property specifies the type of box used for an HTML element.
inline Default. Displays an element as an inline element (like <span>)
block Displays an element as a block element (like <p>)
http://www.w3schools.com/cssref/pr_class_display.asp
Mary-Q119/20. Annie-Q13
QUESTION 114
HOTSPOT
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks. Which code segment should you use? (To
answer, select the appropriate option from the drop-down list in the answer area.)
A.
B.
C.
D.
Correct Answer:
QUESTION 115
You are creating a JavaScript function that displays the name of a web application. You declare the following
button element.
<input type="button" id= "About" value="About" />
When a user clicks the button, a JavaScript function named About must be called.
You need to create an event handler that calls the About function when the button is clicked.
Which two code segments can you use? (Each correct answer presents a complete solution. Choose two.)
A. var button = document.getElementById("About");
ScriptEngine.call(button, About());
B. var button = document.getElementById("About");
ScriptEngine.bind(button, About());
C. var button = document.getElementById("About");
button.addEventListener("click", About);
D. var button = document.getElementById("About");
button.attachEvent("onclick", About);
Correct Answer: CD
Explanation/Reference:
@guy
I have tested this myself.
IE10 supports addEventListener, but also attachEvent.
ScriptEngine will cause the About function to run on page load, not on button click.
attachEvent won't work on other browsers.
QUESTION 116
HOTSPOT
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in
the answer area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 117
You need to test the value of the following variable in JavaScript. var length = "75";
A block of code must execute if the length equals 75 regardless of the data type.
You need to use the statement that meets this requirement.
Which lines of code should you use? (Each correct answer presents a complete solution. Choose two.)
A. if (length = = = 75)
B. if (length = = 75)
C. if (length ! = 75)
D. if (length = = "75")
Correct Answer: BD
Explanation/Reference:
Altri dicono AB
QUESTION 118
You are developing an application that uses a third-party JavaScript library named doWork().
The library occasionally throws an "object is null or undefined" error with an error code of -2146823281.
The application must:
. Extract and handle the exceptions thrown by doWork()
. Continue normal program execution if other exceptions occur
You need to implement the requirements.
Which code segment should you use?
A. if( doWork() == -2146823281) {
...
}
B. if( doWork() == "object is null or undefined") {
...
}
C. try {
doWork();
} catch(e) {
if(e.number == -2146823281)
. ..
}
D. try {
doWork();
} catch(e) {
if(e.message == -2146823281)
. ..
}
Correct Answer: C
QUESTION 119
You are troubleshooting a web page that includes the following code. (Line numbers are included for reference
only.)
What is displayed in the alert from line 11?
A. Div
B. Function
C. Button
D. Document
Correct Answer: C
Explanation/Reference:
Mary-Q125/26. Annie-Q17
QUESTION 120
You are developing a web application that consumes services from a third-party application. A web worker
processes the third-party application requests in the background. A page in the application instantiates the web
worker process.
You need to establish two-way communications between the web worker process and the page.
Which two actions will achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A. From the web worker, use the onconnect event handler of the main page to capture events.
B. From the main page, use the onmessage event handler of the web worker to capture events.
C. From the web worker, use the onmessage event handler of the main page to capture events.
D. From the main page, use the onconnect event handler of the web worker to capture events.
Correct Answer: AC
Explanation/Reference:
@guy
there is a lot of buzz in this question.
some say answers are A and C, others, B and C.
After some though, and given we have a third party application making actual requests to the web worker, I
decided to set the web worker with the onconnect event handler.
HTML5 Developer's Cookbook,
http://books.google.pt/books?id=No4hLcrmvw8C&pg=PT419&lpg=PT419&dq=html5+onconnect+event
+handler&source=bl&ots=JI8socnoCz&sig=8qUyW608gu2NJvZLpPj75AIPIKw&hl=pt-
PT&sa=X&ei=SGbtUN6eAo6BhQfZkYH4BQ&ved=0CFMQ6AEwBA
http://www.w3schools.com/html/html5_webworkers.asp
http://www.w3.org/TR/workers/
http://tutorials.jenkov.com/html5/web-workers.html
QUESTION 121
You are developing an HTML5 web application that displays customer mailing address information.
The application loads addresses from a web service by using AJAX.
The following code defines a Customer object and loads address data.
You need to implement the loadAddress function.
Which code segment should you use?
A. $.get('data.xml', function (data) {
(function (scope) {
scope.parseAddress(data);
})(data);
});
B. $.get('data.xml', function (data, innerScope) {
innerScope.parseAddress(data);
});
C. var that = this;
$. get('data.xml', function (data) {
that.parseAddress(data);
}
D. $.get('data.xml', function (data) {
this.parseAddress(data);
}
Correct Answer: C
Explanation/Reference:
Note: The variable name that may change to Customer or any other name.
QUESTION 122
You are developing an HTML5 web page. The appearance of the text box must change when a user moves the
focus to another element on the page. You need to develop the page to respond to user action. Which line of
code should you use?
A. <input type="text" onblur="resetStyle(this);" />
B. <input type="text" onfocus="resetStyle(this);" />
C. <input type="text" onreset="resetStyle(this);" />
D. <input type="text" onselect="resetStyle(this);" />
Correct Answer: A
QUESTION 123
DRAG DROP
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 124
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
. Add a drop shadow that is one inch below the text in the paragraph
. Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 5px lin 0px;
C. text-shadow: 72pt 5em 0px
D. text-shadow:72pt 0em 5px;
Correct Answer: B
Explanation/Reference:
See http://www.w3.org/TR/css3-text/#text-shadow
QUESTION 125
You are creating a web form that users will use to enter their personal information. The form includes the
following HTML.
You have the following requirements:
When a user enters an input box, the cell on the right must turn green.
When a user leaves an input box, the ceil on the right must turn white.
You need to create the web form to meet these requirements.
Which code segment should you use?
Correct Answer: A
Explanation/Reference:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('table td:nth-child(2) input').focus(function() {
$(this).parent().next().css("background-color", "#00FF00");
});
$('table td:nth-child(2) input').blur(function() {
$(this).parent().next().css("background-color", "#FFFFFF");
});
});
</script>
</head>
<body>
<table>
<tr><td>Item</td><td>Input</td><td>Target</td></tr>
<tr><td>First Name</td><td><input type="text"/></td><td></td></tr>
<tr><td>Last Name</td><td><input type="text"/></td><td></td></tr>
</table>
</body>
</html>
Mary-Q131/32. Annie-Q22
QUESTION 126
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 127
DRAG DROP
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets.
The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets?
(To answer, move the style sheet types from the list of style sheet types to the answer area and arrange them
in the correct order.)
A. user important style sheets
author important style sheets
author normal style sheets
user normal style sheets
user agent style sheets
B. user agent style sheets
author normal style sheets
author important style sheets
user normal style sheets
user important sheets
C. user agent style sheets
user important sheets
user normal style sheets
author normal style sheets
author important style sheets
D. user agent style sheets
author normal style sheets
author important style sheets
user important sheets
user normal style sheets
Correct Answer: A
Explanation/Reference:
http://www.w3.org/TR/CSS21/cascade.html
from highest priority to lowest priority.
user important style sheets
author important style sheets
author normal style sheets
user normal style sheets
user agent style sheets
It is pretty clear in this article: http://www.quora.com/In-what-order-do-CSS-definitions-take-priority
CSS declarations are applied in this order (from lowest to highest priority):
. user agent declarations (the default styles your browser applies to elements)
. user normal declarations (a user's own stylesheet if they're using one)
. author normal declarations (this is your normal stylesheet)
. author important declarations (anything your mark important)
. user important declarations (any important styles from the user's stylesheet)
QUESTION 128
You are developing a web page by using HTML5.
You have the following requirements:
. An H1 element must be placed at the top left corner of the page.
. The size and location of the H1 element must not change if additional elements are added to the page.
You need to position the H1 element on the page.
Which CS53 style should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 129
HOTSPOT
You are developing a web page that will be accessed from various types of devices. You have the following
requirements:
. The appropriate display resolution must be selected dynamically based on the device connecting to the page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device. How should you build the code? (To answer, select the appropriate
options from the drop-down lists in the answer area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 130
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which values are valid for the text-transform property?
A. hidden
B. blink
C. capitalize
D. line-through
Correct Answer: C
Explanation/Reference:
Reference:
http://www.w3schools.com/cssref/pr_text_text-transform.asp none,capitalize,uppercase,lowercase and inherit
Example
Transform text in different elements:
h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}
QUESTION 131
DRAG DROP
You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new window.
Which jQuery code segment or segments should you use? (To answer, drag the appropriate line of code to the
correct location. Each line of code may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.)
Correct Answer:
Explanation/Reference:
QUESTION 132
You are developing a page that includes text and an illustration. The web page resembles the following image.
You have the following requirements:
. The illustration must be in the center of the page.
. The text must flow around the left, right, top, and bottom of the illustration.
You need to ensure that the layout of the web page meets the requirements.
Which line of code should you use?
A. -ms-wrap-side: both;
B. -ms-wrap-side: clear;
C. -ms-wrap-side: maximum;
D. -ms-wrap-side: auto;
Correct Answer: A
QUESTION 133
You are developing a web page that has a group of H1 and H2 elements. The page also includes a CSS class
named underlineMe.
You have the following requirements.
. The font color of all H1 and H2 elements must be changed to red.
. The CSS class underlineMe must be applied to all H1 and H2 elements.
You need to update the web page to meet the requirements.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
QUESTION 134
HOTSPOT
You are developing an HTML5 application for a company. You apply the following style to a DIV element on a
page.
You need to submit a draft illustration of the results of this code. Which illustration should you submit? (To
answer, select the appropriate illustration in the answer area.)
Correct Answer:
Explanation/Reference:
QUESTION 135
DRAG DROP
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
. The appropriate display resolution must be selected dynamically based on the device that is connecting to the
page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device. How should you build the code? (To answer, drag the appropriate media
statement to the correct location. Each media statement may be used once, more than once, or not at all. You
may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 136
DRAG DROP
You are developing a web page by using HTML5 and CSS3. Styles must be defined for all hyperlinks on the
page so that the applied style reflects the last user action.
You need to style the four anchor elements in the document.
In what order should you specify the four anchor selectors? (To answer, move the appropriate anchor selectors
from the list of CSS codes to the answer area and arrange them in the correct order.)
Correct Answer:
Explanation/Reference:
<<<Already in Correct order (link > Visited > Hover > Active)
You can learn about the anchor pseudo-classes here: http://www.w3schools.com/css/css_pseudo_classes.asp
As it states:
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!
QUESTION 137
You are developing a web page that will be divided into three vertical sections. The main content of the site will
be placed in the center section.
The two outer sections will contain advertisements.
You have the following requirements:
. The main content section must be set to two times the width of the advertising sections.
. The layout must be specified by using the CSS3 flexible box model.
You need to ensure that the visual layout of the page meets the requirements.
Which CSS3 property should you use?
A. box-orient
B. box-flex-group
C. box-flex
D. box-direction
Correct Answer: C
QUESTION 138
You are developing an HTML5 page. The page includes the following code.
The inner paragraph must be exactly 15 pixels from the top left corner of the outer paragraph. You set the left
style for the inner paragraph to the appropriate value.
You need to set the position property of the inner paragraph.
Which value should you use?
A. absolute
B. static
C. fixed
D. relative
Correct Answer: A
Explanation/Reference:
the answer seems to be absolute.
this question has been updated on the exam.
nested paragraphs is now html 5 valid.
look for question 70
QUESTION 139
You are developing a customer web form that includes the following HTML input field.
<input id="txtValue"/>
If a customer enters a value in the input field, then it must be a numeric value.
You need to add validation to the input field. Which HTML should you use?
A. <input id="txtValue" type-"text" pattern="/#" />
B. <input id="txtValue" type="number" />
C. <input id="txtValue" type="integer" />
D. <input id="txtValue" type="text" required="required"/>
Correct Answer: B
Explanation/Reference:
http://www.w3schools.com/tags/att_input_type.asp
Mary-Q146/47. Annie-Q32
QUESTION 140
You are developing a customer web form that includes the following HTML.
<input id="txtValue"/>
You need to change the HTML markup so that customers can enter only a valid three-letter country code.
Which HTML should you use?
A. <input id="txtValue" type="code" />
B. <input id="txtValue" type="text" pattern=" [A-Za-z] {3}" />
C. <input id="txtValue" type="text" required="required"/>
D. <input id="txtValue" type="country" />
Correct Answer: B
Explanation/Reference:
Reference:
http://www.w3schools.com/html5/att_input_pattern.asp
QUESTION 141
HOTSPOT
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter. The query string parameter
must display the @ symbol used in the email address.
You need to implement this functionality.
How should you develop the form? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Correct Answer:
Explanation/Reference:
QUESTION 142
You are developing a web page that consumes a Windows Communication Foundation (WCF) service. The
page includes the following code segment.
var xhr = new XMLHttpRequest() ;
The page uses the xhrHandler() method to listen for changes to the request status of the WCF service
calls. It uses the xmlToJavaScript() method to convert the response from the WCF service to a JavaScript
object.
The xhrHandler() method must be called automatically each time the request status changes.
You need to add the event handler to the request object.
Which line of code should you use?
A. xhr.onCallback = xhrHandler;
B. xhr.onreadystatechange = xhrHandler;
C. xhr.readyState = xhrHandler;
D. xhr.status = xhrHandler;
Correct Answer: B
Explanation/Reference:
Reference:
http://mrfwebdesign.blogspot.ca/2008/11/xmlhttprequest-xhr.html
QUESTION 143
DRAG DROP
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service by using binary format if possible . Retrieve and parse the data
from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, drag the
appropriate code segment to the correct location. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 144
You are developing an application that consumes an external web service that returns the latest stock rate.
The application has two methods:
The getResults() method makes an AJAX web service request
The ShowRate() method displays the stock rate from the web service response
You need to ensure that the ShowRate() method always displays the latest stock rate.
Which code segment should you use?
Correct Answer: D
Explanation/Reference:
Mary-Q153/54. Annie-Q37
QUESTION 145
DRAG DROP
You are developing an application that reads information from a file.
The application must:
. Execute a block of code if there is an error accessing the file
. Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate statements
from the list of actions to the answer area and arrange them in the correct order.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
try
catch(e)
finnaly
The fileopen statement is put within the try clause.
The catch(e) will catch a fileopen error.
The finally clause will be executed regardless of whether an error occurs in the try clause proceeding it
QUESTION 146
HOTSPOT
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer
area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 147
DRAG DROP
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number . The function must return "String" if the object is
a string . The function must return "Unknown" if the object is neither a number nor a string You need to
implement the function to meet the requirements. How should you build the code segment? (To answer, drag
the appropriate word to the correct location in the code segment. Each word may be used once, more than
once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 148
You are testing the value of the following variable in JavaScript.
var height = "300";
A block of code must execute if the following conditions are true:
- The height variable is set to 300
- The height variable is of type string
You need to implement the code to run the test.
Which line of code should you use?
A. if (height == 300)
B. if (height === "300")
C. if (height ! "300")
D. if (height != 300)
Correct Answer: B
Explanation/Reference:
It should be if (height == "300") but s it is appearing as if (height ===
"300")
QUESTION 149
DRAG DROP
You are developing an application for an online retailer. The company ships only to certain
countries.
The application must:
Store a list of country codes in an array
Validate the country code of the shipping address against the countries array
Include a Boolean value in the array that indicates whether or not you can ship to the country
Display a list of countries that can be shipped to if the user inputs a code for a country that the
retailer cannot ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code
segment or segments from the list of code segments to the correct location or locations in the work
area. Each code segment may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.)
Correct Answer:
Explanation/Reference:
QUESTION 150
DRAG DROP
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker;
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, drag the appropriate line or lines of code to the correct location
or locations. Each line of code may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 151
You are developing a web application that uses web workers to process images extracted from an HTML5
CANVAS object on a web page.
You need to pass messages between the web workers and the web page.
Which three types of objects should you use? (Each correct answer presents a complete solution. Choose
three.)
A. JSON
B. Window
C. Parent
D. String
E. JavaScript
F. DOM
Correct Answer: ADE
Explanation/Reference:
You can load external script files or libraries into a worker with the importScripts() function
Workers do NOT have access to:
The DOM (it's not thread-safe)
The window object
The document object
The parent object
QUESTION 152
DRAG DROP
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use? (To answer, drag the appropriate command or commands from the
list of commands to the correct location or locations in the work area. Each line of code may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer:
QUESTION 153
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <nav>
B. <article>
C. <span>
D. <div>
Correct Answer: B
Explanation/Reference:
http://www.w3schools.com/tags/tag_article.asp
http://www.w3schools.com/html/html5_new_elements.asp
You may get option as <section> also
article or section
QUESTION 154
You are developing an HTML5 web application for a surveyor company that displays topographic images. The
application must:
. Display the topographic images at different zoom levels without loss of detail . Print the topographic images
without loss of detail . Work from only one source file for each topographic image
You need to ensure that the topographic images display according to the requirements.
Which HTML5 element should you use?
A. SVG
B. CANVAS
C. SAMP
D. AREA
Correct Answer: B
QUESTION 155
DRAG DROP
An HTML page has a CANVAS element. You need to draw a red rectangle on the CANVAS element
dynamically. The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Correct Answer:
Explanation/Reference:
QUESTION 156
You are modifying a website. The body of the page will be divided into two sections:
. A content section will contain blog posts and comments. . An area on the right-hand side will contain
advertisements.
The page is defined by the following HTML.
The site must conform to HTML5 standards and must use HTML5 semantic tags. You need to ensure that the
advertisements are on the rightmost section of the page. Which tag should you use?
A. <aside>
B. <div>
C. <article>
D. <footer>
Correct Answer: A
QUESTION 157
DRAG DROP
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. Throw new Error(200,"Invalid")
B.
C.
D.
Correct Answer: A
QUESTION 158
HOTSPOT
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer
area.)
A. throw new Error(200,"Invalid")
B.
C.
D.
Correct Answer: A
QUESTION 159
You are validating user input by using JavaScript and regular expressions. A group of predefined regular
expressions will validate two input fields:
. An email address in a function named validateEmail
. A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN
You need to use the correct expression to validate the input. Which expression should you insert into each
function? (To answer, drag the appropriate regular expression statement to the correct location. Each regular
expression statement may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 160
You are developing a form that captures a user's email address by using HTML5 and jQuery. The form must
capture the email address and return it as a query string parameter. The query string parameter must display
the @ symbol that is used in the email address. You need to implement this functionality.
How should you develop the form? (To answer, drag the appropriate code segment to the correct target or
targets in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 161
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service using binary format if possible
. Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, select the
appropriate options from the drop-down lists in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 162
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
All runners must enter their age.
Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in the answer
area. Each word or number may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
step="any" or any positive floating-point number.
Mary-Q2/72,Q109/10. Annie-Q48
QUESTION 163
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which lines of code should you use? (To answer, select
the appropriate options from the drop-down lists in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 164
You are developing an HTML5 web application for displaying encyclopedia entries. Each encyclopedia entry
has an associated image that is referred to in the entry. You need to display the image by using the correct
semantic markup. What should you do? (To answer, select the appropriate options from the drop-down list in
the answer area.)
A.
Correct Answer:
Explanation/Reference:
QUESTION 165
An HTML page has a canvas element. You need to draw a red rectangle on the canvas element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, select the appropriate options from the drop- down lists
in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 166
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker:
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks. Which code segment should you use? (To
answer, select the appropriate option from the drop-down list in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 167
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, select the appropriate options from the drop-down lists in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 168
You are developing an application that uses a third-party JavaScript library named doWork(). The library
occasionally throws an "object is null or undefined" error with an error code of -2146823281.
The application must:
. Extract and handle the exceptions thrown by doWork()
. Continue normal program execution if other exceptions occur
You need to implement the requirements. Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
QUESTION 169
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements. How should you write the code? (To answer, drag the
appropriate code segment or segments to the correct location in the answer area. Each code segment may be
used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view
content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 170
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
. Add a drop shadow that is one inch below the text in the paragraph
. Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements. Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 5px 1in 0px;
C. text-shadow: 72pt 5em 0px
D. text-shadow:72pt 0em 5px;
Correct Answer: B
QUESTION 171
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets. The styles are not being applied correctly to the pages in the application. You need to apply the styles
from highest priority to lowest priority. In which order should you use the five style sheets? (To answer, move
the style sheet types from the list of style sheet types to the answer area and arrange them in the correct order.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 172
You are developing a web page by using HTML5. You have the following requirements:
. An H1 element must be placed at the top left corner of the page.
. The size and location of the H1 element must not change if additional elements are added to the page.
You need to position the H1 element on the page. Which CSS3 style should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 173
You are developing a web page that will be accessed from various types of devices. You have the following
requirements:
. The appropriate display resolution must be selected dynamically based on the device connecting to the page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device. How should you build the code? (To answer, select the appropriate
options from the drop-down lists in the answer area.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 174
You are developing an HTML5 web application and are styling text. You need to use the text- transform CSS
property. Which values are valid for the text-transform property?
A. hidden
B. blink
C. lowercase
D. line-through
Correct Answer: A
QUESTION 175
You are developing a website that has many web pages with hyperlinks to other sites. You need to ensure that
if a hyperlink contains an image, the linked web page opens in a new window. Which jQuery code segment or
segments should you use? (To answer, drag the appropriate line of code to the correct location. Each line of
code may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 176
You are developing a web page that has a group of HI and H2 elements. The page also includes a CSS class
named underlineMe. You have the following requirements.
. The font color of all HI and H2 elements must be changed to red.
. The CSS class underlineMe must be applied to all HI and H2 elements.
You need to update the web page to meet the requirements. Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
QUESTION 177
You are developing an HTML5 application for a company. You apply the following style to a DIV element on a
page.
You need to submit a draft illustration of the results of this code. Which illustration should you submit? (To
answer, select the appropriate illustration in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 178
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
. The appropriate display resolution must be selected dynamically based on the device that is connecting to the
page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct location. Each
media statement may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 179
You are developing a web page by using HTML5 and CSS3. Styles must be defined for all hyperlinks on the
page so that the applied style reflects the last user action. You need to style the four anchor elements in the
document. In what order should you specify the four anchor selectors? (To answer, move the appropriate
anchor selectors from the list of CSS codes to the answer area and arrange them in the correct order.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 180
You are developing a customer web form that includes the following HTML input field.
<input id="txtValue"/>
If a customer enters a value in the input field, then it must be a numeric value.
You need to add validation to the input field.
Which HTML should you use?
A. <input id="txtValue" type-"text" pattern="/#" />
B. <input id="txtValue" type="number" />
C. <input id="txtVa!ue" type="integer" />
D. <input id="txtValue" type="text" required="required"/>
Correct Answer: B
Explanation/Reference:
Reference:
http://www.w3schools.com/html/html5_form_input_types.asp
QUESTION 181
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service by using binary format if possible
. Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, drag the
appropriate code segment to the correct location. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 182
You are developing an application that reads information from a file.
The application must:
Execute a block of code if there is an error accessing the file
Execute a second block of code whether or not there is an error accessing
the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate
statements from the list of actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
The fileopen statement is put within the try clause.
The catch(e) will catch a fileopen error.
The finally clause will be executed regardless of whether an error occurs in the try clause
proceeding it
QUESTION 183
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
Generate an error
Assign "200" to the error number
Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to
the correct location in the answer area. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/html/html5_new_elements.asp
QUESTION 184
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number
. The function must return "String" if the object is a string
. The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 185
You are testing the value of the following variable in JavaScript.
var height = "300";
A block of code must execute if the following conditions are true:
The height variable is set to 300
The height variable is of type string
You need to implement the code to run the test.
Which line of code should you use?
A. if (height = = 300)
B. if (height = = "300")
C. if (height ! "300")
D. if (height ! = 300)
Correct Answer: B
Explanation/Reference:
Use = = to test for equality.
Use "300" to test for the string.
QUESTION 186
You are developing an application for an online retailer. The company ships only to certain countries. The
application must:
. Store a list of country codes in an array
. Validate the country code of the shipping address against the countries array
. Include a Boolean value in the array that indicates whether or not you can ship to the country
. Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to
You need to develop the application to meet the requirements. Which code segment or segments should you
use? (To answer, drag the appropriate code segment or segments from the list of code segments to the correct
location or locations in the work area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 187
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker;
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks. Which line of code should you use? (To answer,
drag the appropriate line or lines of code to the correct location or locations. Each line of code may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 188
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which line or lines of code should you use? (To
answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area. Each line of code may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
show
A.
Correct Answer: A
Explanation/Reference:
QUESTION 189
An HTML page has a CANVAS element. You need to draw a red rectangle on the CANVAS element
dynamically. The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 190
You are developing an HTML5 web application and are styling text.
You need to use the text- transform CSS property.
Which values are valid for the text-transform property?
A. hidden
B. blink
C. lowercase & UpperCase
D. line-through
Correct Answer: C
QUESTION 191
You are developing an HTML5 web application and are styling text.
You need to use the CSS property.
Which value is valid for the text-transform property?
A. Lowercase
B. Blink
C. Line-through
D. 20px
Correct Answer: A
Explanation/Reference:
Property Value: none, capitalize, uppercase, lowercase, initial, inherit
QUESTION 192
72-DRAG DROP You are developing a web page for runners who register for a race. The page includes a
slider control that allows users to enter their age.
You have the following requirements:
* All runners must enter their age.
* Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
* The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in the answer
area.
Each word or number may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 193
73-You are creating a JavaScript object that represents an employee. You need to extend the Employee object
by adding the GetPayroll() method. You need to ensure that all future instances of the Employee object
implement the GetPayroll() method. Which code segment should you use?
Correct Answer: D
QUESTION 194
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
Add a drop shadow that is one inch below the text in the paragraph
Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. Text-shadow: 72pt 0pt 5pt
B. Text-shadow: 5px lin 0px;
C. Text-shadow: 72pt 0em 5px;
D. Text-shadow: 100px 0px 5px;
Correct Answer: B
Explanation/Reference:
We set the second argument (vertical) to one inch (1in).
Note
Syntax
text-shadow: h-shadow v-shadow blur color;
Note: The text-shadow property attaches one or more shadows to text. The property is a comma-
separated list of shadows, each specified by 2 or 3 length values and an optional color. Omitted lengths are
0.
* h-shadow
Required. The position of the horizontal shadow. Negative values are allowed
* v-shadow
Required. The position of the vertical shadow. Negative values are allowed
* blur
Optional. The blur distance
* color
Optional. The color of the shadow.
QUESTION 195
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. Capitalize
B. Red
C. 20px
D. Italic
Correct Answer: A
Explanation/Reference:
Reference:
http://www.w3schools.com/cssref/pr_text_text-transform.asp none,capitalize,uppercase,lowercase and
inherit
Example
Transform text in different elements:
h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}
QUESTION 196
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <article>
B. <table>
C. <div>
D. <span>
Correct Answer: A
Explanation/Reference:
The <article> tag specifies independent, self-contained content.
An article should make sense on its own and it should be possible to distribute it independently from the
rest of the site.
Potential sources for the <article> element:
Forum post
Blog post
News story
Comment
QUESTION 197
You are developing an HTML5 page that has an element with an ID of picture. The page includes the
following HTML.
You need to move the picture element lower on the page by five pixels.
Which two lines of code should you use? (Each correct answer presents part of the solution.
Choose two.)
A. document.getEIementById("picture").style.position = "relative";
B. document.getElementById("picture").style.top = "5px";
C. document.getEiementById("picture").style.top = "-5px";
D. document.getEIementById("picture").style.position = "absolute";
Correct Answer: AB
Explanation/Reference:
We use relative position to move the position 5 pixels lower on page.
Using a negative value would move the picture higher on the page.
Note:
* The top property sets or returns the top position of a positioned element.
This property specifies the top position of the element including padding, scrollbar, border and margin.
Syntax
Set the top property:
Object.style.top="auto|length|%|inherit"
Where:
Length defines the top position in length units. Negative values are allowed
QUESTION 198
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <section>
B. <tbody>
C. <div>
D. <table>
Correct Answer: A
Explanation/Reference:
The <section> tag defines sections in a document. Such as chapters, headers, footers, or any other
sections of the document.
QUESTION 199
79-You are developing a customer web form that includes the following HTML. <input id="txtValue"/>
You need to change the HTML markup so that customers can enter only a valid three-letter country code.
Which HTML should you use?
A. <input id="txtValue" type="country"/>
B. <input id="txtValue" type="text" required="xxx"/>
C. <input id="txtVa!ue" type="text" pattern-" [A-Za-z] {3} "/>
D. <input id="txtValuen type="code" pattern"="country"/>
Correct Answer: C
QUESTION 200
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. Capitalize
B. Hidden
C. Italic
D. Line-through
Correct Answer: A
Explanation/Reference:
Reference:
http://www.w3schools.com/cssref/pr_text_text-transform.asp none,capitalize,uppercase,lowercase and
inherit
Example
Transform text in different elements:
h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}
QUESTION 201
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. Italic
B. Line-through
C. Capitalize
D. 20px
Correct Answer: C
Explanation/Reference:
Reference:
http://www.w3schools.com/cssref/pr_text_text-transform.asp none,capitalize,uppercase,lowercase and
inherit
Example
Transform text in different elements:
h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}
QUESTION 202
You are modifying a blog site to improve search engine readability. You need to group relevant page
content together to maximize search engine readability.
Which tag should you use?
A. <tbody>
B. <article>
C. <div>
D. <span>
Correct Answer: B
Explanation/Reference:
The <article> tag specifies independent, self-contained content.
An article should make sense on its own and it should be possible to distribute it independently from the
rest of the site.
Potential sources for the <article> element:
Forum post
Blog post
News story
Comment
QUESTION 203
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <span>
B. <nav>
C. <cable>
D. <section>
Correct Answer: D
Explanation/Reference:
The <section> tag defines sections in a document. Such as chapters, headers, footers, or any other
sections of the document.
QUESTION 204
You are developing an HTML5 web application and are styling text.
You need to use the CSS property.
Which value is valid for the text-transform property?
A. red
B. hidden
C. lowercase
D. italic
Correct Answer: C
Explanation/Reference:
Property Value: none, capitalize, uppercase, lowercase, initial, inherit
QUESTION 205
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. lowercase
B. 20px
C. line-through
D. italic
Correct Answer: A
Explanation/Reference:
Property Value: none, capitalize, uppercase, lowercase, initial, inherit
QUESTION 206
86-DRAG DROP You are creating an application by using HTML5 and CSS3. The styles for the pages are
derived from five style sheets.
The styles are not being applied correctly to the pages in the application.
You need to determine the order in which the style sheets will be applied by the browser.
In which order will the five style sheets be applied? (To answer, move the style sheet types from the list of style
sheet types to the answer area and arrange them in the order that they will be applied.)
Select and Place:
Correct Answer:
Explanation/Reference:
The order of declarations from least important to most important:
QUESTION 207
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. Italic
B. Red
C. Capitalize
D. Line-through
Correct Answer: C
Explanation/Reference:
Reference:
http://www.w3schools.com/cssref/pr_text_text-transform.asp none,capitalize,uppercase,lowercase and
inherit
Example
Transform text in different elements:
h1 {text-transform:uppercase;}
h2 {text-transform:capitalize;}
p {text-transform:lowercase;}
QUESTION 208
You develop an HTML5 webpage. You have the following HTML markup: (Line numbers are for reference
only.)
The webpage also contains the following CSS markup:
You need to determine how the webpage will appear when the CSS styles are applied.
Select two.
A. The first row of the table will have a red background.
B. The second row of the table will have a red background.
C. The second cell in the first row of the table will have a blue background.
D. The second cell in the third row of the table will have a blue background.
E. The second cell in the third row of the table will have not have blue background.
Correct Answer: AE
Explanation/Reference:
QUESTION 209
89-HOTSPOT You are reviewing the CSS markup for an HTML5 page that displays a news article. The CSS
markup for the page is as follows:
The HTML markup for the page is as follows:
For each statement in the table, select Yes if the code segments above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 210
90-HOTSPOT You review code that uses WebSockets for a browser-based multiplayer game. Each player
sends a move to the server, which then sends the move to all connected game instances. The following code
runs in the browser and handles the sending and receiving of moves:
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 211
91-You develop a webpage. The webpage must display a grid that contains one row and five columns.
Columns one, three, and five are the same width. Columns two and four are the same width, but much wider
than columns one, three, and five. The grid resembles the following image:
The grid must meet the following requirements: Each row must be tall enough to ensure that images are not cut
off. Each row must contain five columns. The width of the columns must not change when the screen is resized
or rotated. You need to define the style for the grid. Which CSS3 style should you use?
Correct Answer: C
QUESTION 212
92-You implement an application by using HTML5 and JavaScript. You create a webpage that contains the
following HTML:
The application must place a border on only the first UL element that is contained in the DIV element. You need
to update the webpage. What should you do?
Correct Answer: D
QUESTION 213
93-You troubleshoot a webpage that contains the following HTML element: <canvas id= "clickCanvas"
width-"300"> height= "300">
Your browser does not support the HTML5 canvas.</canvas>
The following JavaScript code is included in a script tag in the HEAD section of the webpage: (Line numbers
are included for reference only.)
You need to invoke the clickReporter() JavaScript function when a user clicks the mouse on the canvas HTML
element. What should you do?
A. Add the following attribute to the canvas HTML element: clicked= "clickReporter()"
B. Replace the code segment at line 06 with the following code segment: drawBox.Click += clickReporter;
C. Insert the following code segment at line 07: canvas.onclick = clickReporter;
D. Insert the following code segment at line 07: canvas, click = clickReporter;
Correct Answer: B
QUESTION 214
94-You are implementing an application by using HTML5 and JavaScript. A web page contains the following
HTML table.
The application must:
* Identify all rows in the table body that have a class attribute of selected
* Exclude the last selected row in the table
You need to implement the web page according to the requirements.
Which CSS selector should you use?
A. tr:not(tr:last-child).selected < #dataTable
B. #dataTable > tr.selected:not(tr:last-child)
C. #dataTable tbody tr.selected:not(tr:last-child)
D. #dataTable tr.selected:not(tr:last-child)
Correct Answer: C
QUESTION 215
You create an application that sends information to a web service by using the following code: (Line numbers
are included for reference only.)
When the web service returns a non-zero result code, you must raise an exception that contains the result
code.
You need to implement the code that generates the exception.
Which line of code should you insert at line 04?
A. CustomError.prototype = Error.prototype;
B. CustomError["ErrorType"] = Error;
C. CustomError.customError = true;
D. Error-constructor = CustomError;
Correct Answer: A
Explanation/Reference:
The prototype property allows you to add properties and methods to an object.
http://www.w3schools.com/jsref/jsref_prototype_math.asp
http://sporto.github.io/blog/2013/02/22/a-plain-english-guide-to-javascript-prototypes/
Mary-Q25/95
QUESTION 216
96-You are developing a customer web form that includes following HTML. <input id= "textAccountType"/>
You need to develop the form so that customers can enter only a valid account type consisting of two English
alphabet characters.
Which code segment should you use?
Correct Answer: B
QUESTION 217
97-You are developing an application that uses a JavaScript library. The library contains the following
functions.
The application uses the following code. (Line numbers are included for reference only.)
The library may throw many types of exceptions. The exceptions are grouped by category.
You need to catch and identify the exceptions by group.
Which code segment should you insert at line 05?
Correct Answer: B
QUESTION 218
98-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript variable defined: var languages = [];
You need to add statements to an existing JavaScript function to sort the list items. Which four actions should
you perform in sequence? (Develop the solution by selecting the required code segments and arranging them
in the correct order.)
Select and Place:
Correct Answer:
QUESTION 219
99-DRAG DROP You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment: var jsonFruit = { "apples" : "12", "bananas" : "8",
"watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 220
100-DRAG DROP You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
* Create an object that represents an image that will be displayed.
* Set the image properties from the values that are returned by the web service.
* Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 221
101-HOTSPOT You develop an HTML messaging application that allows users to send messages. The
messages can have an optional file attachment that is identified by a filename. You use the following function to
send a message:
You need to send a message with a file attachment. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 222
102-DRAG DROP You develop an HTML application that calls a web service to retrieve JSON data. The web
service contains one method named GetFullName that returns an Object named data. The data object contains
two properties named GivenName and Surname. You need to load data from the web service to the webpage.
How should you complete the relevant code? (To answer, drag the appropriate code segment or code
segments to the correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 223
103-DRAG DROP A company asks you to create a function that displays loan amounts to their customers.
You must create the function by using JavaScript to meet the following requirements:
* Display three different loan amounts to each customer.
* Display loan amounts in order starting with the greatest amount and ending with the least amount.
You need to implement the function. How should you complete the relevant code? (To answer, drag the
appropriate command or commands to the correct location or locations in the answer area. Use only
commands that apply.)
Select and Place:
Correct Answer:
QUESTION 224
104-HOTSPOT You develop an HTML5 application that allows images to be dragged and dropped within a
webpage. The webpage contains a DIV element and four IMG elements as defined in the code segment below:
You need to enable drag and drop for the application. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 225
105-DRAG DROP You are creating a function named getText().
The function must retrieve information from text files that are stored on a web server. You need to develop the
function to meet the requirement. Which code segment or segments should you use? (To answer, drag the
appropriate command from the list of commands to the correct location or locations in the work area. Each
code segment may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 226
106-DRAG DROP
You are developing an application for a retail store. The application will be used on mobile devices to provide
real-time directions to the store.
You have the following requirements:
* The application must find out a user's location.
* As the user moves, the application must update the screen with the new location.
* As the user moves, the application must display the user's speed. You need to develop the application to meet
the requirements. Which code segment or segments should you use? (To answer, drag the appropriate code
segment or segments to the correct location in the work area. Each code segment may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 227
107-HOTSPOT You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows.
The first row spans the entire width of the page and is labeled #Top.
The second row contains three columns.
The first column is labeled #Left; the second column is labeled #Main; and the right column is labeled #Right.
The #Left and #Right columns are a fixed width.
The #Main column occupies the remaining available space.
The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout. How should you complete the relevant styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 228
108-DRAG DROP You develop an HTML application that calls a Simple Object Access Protocol (SOAP) web
service to retrieve data. You need to load data from the web service. What should you do? (To answer, drag
the appropriate code segment or code segments to the correct location or locations in the answer area. Use
only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 229
109-HOTSPOT You are creating a custom style by using CSS3.
You have the following requirements to complete the style:
* If the text in a line must wrap to another line, the last word must be able to break across lines.
* All text must be black and have a blue shadow, such that the text appears to glow blue.
The text must look like the following:
You need to complete the CSS3 style. How should you complete the relevant code? (To answer, select the
appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 230
110-HOTSPOT You are developing a web page. The webpage must display a container. The container must
display three colored rectangles near the top of the container. The colored rectangles are, in order, green, red,
and yellow. The rectangles are aligned horizontally and evenly spaced across the width of the container. The
layout of the page must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant styles? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 231
111-DRAG DROP You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
* Display the message Denied! If the PaymentAmount variable is greater than 500.
* Display the message Approved! If the PaymentAmount variable is less than 300.
* Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater than
300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 232
112-DRAG DROP You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page. The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page. How should you create the JavaScript
code? (Develop the solution by selecting the required code segments and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
QUESTION 233
113-HOTSPOT You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 234
114-HOTSPOT You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 235
An HTML page contains no embedded JavaScript or CSS code. The body of the page contains only the
following line of code.
<p id="test">test</p>
A CSS style sheet must be applied dynamically. The style must visibly change the appearance of the paragraph
on the page.
You need to apply a style the paragraph. Which line of code should you use?
A. document.getElementById("test").style.border = "0";
B. document.getElementById("test").style.position = "static";
C. document.getElementById("test").style.padding = "15px";
D. document.getElementById("test").style.top = "5px";
Correct Answer: C
Explanation/Reference:
only (C) moves the text, other options have no effect.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function changeVisibly() {
document.getElementById("test").style.padding = "15px";
}
</script>
</head>
<body>
<p id="test">test</p>
<input type="button" value="Change visibly" onclick="changeVisibly();" />
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------
Mary: Answer A (border)
cch from New Zealand - Oct 15, 2013:
The answer given in the dump is ~.style.border = '0', as the question's already mentioned no other js & css
embedded, i don't think set border = '0' can change the <p> visibly. so the answer C: set style.padding = '15px'
will at least have some change visibly, I think
Mary-Q45/115
QUESTION 236
116-You develop an HTML5 web application. The web application contains a form that allows users to enter
only their month of birth.
The value that the users enter must be numbers between 1 and 12, inclusive.
You need to implement the form element for the month of birth. Which element should you use?
A. <input type="time" options="month" />
B. <input types="submit" value="month" />
C. <input type="range" min="l" max="12" />
D. <input type="month" itemscope="numeric" />
Correct Answer: C
QUESTION 237
You are developing an HTML5 web application for an architectural company that displays architectural
blueprints.
The application must:
Display the blueprints at different zoom levels without loss of detail
Print the blueprints without loss of detail
Work from only one source file per blueprint
You need to ensure that blueprints display according to the requirements.
Which HTML5 element should you use?
A. CANVAS
B. SAMP
C. SVG
D. AREA
Correct Answer: C
Explanation/Reference:
SVG is a language for describing two-dimensional vector graphics in XML.
SVG stands for Scalable Vector Graphics
SVG is used to define vector-based graphics for the Web
SVG defines the graphics in XML format
SVG graphics do NOT lose any quality if they are zoomed or resized
Every element and every attribute in SVG files can be animated
SVG is a W3C recommendation
SVG integrates with other W3C standards such as the DOM and XSL
Advantages of using SVG over other image formats (like JPEG and GIF) are:
SVG images can be created and edited with any text editor
SVG images can be searched, indexed, scripted, and compressed
SVG images are scalable
SVG images can be printed with high quality at any resolution
SVG images are zoomable (and the image can be zoomed without degradation)
SVG is an open standard
SVG files are pure XML
The main competitor to SVG is Flash.
The biggest advantage SVG has over Flash is the compliance with other standards (e.g. XSL and the DOM).
Flash relies on proprietary technology that is not open source.
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/
SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
</svg>
The <samp> tag is a phrase tag. It defines sample output from a computer program.
Tip: This tag is not deprecated, but it is possible to achieve richer effect with CSS.
<canvas> element is used to draw graphics, on the fly, via scripting (usually JavaScript).
The <canvas> element is only a container for graphics. You must use a script to actually draw the graphics.
Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
The <area> tag defines an area inside an image-map (an image-map is an image with clickable areas).
The <area> element is always nested inside a <map> tag.
http://www.w3schools.com/svg/svg_intro.asp
http://www.w3schools.com/html/html5_canvas.asp
http://www.w3schools.com/tags/tag_samp.asp
http://www.w3schools.com/tags/tag_area.asp
Mary-Q47/117
QUESTION 238
You develop an HTML5 application that allows users to upload files from their local computers.
The user interface must remain responsive during the upload.
You need to implement the file upload functionality for the application.
Which two actions should you perform? (Each correct answer presents a complete solution. Choose two.)
A. Use an HTML form with a file type INPUT element that targets a hidden IFRAME element.
B. Use a file type INPUT element, and then use the Web Storage API to upload the file.
C. Use a FormData object and upload the file by using XMLHttpRequest.
D. Register the file protocol by using protocol handler registration API and then upload the file by using
XMLHttpRequest.
E. Use the FileSystem API to load the file, and then use the jQuery post method to upload the file to the
server.
Correct Answer: CE
Explanation/Reference:
Input type="file"
The FileUpload object represents a single-line text input control and a browse button, in an HTML form.
This object allow file uploading to a server. Clicking on the browse button opens the file dialog box that allows a
user to select a file to upload.
For each <input type="file"> tag in an HTML form, a FileUpload object is created.
Web Storage
With HTML5, web pages can store data locally within the user's browser.
Earlier, this was done with cookies. However, Web Storage is more secure and faster. The data is not included
with every server request, but used ONLY when asked for. It is also possible to store large amounts of data,
without affecting the website's performance.
The data is stored in key/value pairs, and a web page can only access data stored by itself.
There are two new objects for storing data on the client:
localStorage - stores data with no expiration date
sessionStorage - stores data for one session
FormData
The FormData object lets you compile a set of key/value pairs to send using XMLHttpRequest. Its primarily
intended for use in sending form data, but can be used independently from forms in order to transmit keyed
data. The transmitted data is in the same format that the form's submit() method would use to send the data if
the form's encoding type were set to "multipart/form-data"
XMLHttpRequest
The XMLHttpRequest object is used to exchange data with a server behind the scenes.
The following code fragment parses an XML document into an XML DOM object. To send a request to a
server, we use the open() and send() methods of the XMLHttpRequest object:
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "books.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
open(method, url, async) - Specifies the type of request, the URL, and if the request should be handled
asynchronously or not.
method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
send(string) - Sends the request off to the server.
string: Only used for POST requests
Protocol handler registration API
It's fairly common to find web pages link to resources using non-http protocols. An example is the mailto:
protocol:
<a href="mailto:webmaster@example.com">Web Master</a>
Web authors can use a mailto: link when they want to provide a convenient way for users to send an email,
directly from the webpage. When the link is activated, the browser should launch the default desktop application
for handling email. You can think of this as a desktop-based protocol handler.
Web-based protocol handlers allow web-based applications to participate in the process too. This is becoming
more important as more types of applications migrate to the web. In fact, there are many web-based email
handling applications that could process a mailto link.
navigator.registerProtocolHandler("mailto", "https://www.example.com/?uri=%s",
"Example Mail");
FileSystem API
There are two versions of the FileSystem API. One for synchronous calls and another for asynchronous
calls.Whilst it is sometimes useful to have the ability to execute operations synchronously, you will usually want
to use the asynchronous API so that you don't hold up any other code that needs to be executed.
jQuery Post
The $.post() method loads data from the server using a HTTP POST request.
http://www.w3schools.com/jsref/dom_obj_fileupload.asp
http://www.w3schools.com/html/html5_webstorage.asp
https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects
http://www.w3schools.com/xml/xml_http.asp
https://developer.mozilla.org/en/docs/Web-based_protocol_handlers
http://blog.teamtreehouse.com/building-an-html5-text-editor-with-the-filesystem-apis
http://www.html5rocks.com/en/tutorials/file/filesystem/
----------------------------------------------------------------------------------------------------------------------------
Mary&Sam: Answer B&D
cch from New Zealand - Oct 15, 2013:
I have no idea which two should be chosen, but at least the B seems not right to me, because web storage API,
localStorage/sessionStorage has nothing to do with the responsive requirement.
Mary-Q48/118
QUESTION 239
119-You are developing a web application that can function when users are not connected to the Internet.
You need to check the Internet connectivity status of a user's browser.
Which method should you use?
Correct Answer: A
QUESTION 240
You are creating a page that contains detailed employee information for a company portal. The page uses a
jQuery library.
The page contains a hidden button named btnEdit that is defined by the following code.
<button id="btnEdit" style="display: none;">Edit</button>
The button is not displayed by default. The button must be displayed only if the user is logged on. You need to
add code to the document.ready() function to meet the requirements for the button. Which line of code should
you use?
A. $ ('#btnEdit').appear();
B. $ ('#btnEdit').visible = true;
C. $ ('#btnEdit').show();
D. $ ('#btnEdit').visible();
Correct Answer: C
Explanation/Reference:
The show() method shows the hidden, selected elements.
Note: show() works on elements hidden with jQuery methods and display:none in CSS (but not visibility:hidden).
The :visible selector selects every element that is currently visible.
Visible elements are elements that are not:
Set to display:none
Form elements with type="hidden"
Width and height set to 0
A hidden parent element (this also hides child elements)
http://www.w3schools.com/jquery/eff_show.asp
http://www.w3schools.com/jquery/sel_visible.asp
------------------------------------------------------------------------------
Mary: Answer A (appear)
Ali from Ireland - Oct 23, 2013:
Just tried it out in jsbin. Answer is: C $('#btnEdit').show() and not answer a) .appear() as stated in answer.
volland from Bulgaria - Nov 09, 2013:
Correct answer is C: $('#btnEdit').show();
check it here: http://jsfiddle.net/volland/NwcAU/
try the $('#btnEdit').visible = true; - not working
Mary-Q50/160
QUESTION 241
121-HOTSPOT You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name. For each statement in the table, select
Yes if the code segment above causes the variable to evaluate as described. Select No if it does not. Make only
one selection in each column.
Hot Area:
Correct Answer:
QUESTION 242
122-HOTSPOT You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
* Display a message if users select the first OPTION element, and then submit the form.
* Do not display an alert message if users select any other OPTION element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 243
123-HOTSPOT
You develop a webpage that consumes a web service. The web service provides currency exchange rates.
Visitors enter the currency type on the webpage and press the Submit button. The web service returns the
current exchange rate. You need to ensure that the webpage always displays the most current information.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 244
124-HOTSPOT You develop a webpage. The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 245
125-HOTSPOT
A company has an XML file named products.xml on a web server. The file contains a list of the products that
the company sells. You need to display the contents of the products.xml file in a DIV element named Output.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 246
126-You are developing an application that analyzes population data for major cities in the United States.
The application retrieves population statistics for a city by using a web service.
You need to request data from the web service by using jQuery.
Which code segment should you use?
Correct Answer: D
QUESTION 247
You are developing a blog web page that is being optimized for accessibility. The page includes the following
HTML.
The heading tags represent a blog post title, a blog post subtitle, and the author's name. You need to ensure
that the three headings are treated as a unit but retain their individual formatting.
Which tags should you use to wrap the H1, H2, and H3 elements?
A. <group> </group>
B. <header> </header>
C. <hgroup> </hgroup>
D. <headings> </headings>
Correct Answer: C
Explanation/Reference:
The <hgroup> tag is used to group heading elements. REMOVED FROM HTML5.
The <hgroup> element is used to group a set of <h1> to <h6> elements, when a heading has multiple levels
(subheadings).
The <header> tag specifies a header for a document or section.
The <header> element should be used as a container for introductory content or set of navigational links.
You can have several <header> elements in one document.
http://www.w3schools.com/tags/tag_hgroup.asp
http://www.w3schools.com/tags/tag_header.asp
-------------------------------------------------------------------------------------------------------------
Mary & Sam: Answer C (hgroup)
http://html5doctor.com/the-hgroup-element/
http://html5doctor.com/the-hgroup-hokey-cokey/
Marty from Portugal - Oct 29, 2013:
Shouldn't answer be B. instead of C. hgroup was removed from HTML5.
http://www.w3.org/html/wg/wiki/ChangeProposals/dropHgroup
http://html5doctor.com/the-hgroup-hokey-cokey/
Mary-Q57/127
QUESTION 248
128-You develop a web application by using jQuery. You develop the following jQuery code: (Line numbers are
included for reference only.)
The web application exposes a RESTful web API that has an endpoint of/product/create.
You need to create a new product by using AJAX.
Which code segment should you insert at line 05?
Correct Answer: D
QUESTION 249
You develop a webpage that allows a user to download a JPEG image and convert it to a PNG file.
You need to implement the code to download the contents of the JPEG image with no additional decoding.
Which JavaScript function should you use?
A. readAsBinaryString()
B. readAsArrayBuffer()
C. readAsDataURL()
D. readAsText()
Correct Answer: B
Explanation/Reference:
FileReader includes four options for reading a file, asynchronously:
FileReader.readAsBinaryString(Blob|File) - The result property will contain the file/blob's data as a binary
string. Every byte is represented by an integer in the range [0..255]. Is deprecated.
FileReader.readAsText(Blob|File, opt_encoding) - The result property will contain the file/blob's data as a
text string. By default the string is decoded as 'UTF-8'. Use the optional encoding parameter can specify a
different format.
FileReader.readAsDataURL(Blob|File) - The result property will contain the file/blob's data encoded as a
data URL. (encodes it to base64)
FileReader.readAsArrayBuffer(Blob|File) - The result property will contain the file/blob's data as an
ArrayBuffer object.
http://msdn.microsoft.com/en-us/library/ie/hh772312%28v=vs.85%29.aspx
http://www.html5rocks.com/en/tutorials/file/dndfiles/
Mary-Q59/129
QUESTION 250
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <article>
B. <span>
C. <tbody>
D. <cd>
Correct Answer: A
Explanation/Reference:
How the Changes in HTML 5 Will Affect SEO (Search Engine Optimization)?
As a SEO expert, you are most likely interested mainly in those changes in the HTML 5 specification, which
will affect your work. Here is one of them:
A new <article> tag. The new <article> tag is probably the best addition from a SEO point of view. The
<article> tag allows to mark separate entries in an online publication, such as a blog or a magazine. It is
expected that when articles are marked with the <article> tag, this will make the HTML code cleaner
because it will reduce the need to use <div> tags. Also, probably search engines will put more weight on the
text inside the <article> tag as compared to the contents on the other parts of the page.
QUESTION 251
131-DRAG DROP You are developing a shared library to format information.
The library contains a method named _private. The _private method must never be called directly from outside
of the shared library.
You need to implement an API for the shared library.
How should you complete the relevant code? (Develop the solution by selecting the required code segments
and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
QUESTION 252
You develop an HTML application that contains a table that displays a list of products. The table is defined with
the following HTML markup:
You must style the table to look like the following image:
You need to implement the CSS selectors to select the rows that must have a blue background. Which CSS
selector should you use?
A. thead:only-child, tbody:after, table:before
B. tr [line |-0, 1, 3]
C. tr:first-of-type, tr:last-of-type
D. tr:first-line, tr:last-child
Correct Answer: C
Explanation/Reference:
The :first-of-type selector matches every element that is the first child, of a particular type, of its parent.
Tip: This is the same as :nth-of-type(1).
The :last-of-type selector matches every element that is the last child, of a particular type, of its parent.
Tip: This is the same as :nth-last-of-type(1).
The :before selector inserts content before the content of the selected element(s).
Use the content property to specify the content to insert.
p:before { content:"Read this: "; }
The :after selector inserts content after the selected element(s).
Use the content property to specify the content to insert.
p:after { content:"- Remember this"; }
The :first-line selector is used to add a style to the first line of the specified selector.
Note: The "first-line" selector can only be used with block-level elements.
p:first-line { background-color:yellow; }
http://www.w3schools.com/cssref/sel_first-of-type.asp
http://www.w3schools.com/cssref/sel_last-of-type.asp
http://www.w3schools.com/cssref/sel_before.asp
http://www.w3schools.com/cssref/sel_after.asp
http://www.w3schools.com/cssref/sel_firstline.asp
--------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------
Mary: Answer B (tr line)
Ali from Ireland - Oct 22, 2013:
Another one : Q62 is also wrong. I used JSBin to test all answers and answer c) tr:first-of-type,tr:last-of-type is
correct (and not B as test indicates)
Mary-Q62/132
QUESTION 253
You develop a webpage by using HTML5. You create the following markup:
<input type "url" name= "website" required="required" />
You need to ensure that the value that the user enters contains a secure URL.
What should you do?
A. Add the following attribute to the input tag: value="https://v
B. Add the following attribute to the input tag: pattern="https://.+"
C. Add the following attribute to the input tag: value="ssl"
D. Add the following attribute to the input tag: itemtype="https"
Correct Answer: B
Explanation/Reference:
Note:
* The pattern attribute is supported in Internet Explorer 10, Firefox, Opera, and Chrome.
* The pattern attribute specifies a regular expression that the <input> element's value is checked against.
* The pattern attribute works with the following input types: text, search, url, tel, email, and password
QUESTION 254
134-You develop a webpage by using HTML5. You create the following markup and code: (Line numbers are
included for reference only.)
You need to ensure that the values that users enter are only numbers, letters, and underscores, regardless of
the order. Which code segment should you insert at line 04?
Correct Answer: A
QUESTION 255
135-HOTSPOT You develop an interactive scalable vector graphics (SVG) application. You write the following
HTML markup that makes a rectangle rotate:
You need to control the speed of the rotating rectangle.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 256
136-DRAG DROP You create a webpage that includes the following HTML markup: (Line numbers are included
for reference only.)
You need to ensure that a form cannot be submitted unless the INPUT element contains the word OK. Which
five actions should you perform in sequence? (To answer, move the appropriate actions from the list of actions
to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 257
137-DRAG DROP You are implementing a web worker by using JavaScript and HTML5. The web worker
processes a long-running loop and returns the result to a webpage. The web worker is defined on the webpage
as follows:
You have the following requirements:
* Evaluate the message value in the web worker.
* Process the loop based on the iterations value that is passed from the webpage.
* Return a value back to the webpage from the web worker.
You need to implement the web worker. How should you complete the relevant code?
(To answer, drag the appropriate code segment to the correct location or locations in the answer area. Use only
code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 258
138-HOTSPOT
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 259
139-You are creating an HTML5 application that allows users to play video on a page by using the VIDEO
element.
You need to enable the user to start, stop, and pause the video.
Which line of code should you add to the page?
A. <video id= "myVideo" height="320" width="400" src="myVideo.vtt" contextmenu="pauseplay"> </video>
B. <video id="myVideon heigh"="320" width="400" src="myVideo.vtt" controls> </video>
C. <video _d="myVideon height="320" width="400" src="myVideo.vtt" autoplay> </video>
D. <video id="myVideo" height="320" width="400" src="myVideo.vtt" contextinenu="Startstopn> </video>
Correct Answer: B
QUESTION 260
You are creating a web page that contains a canvas with text.
The page contains the following JavaScript code. (Line numbers are included for reference only.)
The text on the canvas must rotate 90 degrees when a user clicks a button on the page.
You need to ensure that the text rotates when the user clicks the button.
Which line of code should you add at line 03?
A. context.transform(90);
B. context.content.getRotation(90);
C. context.rotate(90);
D. context.content.rotate (90);
Correct Answer: C
Explanation/Reference:
The rotate() method rotates the current drawing.
The transform property applies a 2D or 3D transformation to an element. This property allows you to rotate,
scale, move, skew, etc., elements.
div { transform:rotate(7deg); }
The rotation property rotates a block-level element counterclockwise around a given point defined by the
rotation-point property.
Tip: The border, padding, content, and backgrounds (that are not fixed) are also rotated!
http://www.w3schools.com/tags/canvas_rotate.asp
http://www.w3schools.com/cssref/css3_pr_transform.asp
http://www.w3schools.com/cssref/css3_pr_rotation.asp
Mary-Q70/140
QUESTION 261
141-You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
* Retrieve the content for any OPTION elements when the value of the selected attribute equals selected.
* Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: BD
QUESTION 262
142-DRAG DROP You are creating a function by using JavaScript. You have the following requirements:
The function must display loan amounts to the user within the following HTML element: <div id="display"></
div>
The loan amount of 2100 must display in the HTML element. All declared variables and functions must be
scoped to the myApp variable.
You need to implement the function. How should you complete the relevant code?
(To answer, drag the appropriate code segments to the correct location or locations in the answer area. Use
only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 263
143-HOTSPOT You create a custom style by using CSS3. A box with rounded corners must appear around
text.
The box must match the following illustration:
You need to add the CSS3 markup to your style. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 264
144-HOTSPOT
You implement a callback function by using JavaScript. You need to process the returned XML data. How
should you complete the relevant code? (To answer, select the appropriate option from each drop-down list in
the answer area.)
Hot Area:
Correct Answer:
QUESTION 265
145-You develop an HTML5 application. You give users a numeric access code that can be used only one
time.
Users must enter the numeric access code in the login form of the application.
The numeric characters must be hidden by a masking character.
You need to implement the form element for users to enter the code.
Which HTML element should you use?
A. <input type="password" required autocomplete="off">
B. <input type="input" autocomplete="off" required />
C. <input type="password" stytem" visiblity:hidden;" required />
D. <input type="button" value="password" required />
Correct Answer: A
QUESTION 266
146-You are developing an HTML5 web application that displays stock information.
The application loads information from a web service by using AJAX.
The following code defines a Stock object and loads stock data.
You need to implement the loadStock function. Which code segment should you use?
Correct Answer: A
QUESTION 267
147-HOTSPOT You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 268
148-DRAG DROP You create an HTML5 application that includes JavaScript. The application performs several
AJAX requests.One AJAX request retrieves order information from a web service and then sends the
information back to a webpage within the application. You must create a custom event.
You have the following requirements:
* The webpage must contain an HTML element named ordersListing that will receive the custom event
notification.
* The event name must be ordersReceived.
* The event must pass a custom value named orderCount.
* The event must run a JavaScript method named showOrdersReceivedCount after the orders Listing HTML
element receives the event.
* Do not allow other DOM elements to receive the event.
* Allow the event to be cancelled.
* Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX response.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 269
149-DRAG DROP You are developing an application by using JavaScript.
You must write a function that returns the sum of the variables named v1, v2, v3, v4.
You need to complete the sum function. How should you complete the relevant code? (To answer, drag the
appropriate code segment or segments to the correct location or locations in the answer area. Use only code
segments that apply.)
Select and Place:
Correct Answer:
QUESTION 270
150-You are developing a web page that includes the following HTML. <span id = "myTextSpan" class =
"redText"> Hello There! </span>
The font color of text inside the span must be red. You need to develop the web page to meet the requirement.
Which two CSS segments will achieve the goal?
(Each correct answer presents a complete solution. Choose two.)
Correct Answer: AC
QUESTION 271
You are troubleshooting an application. Users report that the UI is slow to respond.
You need to improve UI responsiveness by moving application tasks to web workers.
Which two tasks can you move to achieve this goal? (Each correct answer presents a complete solution.
Choose two.)
A. A function that loops through the Document Object Model to update the style of page elements
B. A long-running calculation that requires looping through an array
C. A function that performs graphic-intensive animation
D. A function that stores large amounts of data to local storage
Correct Answer: BD
Explanation/Reference:
A web worker is a JavaScript running in the background, without affecting the performance of the page.
When executing scripts in an HTML page, the page becomes unresponsive until the script is finished.
A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the
performance of the page. You can continue to do whatever you want: clicking, selecting things, etc., while the
web worker runs in the background.
Web Workers run in an isolated thread. As a result, the code that they execute needs to be contained in a
separate file. But before we do that, the first thing to do is create a new Worker object in your main page.
http://www.w3schools.com/html/html5_webworkers.asp
http://www.html5rocks.com/en/tutorials/workers/basics/
---------------------------------------------------------------------------------------------
Mary: Answer BC. I would say, slow I/O operations are more competitive.
Mary-Q81/151
QUESTION 272
152-You develop an interactive scalable vector graphic (SVG) application.
You write the following code (Line numbers are included for reference only.):
You need to increase the size of the circle by 50 percent. Which code segment should you insert at line 02?
Correct Answer: B
QUESTION 273
153-You develop an HTML5 webpage. You have the following HTML markup:
You need to change the background color for all of the elements whose name attribute ends with the word
name.
Which code segment should you add to the webpage?
A. $ ('#name').css ({ 'background-color' : '#E0ECF8' });
B. $ ('input [name |="name"; ] ' ) .css (( 'background-color' : '#E0ECF8'});
C. $('input[name$="name"]'). css{{'background-color' : '#E0ECF8'});
D. $ ('*name' ) .css ({ 'background-color' : ' #E0ECF8'}) ;
Correct Answer: C
QUESTION 274
You develop an HTML application that is located at www.adventure-works.com.
The application must load JSON data from www.fabrikam.com.
You need to choose an approach for loading the data. What should you do?
A. Design a REST URI scheme with multiple domains.
B. Configure Cross-Origin Resource Sharing (CORS) on the servers.
C. Load the data by using WebSockets.
D. Use the jQuery getJSON method.
Correct Answer: B
Explanation/Reference:
Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page to make
XMLHttpRequests to another domain, not the domain the JavaScript originated from. Such "cross-domain"
requests would otherwise be forbidden by web browsers, per the same origin security policy. CORS defines a
way in which the browser and the server can interact to determine whether or not to allow the cross-origin
request. It is more useful than only allowing same-origin requests, but it is more secure than simply allowing all
such cross-origin requests.
The CORS standard works by adding new HTTP headers that allow servers to serve resources to permitted
origin domains. Browsers support these headers and enforce the restrictions they establish. Additionally, for
HTTP request methods that can cause side-effects on user data (in particular, for HTTP methods other than
GET, or for POST usage with certain MIME types), the specification mandates that browsers "preflight" the
request, soliciting supported methods from the server with an HTTP OPTIONS request header, and then, upon
"approval" from the server, sending the actual request with the actual HTTP request method. Servers can also
notify clients whether "credentials" (including Cookies and HTTP Authentication data) should be sent with
requests.
JSONP or "JSON with padding" is a communication technique used in JavaScript programs running in web
browsers to request data from a server in a different domain, something prohibited by typical web browsers
because of the same origin policy.
Under the same origin policy, a web page served from server1.example.com cannot normally connect to or
communicate with a server other than server1.example.com. A few exceptions include the HTML <script>
element. Exploiting the open policy for <script> elements, some pages use them to retrieve JavaScript code
that operates on dynamically generated JSON-formatted data from other origins. This usage pattern is known
as JSONP. Requests for JSONP retrieve not JSON, but arbitrary JavaScript code. They are evaluated by the
JavaScript interpreter, not parsed by a JSON parser.
There have been some criticisms raised about JSONP. Cross-origin resource sharing (CORS) is a more recent
method of getting data from a server in a different domain, which addresses some of those criticisms. All
modern browsers now support CORS making it a viable cross-browser alternative.
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing
http://en.wikipedia.org/wiki/JSONP
------------------------------------------------------------------------------------------------------------------
Daniel from Macedonia - Oct 31, 2013:
One new question was just as Q84, but the option b was changed with new option JSONP.
Mary-Q84/154
QUESTION 275
You are building a web page for a newspaper publisher. You have the following requirements:
The web page should split the content into columns that are at least 100 pixels wide.
The number of columns displayed must be set by the browser.
You need to implement the correct CSS properties.
Which line of code should you use?
A. <div id="outer" style="width: 100px; column-fill: balance;">...</div>
B. <div id="outer" style="width: 100px; column-gap: 10px;">...</div>
C. <div id="outer" style="column-width: 100px; ">. . .</div>
D. <div id="outer" style="width: 100px; columns: 100px 3">...</div>
Correct Answer: C
Explanation/Reference:
The column-width property specifies the width of the columns.
div
{
column-width:100px;
-moz-column-width:100px; /* Firefox */
-webkit-column-width:100px; /* Safari and Chrome */
}
The column-gap property specifies the gap between the columns.
div
{
column-gap:40px;
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
}
The column-fill property specifies how to fill columns, balanced or not. Is not supported in any of the major
browsers.
column-fill: balance | auto;
balance Columns are balanced. Browsers should minimize the variation in column length
auto Columns are filled sequentially, and they will have different lengths
http://www.w3schools.com/cssref/css3_pr_column-width.asp
http://www.w3schools.com/cssref/css3_pr_column-gap.asp
http://www.w3schools.com/cssref/css3_pr_column-fill.asp
Mary-Q85/155
QUESTION 276
You develop a webpage with a standard input control by using HTML5. The input control must display the text
Enter your given name, as shown below:
When a user selects the input control, the text must disappear.
You need to create the input control.
Which input control should you use?
A. <input name="GivenName" value="Enter your given name" />
B. <input name="GivenName" default="Enter your given name" />
C. <input name="GivenName" text="Enter your given name" />
D. <input name="GivenName" placeholder="Enter your given name" />
Correct Answer: D
Explanation/Reference:
The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample
value or a short description of the expected format).
The short hint is displayed in the input field before the user enters a value.
http://www.w3schools.com/tags/att_input_placeholder.asp
Mary-Q86/156
QUESTION 277
157-You develop an HTML5 webpage. You have the following HTML markup:
You need to add a background color to the first article in each section.
Which code segment should you add to the webpage?
A. $ ("section article:first-child").css("background-color", "#f2f2f2");
B. $ ("section:first-child").ess ( "background-color", "#f2f2f2");
C. $ ("article:first-of-type") .css("background-color", "#f2f2f2");
D. $ ("section:first-of-type").css("background-color", "#f2f2f2");
Correct Answer: C
QUESTION 278
158-You are creating a custom object as described by the following code.
You need to implement the calcArea method. Which code should you use?
Correct Answer: D
QUESTION 279
159-DRAG DROP You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location.
Each selector may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 280
160-You are developing an HTML5 web form to collect feedback information from site visitors.
The web form must display an INPUT element that meets the following requirements:
* Allow numeric values between 1 and 10.
* Default to the value of 5.
* Display as a slider control on the page.
You need to add the INPUT element to the form. Which HTML element should you add?
A. Rating (Between 1 and 10): <input type="number" name="rating" min ="1" max-"10">
B. Rating (Between 1 and 10): <input type="number" name="rating" min="1" max="10" defaulc="5">
C. Rating (Between 1 and 10): <input type="range" name="rating" min="0" max="10" default"="5">
D. Rating (Between 1 and 10): <input type="range" name="rating" min="10" max="10" value="5">
Correct Answer: D
QUESTION 281
161-You develop an HTML5 application. The application uses an image that is returned from an HTTP POST
request.
You develop the following code: (Line numbers are included for reference only.)
You need to display the loaded image in the application. Which code segment should you insert at line 04?
Correct Answer: B
QUESTION 282
162-You develop an HTML5 webpage that contains the following HTML markup: <input id="loanTermTextBox"
type="text" />
Users must enter a valid integer value into the text box. You need to validate the data type that is received from
the input element.
Which two code segments should you include on the webpage?
(Each correct answer presents a complete solution. Choose two.)
E.
Correct Answer: AB
QUESTION 283
163-You develop an HTML5 application for a company. Employees must enter a personal identification number
(PIN) in an INPUT element named SecurityCode to access their employee records.
The SecurityCode element must meet the following requirements:
* Allow up to 6 digits.
* Do not display numbers as they are entered.
* Display the text Enter PIN Code before the user enters any data.
You need to implement the SecurityCode element.
Which HTML markup should you add to the application?
E.
Correct Answer: D
QUESTION 284
164-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area.
Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 285
165-HOTSPOT You are creating a custom CSS3 style.
You have the following requirements to complete the style:
* box1 has a red outline.
* box1 contains box2, and box2 must remain inside box1
* box2 must have a green to black gradient.
* box2 must be surrounded by white space.
The style resembles the following diagram:
You need to add the CSS3 code to the styles. How should you complete the relevant code? (To answer, select
the appropriate code segment in each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 286
166-You develop an application to host user-generated HTML and JavaScript content.
A common error handler in your application must process all unhandled errors.
You need to implement global error handling for the application. Which code segment should you use?
Correct Answer: A
QUESTION 287
You are creating a custom function. You pass an object named testObj to the function as a parameter.
You do not use inheritance through the functions. The function must establish whether testObj inherits from
another object named parentObj.
You need to ensure that the function performs as required.
Which method or operator should you add to the function?
A. parentObj.instanceof(testObj)
B. testObj.isPrototypeOf(parentObj)
C. testObj.instanceof(parentObj)
D. parentObj.isPrototypeOf(testObj)
Correct Answer: D
Explanation/Reference:
isPrototypeOf method determines whether an object exists in another object's prototype chain.
object1.isPrototypeOf(object2)
The isPrototypeOf method returns true if object2 has object1 in its prototype chain. The prototype chain is used
to share functionality between instances of the same object type. The isPrototypeOf method returns false when
object2 is not an object or when object1 does not appear in the prototype chain of the object2.
function Rectangle() { }
var rec = new Rectangle();
document.write(Rectangle.prototype.isPrototypeOf(rec));
// Output: true
instanceof operator returns a Boolean value that indicates whether or not an object is an instance of a
particular class.
The instanceof operator returns true if object is an instance of class. It returns false if object is not an instance
of class, or if object is null.
function objTest(obj){
var i, t, s = "";
t = new Array();
t["Date"] = Date;
t["Object"] = Object;
t["Array"] = Array;
for (i in t){
if (obj instanceof t[i]) {
s += "obj is an instance of " + i + "<br/>";
}
else {
s += "obj is not an instance of " + i + "<br/>";
}
}
return(s);
}
var obj = new Date();
document.write(objTest(obj));
// Output:
// obj is an instance of Date
// obj is an instance of Object
// obj is not an instance of Array
http://msdn.microsoft.com/en-us/library/ie/bch72c9e%28v=vs.94%29.aspx
http://msdn.microsoft.com/en-us/library/ie/zh0zb36z%28v=vs.94%29.aspx
-------------------------------------------------------------------------------------
Sam&Mary: Answer B testObj.isPrototypeOf(parentObj)
cch from New Zealand - Oct 15, 2013:
Should be D.
Mary-Q97/167
QUESTION 288
168-You develop an HTML5 webpage. You have the following HTML markup:
You need to call the click event for the addOneltem button a determined number of times when the user clicks
the addBoxOfltems button.
Which code segment should you add to the webpage?
Correct Answer: D
QUESTION 289
169-HOTSPOT You are validating user input by using built-in JavaScript functions.
The application must:
* Store the value that is entered in a variable named inputValue
* Use the built-in isNaN(tnputValue) function to evaluate the data type
You need to validate the return value of the isNaN(inputValue) function.
Which values will be returned? (To answer, configure the appropriate options in the dialog box in the answer
area.)
Hot Area:
Correct Answer:
QUESTION 290
1- DRAG DROP You are validating user input by using JavaScript and regular expressions. A group of
predefined regular expressions will validate two input fields:
* An email address in a function named validateEmail (for example, firstname@contoso.com)
* A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN(for example, 555555555 or 555-55-5555)
You need to use the correct expression to validate the input. Which expression should you insert into each
function?
(To answer, drag the appropriate regular expression statement to the correct location. Each regular expression
statement may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 291
2-You are developing a customer web form that includes the following HTML. <input id="txtValue" type="text" /
>
A customer must enter a valid age in the text box prior to submitting the form.
You need to add validation to the control. Which code segment should you use?
Correct Answer: D
QUESTION 292
4-DRAG DROP You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter.
The query string parameter must display the @ symbol that is used in the email address.
You need to implement this functionality. How should you develop the form? (To answer, drag the appropriate
code segment to the correct target or targets in the answer area. Each code segment may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 293
8-HOTSPOT You are developing a web application that retrieves data from a web service. The data being
retrieved is a custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
Retrieve and parse data from the web service using binary format if possible.
Retrieve and parse the data from the web service using XML when binary format is not possible.
You need to develop the application to meet the requirements. What should you do? (To answer, select the
appropriate options from the drop-down lists in the answer area.)
Hot Area:
Correct Answer:
QUESTION 294
10-DRAG DROP You are developing a web page for runners who register for a race. The page includes a
slider control that allows users to enter their age.
You have the following requirements:
* All runners must enter their age.
* Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
* The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements. What should you do? (To answer, drag the
appropriate word or number to the correct location in the answer area.
Each word or number may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 295
11-You are developing an HTML5 web application that displays the current temperature whenever a button is
clicked. The following code provides this functionality.
When the temperature is loaded, the status property on the loader instance does not change.
You need to ensure that the status property on the loader instance is updated when the temperature is loaded.
Which code segment should you use to replace the Loader function?
Correct Answer: A
QUESTION 296
14-HOTSPOT You are developing an airline reservation website by using HTML5 and JavaScript.
A page on the site allows users to enter departure and destination airport information and search for tickets.
You have the following requirements:
* Users must be able to save information in the application about their favorite destination airport.
* The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which lines of code should you use? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Hot Area:
Correct Answer:
QUESTION 297
15-HOTSPOT
You are developing an HTML5 web application for displaying encyclopedia entries.
Each encyclopedia entry has an associated image that is referred to in the entry.
You need to display the image by using the correct semantic markup.
What should you do? (To answer, select the appropriate options from the drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 298
16-You are creating a JavaScript object that represents a customer.
You need to extend the Customer object by adding the GetCommission() method.
You need to ensure that all future instances of the Customer object implement the GetCommission() method.
Which code segment should you use?
Correct Answer: D
QUESTION 299
17-You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 300
18-HOTSPOT An HTML page has a canvas element.
You need to draw a red rectangle on the canvas element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in
the answer area.)
Hot Area:
Correct Answer:
QUESTION 301
21-HOTSPOT You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
* Register an event listener for the web worker
* Start and stop the web worker You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down list in the
answer area.)
Hot Area:
Correct Answer:
QUESTION 302
22-You are creating a JavaScript function that displays the name of a web application.
You declare the following button element. <input type="button" id= "About" value="About" /> When a user clicks
the button, a JavaScript function named About must be called.
You need to create an event handler that calls the About function when the button is clicked.
Which two code segments can you use? (Each correct answer presents a complete solution. Choose two.)
Correct Answer: CD
QUESTION 303
23-HOTSPOT You are creating a function by using JavaScript. The function accepts an object as the
parameter and returns a string that identifies the data type of the object.
You have the following requirements:
* The function must return "Number" if the object is a number.
* The function must return "String" if the object is a string.
* The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in
the answer area.)
Hot Area:
Correct Answer:
QUESTION 304
25-You are developing an application that uses a third-party JavaScript library named doWork().
The library occasionally throws an "object is null or undefined" error with an error code of -2146823281.
The application must:
* Extract and handle the exceptions thrown by doWork()
* Continue normal program execution if other exceptions occur
You need to implement the requirements.
Which code segment should you use?
Correct Answer: C
QUESTION 305
28-You are developing an HTML5 web application that displays customer mailing address information.
The application loads addresses from a web service by using AJAX.
The following code defines a Customer object and loads address data.
You need to implement the loadAddress function. Which code segment should you use?
Correct Answer: C
QUESTION 306
30-DRAG DROP You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
* Generate an error * Assign "200" to the error number
* Assign "Invalid" to the error description You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 307
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
. Add a drop shadow that is one inch below the text in the paragraph
. Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 5px lin 0px;
C. text-shadow: 72pt 5em 0px
D. text-shadow:72pt 0em 5px;
Correct Answer: B
Explanation/Reference:
See http://www.w3.org/TR/css3-text/#text-shadow
All options are incorrect
nearest correct answers are B or D???
#obj { text-shadow: <x-offset> <y-offset> <blur-radius> <color>; }
<x-offset> +n right -n left
<y-offset> +n bottom -n top
1 inch below means <y-ffset> is 1in or 72 pt
Hence actually answer must be
0px,1in,5px 0r 0px, 72pt, 5px
QUESTION 308
32-You are creating a web form that users will use to enter their personal information. The form includes the
following HTML.
You have the following requirements:
* When a user enters an input box, the cell on the right must turn green.
* When a user leaves an input box, the cell on the right must turn white.
You need to create the web form to meet these requirements.
Which code segment should you use?
Correct Answer: A
QUESTION 309
33-You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
Correct Answer: A
QUESTION 310
34-DRAG DROP You are creating an application by using HTML5 and CSS3. The styles for the pages are
derived from five style sheets.
The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets?
(To answer, move the style sheet types from the list of style sheet types to the answer area and arrange them
in the correct order.)
Select and Place:
Correct Answer:
QUESTION 311
35-You are developing a web page by using HTML5.
You have the following requirements:
* An H1 element must be placed at the top left corner of the page.
* The size and location of the H1 element must not change if additional elements are added to the page.
You need to position the H1 element on the page.
Which CS53 style should you use?
Correct Answer: A
QUESTION 312
36-You are styling a box object on a page by using CSS3.
You need to set the transparency of the object to 50%.
Which two C5S3 styles will achieve the goal? (Each correct answer presents a complete solution. Choose
two.)
Correct Answer: BC
QUESTION 313
37-HOTSPOT You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
* The appropriate display resolution must be selected dynamically based on the device connecting to the page.
* Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Hot Area:
Correct Answer:
QUESTION 314
39-DRAG DROP You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new window.
Which jQuery code segment or segments should you use? (To answer, drag the appropriate line of code to the
correct location.
Each line of code may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 315
You are developing a page that includes text and an illustration. The web page resembles the following image.
You have the following requirements:
. The illustration must be in the center of the page.
. The text must flow around the left, right, top, and bottom of the illustration.
You need to ensure that the layout of the web page meets the requirements.
Which line of code should you use?
A. -ms-wrap-side: both;
B. -ms-wrap-side: clear;
C. -ms-wrap-side: maximum;
D. -ms-wrap-side: auto;
Correct Answer: A
Explanation/Reference:
http://msdn.microsoft.com/en-us/library/ie/hh673558(v=vs.85).aspx
http://dev.w3.org/csswg/css3-exclusions/
QUESTION 316
41-You are developing a web page that has a group of HI and H2 elements.
The page also includes a CSS class named underlineMe.
You have the following requirements:
* The font color of all H1 and H2 elements must be changed to red.
* The CSS class underlineMe must be applied to all H1 and H2 elements.
You need to update the web page to meet the requirements.
Which code segment should you use?
Correct Answer: D
QUESTION 317
42-HOTSPOT You are developing an HTML5 application for a company.
You apply the following style to a DIV element on a page.
You need to submit a draft illustration of the results of this code.
Which illustration should you submit? (To answer, select the appropriate illustration in the answer area.)
Hot Area:
Correct Answer:
QUESTION 318
43-DRAG DROP You are developing a web page that will be accessed from various types of devices.
* You have the following requirements:
* The appropriate display resolution must be selected dynamically based on the device that is connecting to the
page.
* Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct location.
Each
media statement may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 319
44-DRAG DROP You are developing a web page by using HTML5 and CSS3.
Hyperlinks on the page must be rendered with a style that reflects the last user action performed.
You need to style the four anchor elements in the document. In what order should you specify the four anchor
selectors?
(To answer, move the appropriate anchor selectors from the list of CSS codes to the answer area and arrange
them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 320
You are developing a web page that will be divided into three vertical sections. The main content of the site
will be placed in the center section. The two outer sections will contain advertisements.
You have the following requirements:
The main content section must be set to two times the width of the advertising sections.
The layout must be specified by using the CSS3 flexible box model.
You need to ensure that the visual layout of the page meets the requirements.
Which CSS3 property should you use?
A. box-orient
B. box-flex-group
C. box-flex
D. box-direction
Correct Answer: C
Explanation/Reference:
Reference:
http://www.html5rocks.com/en/tutorials/flexbox/quick/
QUESTION 321
49-You are developing a web form that includes the following HTML. <input id="txtValue" type="text" />
You need to ensure that a value is entered into txtValue before the form is submitted.
Which code segment should you use?
Correct Answer: A
QUESTION 322
50-HOTSPOT
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter.
The query string parameter must display the @ symbol used in the email address.
You need to implement this functionality. How should you develop the form? (To answer, select the appropriate
options from the drop-down lists in the answer area.)
Hot Area:
Correct Answer:
QUESTION 323
52-DRAG DROP You are developing a web application that retrieves data from a web service. The data being
retrieved is a custom binary datatype named bint.
The data can also be represented in XML. Two existing methods named parseXml() and parseBint() are
defined on the page.
The application must:
* Retrieve and parse data from the web service by using binary format if possible
* Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, drag the appropriate code segment to the correct location. Each code
segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 324
53-You are developing a customer web form that includes following HTML. <input id="txtValue"/>
You need to develop the form so that customers can enter only a valid country code consisting of three English
alphabet characters.
Which code segment should you use?
Correct Answer: C
QUESTION 325
54-You are developing an application that consumes an external web service that returns the latest stock rate.
The application has two methods:
* The getResults() method makes an AJAX web service request
* The ShowRate() method displays the stock rate from the web service response
You need to ensure that the ShowRate() method always displays the latest stock rate.
Which code segment should you use?
Correct Answer: D
QUESTION 326
55-DRAG DROP You are developing an application that reads information from a file.
The application must:
* Execute a block of code if there is an error accessing the file
* Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate statements
from the list of actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 327
56-HOTSPOT You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
* Generate an error
* Assign "200" to the error number
* Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer
area.)
Hot Area:
Correct Answer:
QUESTION 328
57-You are creating a JavaScript function to display the current version of a web application
You declare a button as follows. <input type="button" id="About" value="About" />
You need to create an event handler for the button by using an anonymous function. Which code segment
should you use?
Correct Answer: C
QUESTION 329
58-DRAG DROP You are creating a function by using JavaScript. The function accepts an object as the
parameter and returns a string that identifies the data type of the object. You have the following requirements:
* The function must return "Number" if the object is a number
* The function must return "String" if the object is a string
* The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 330
60-DRAG DROP You are developing an application for an online retailer. The company ships only to certain
countries.
The application must:
* Store a list of country codes in an array
* Validate the country code of the shipping address against the countries array
* Include a Boolean value in the array that indicates whether or not you can ship to the country
* Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to You need to develop the application to meet the requirements. Which code segment or segments
should you use? (To answer, drag the appropriate code segment or segments from the list of code segments to
the correct location or locations in the work area.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 331
61-DRAG DROP
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker:
* Register an event listener for the web worker
* Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, drag the appropriate line or lines of code to the correct location
or locations. Each line of code may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 332
63-DRAG DROP You are developing an airline reservation website by using HTML5 and JavaScript. A page on
the site allows users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
* Users must be able to save information in the application about their favorite destination airport.
* The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use? (To answer, drag the appropriate command or commands from the
list of commands to the correct location or locations in the work area. Each line of code may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 333
64-You are creating a class named Sedan that must inherit from the Car class.
The Sedan class must modify the inherited fourDoor () method.
The Car class is defined as follows.
Future instances of Sedan must be created with the overridden method. You need to write the code to
implement the Sedan class.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: BC
QUESTION 334
66-You are developing application web form by using HTML5 and JavaScript.
You need to prevent users from submitting form data more than once.
Which code segment should you use?
Correct Answer: A
QUESTION 335
You are developing an HTML5 web application for a surveyor company that displays topographic images.
The application must:
Display the topographic images at different zoom levels without loss of detail
Print the topographic images without loss of detail
Work from only one source file for each topographic image
You need to ensure that the topographic images display according to the requirements.
Which HTML5 element should you use?
A. SVG
B. CANVAS
C. SAMP
D. AREA
Correct Answer: A
Explanation/Reference:
Mary-Q166/67. Annie-Q44
QUESTION 336
68-DRAG DROP An HTML page has a CANVAS element.
You need to draw a red rectangle on the CANVAS element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 337
You are modifying a website.
The body of the page will be divided into two sections:
A content section will contain blog posts and comments.
An area on the right-hand side will contain advertisements.
The page is defined by the following HTML.
The site must conform to HTML5 standards and must use HTML5 semantic tags.
You need to ensure that the advertisements are on the rightmost section of the page.
Which tag should you use?
A. <aside>
B. <div>
C. <article>
D. <footer>
Correct Answer: A
Explanation/Reference:
Mary-Q168/69. Annie-Q45
QUESTION 338
You are developing a HTML5 page.
You need to add author and copyright information.
Which tag should you use?
A. <aside>
B. <header>
C. <footer>
D. <section>
Correct Answer: C
Explanation/Reference:
Mary-Q169/70. Annie-Q70
New Questions
QUESTION 339
98-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript variable defined: var languages = [];
You need to add statements to an existing JavaScript function to sort the list items. Which four actions should
you perform in sequence? (Develop the solution by selecting the required code segments and arranging them
in the correct order.)
Select and Place:
Correct Answer:
QUESTION 340
99-DRAG DROP You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment: var jsonFruit = { "apples" : "12", "bananas" : "8",
"watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 341
100-DRAG DROP You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
* Create an object that represents an image that will be displayed.
* Set the image properties from the values that are returned by the web service.
* Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 342
107-HOTSPOT You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows.
The first row spans the entire width of the page and is labeled #Top.
The second row contains three columns.
The first column is labeled #Left; the second column is labeled #Main; and the right column is labeled #Right.
The #Left and #Right columns are a fixed width.
The #Main column occupies the remaining available space.
The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout. How should you complete the relevant styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 343
111-DRAG DROP You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
* Display the message Denied! If the PaymentAmount variable is greater than 500.
* Display the message Approved! If the PaymentAmount variable is less than 300.
* Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater than
300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 344
112-DRAG DROP You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page. The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page. How should you create the JavaScript
code? (Develop the solution by selecting the required code segments and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
QUESTION 345
113-HOTSPOT You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 346
114-HOTSPOT You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 347
121-HOTSPOT You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name. For each statement in the table, select
Yes if the code segment above causes the variable to evaluate as described. Select No if it does not. Make only
one selection in each column.
Hot Area:
Correct Answer:
QUESTION 348
122-HOTSPOT You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
* Display a message if users select the first OPTION element, and then submit the form.
* Do not display an alert message if users select any other OPTION element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 349
124-HOTSPOT You develop a webpage. The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 350
138-HOTSPOT
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 351
141-You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
* Retrieve the content for any OPTION elements when the value of the selected attribute equals selected.
* Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: BD
QUESTION 352
147-HOTSPOT You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 353
158-You are creating a custom object as described by the following code.
You need to implement the calcArea method. Which code should you use?
Correct Answer: D
QUESTION 354
159-DRAG DROP You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location.
Each selector may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 355
164-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area.
Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 356
168-You develop an HTML5 webpage. You have the following HTML markup:
You need to call the click event for the addOneltem button a determined number of times when the user clicks
the addBoxOfltems button.
Which code segment should you add to the webpage?
Correct Answer: D
QUESTION 357
17-You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 358
33-You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
Correct Answer: A
QUESTION 359
You are developing an application that consumes a Windows Communication Foundation (WCF) service. The
application interacts with the service by using the following code. (Line numbers are included for reference
only.)
You need to authenticate to the WCF service. What should you do?
A. At line 11, add the following lines of code.
,username: yourusername
,password: yourpassword
B. At line 11, add the following line of code.
,credentials: prompt
C. At line 06, replace the code with the following line of code.
D. At line 11, add the following line of code. The username and password will be stored in an XML file.
,credentials: credentials.xml
Correct Answer: A
QUESTION 360
DRAG DROP
You are developing a form that captures a user's email address by using HTML5 and jQuery. The form must
capture the email address and return it as a query string parameter. The query string parameter must display
the @ symbol that is used in the email address. You need to implement this functionality.
How should you develop the form? (To answer, drag the appropriate code segment to the correct target or
targets in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Correct Answer:
Explanation/Reference:
QUESTION 361
HOTSPOT
You are developing an HTML5 web application for displaying encyclopedia entries. Each encyclopedia entry
has an associated image that is referred to in the entry. You need to display the image by using the correct
semantic markup. What should you do? (To answer, select the appropriate options from the drop-down list in
the answer area.)
Correct Answer:
QUESTION 362
HOTSPOT
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string. You need to implement the
function to meet the requirements. How should you build the code segment? (To answer, select the appropriate
options from the drop-down lists in the answer area.)
A.
B.
C.
D.
Correct Answer:
Explanation/Reference:
QUESTION 363
You are developing a web page by using HTML5. You have the following requirements:
. An H1 element must be placed at the top left corner of the page. . The size and location of the HI element
must not change if additional elements are added to the page.
You need to position the Hi element on the page. Which CS53 style should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 364
DRAG DROP
You are developing a website that has many web pages with hyperlinks to other sites. You need to ensure that
if a hyperlink contains an image, the linked web page opens in a new window. Which jQuery code segment or
segments should you use? (To answer, drag the appropriate line of code to the correct location. Each line of
code may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Correct Answer:
Explanation/Reference:
QUESTION 365
HOTSPOT
You are developing a form that captures a user's email address by using HTML5 and jQuery. The form must
capture the email address and return it as a query string parameter. The query string parameter must display
the @ symbol used in the email address. You need to implement this functionality. How should you develop the
form? (To answer, select the appropriate options from the drop-down lists in the answer area.)
Correct Answer:
Explanation/Reference:
QUESTION 366
DRAG DROP
You are developing an application for an online retailer. The company ships only to certain countries.
The application must:
. Store a list of country codes in an array
. Validate the country code of the shipping address against the countries array . Include a Boolean value in the
array that indicates whether or not you can ship to the country
. Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or
segments from the list of code segments to the correct location or locations in the work area. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
A.
B.
C.
D.
Correct Answer:
QUESTION 367
A. Hyper Tranformation Markup Language
B. Hyper Text Markup Lookup
C. Hyper Text Markup Language
D. Higher Text Markup Language
Correct Answer: C
Explanation/Reference:
QUESTION 368
Use the <noscript> element
A. To alert users that your page uses JavaScript, and so the user should enable JavaScript in the browser in
order to display your page correctly.
B. Automatically enable JavaScript
C. Activate JavaScript
D. Non of the above
Correct Answer: A
Explanation/Reference:
To alert users that your page uses JavaScript, and so the user should enable JavaScript in the browser in order
to display your page correctly.
QUESTION 369
which is mandory
attribute in this line
A. alt
B. src
C. height
D. width
Correct Answer: B
Explanation/Reference:
Only the src attribute is mandatory in image tag
QUESTION 370
Correct way to add javascript file reference in website
A. <script type="text/javascript" src="alertme.js"></script>
B. <script type="text/jscript" src="alertme.js"></script>
C. <script type="javascript" src="alertme.js"></script>
D. <script type="text/javascript"></script>
Correct Answer: A
Explanation/Reference:
QUESTION 371
The target attribute identifies where the browser will display the linked page; valid values are ( Select One or
More)
A. _blank
B. _parent
C. _self
D. _top
Correct Answer: ABCD
QUESTION 372
The [ ] attribute is the most important part of linking one online resource to another. i.e <a> tag
Correct Answer: The [href] attribute is the most important part of linking one online resource to another.
QUESTION 373
Which is secure method in HTTP ?
A. GET
B. POST
C. All of above
D. None of the Above
Correct Answer: B
Explanation/Reference:
POST for HTTP POST. This is the preferred value
GET for HTTP GET. This is the default value, but is not secure
QUESTION 374
Correct Answer: B
Explanation/Reference:
QUESTION 375
Correct HTML Code for Sending Mail
A. <a href="mailto:contact@contoso.com">
contact@contoso.com</a>
B. <a emailto="contact@contoso.com">
contact@contoso.com</a>
C. <a mailto="contact@contoso.com">
contact@contoso.com</a>
D. <a href="contact@contoso.com">
contact@contoso.com</a>
Correct Answer: A
Explanation/Reference:
<a href="mailto:contact@contoso.com">
contact@contoso.com</a>
is correct one
QUESTION 376
Every CSS rule has the same basic structure:
A. selector {
property1 value;
property2 value;
..
propertyN value;
}
B. selector {
property1:value ,
property2:value,
..
propertyN:value.
}
C. selector {
property1:value.
property2:value.
..
propertyN:value.
}
D. selector {
property1:value;
property2:value;
..
propertyN:value;
}
Correct Answer: D
Explanation/Reference:
QUESTION 377
What is the wildcard selector ?
A. returns the set of all the elements in a document
B. returns the wildcard set of all the elements in a document
C. returns the content type of tag in a document
D. All of above
Correct Answer: A
QUESTION 378
What is mean by HTML Inheritance ?
A. HTML elements inherit some properties from their parent elements unless specified otherwise
B. HTML elements inherit any properties from their parent elements unless specified otherwise
C. HTML elements inherit all properties from their parent elements unless specified otherwise
D. Non of the above
Correct Answer: A
Explanation/Reference:
like body tag css inherited to the h1 h2 p etc tag inside body
QUESTION 379
Which is the most appropriate templates From Visual Studio 2010 or 2012 to create web applications using
HTML5, CSS3, and JavaScript.
A. ASP.NET Empty Web Site
B. ASP.NET Web Site
C. ASP.NET Web Site (Razer)
D. ASP.NET Empty Web Application
Correct Answer: AD
Explanation/Reference:
The most appropriate templates are the ASP.NET Empty Web Site and ASP.NET Empty Web Application
templates
QUESTION 380
What is the best way to apply CSS rules to HTML elements that occur in several different pages?
A. Include all rules for each element in the <style> attribute of the element.
B. Include the rules for each page in a <style> element in the <head> element
C. Write the rules for the whole site in one or more style sheets and reference them by using a <style> element
in the <head> element of each page.
D. Write the rules for the whole site in one or more style sheets and reference them by using a <link> element
in the <head> element of each page.
Correct Answer: D
Explanation/Reference:
Write the rules for the whole site in one or more style sheets and reference them by using a <link> element in
the <head> element of each page.
QUESTION 381
Visual Studio also includes a new development web server called
A. IIS Server
B. IIS Express
C. IIS Light Weight Server
D. IIS 8.0
Correct Answer: B
Explanation/Reference:
Visual Studio also includes a new development web server called IIS Express. This web server provides many
of the same features as IIS, except that it is optimized for the development environment.
Note :Previous editions of Visual Studio provided the ASP.NET Development Server. This server is still
available, but IIS Express has fewer limitations. For example, IIS Express includes the integrated pipeline mode
of the full IIS that was not available in the ASP.NET Development Server.
QUESTION 382
What features provided by Visual Studio 2012 for extensive debugging of JavaScript code.
A. You can set breakpoints
B. single step through code
C. examine and modify the contents of variables
D. view the call stack
Correct Answer: ABCD
Explanation/Reference:
Visual Studio 2012 provides extensive debugging features for JavaScript code
You can set breakpoints, single step through code, examine and modify the contents of variables, view the call
stack,
and perform many other common debugging tasks.
QUESTION 383
Microsoft has provided the F12 Developer Tools as a feature of Internet Explorer. These tools enable a
developer to quickly perform the which of following tasks while the application is running in Internet Explorer
A. Inspect and validate HTML markup and CSS style sheets.
B. Run and debug JavaScript code.
C. Profile page load times to optimize an application.
D. View a page as if it were being viewed in Internet Explorer versions 7, 8, 9, or 10
Correct Answer: ABCD
Explanation/Reference:
Microsoft has provided the F12 Developer Tools as a feature of Internet Explorer. These tools enable a
developer to quickly perform the following tasks while the application is running in Internet Explorer:
. Inspect and validate HTML markup and CSS style sheets.
. Run and debug JavaScript code.
. Profile page load times to optimize an application.
. View a page as if it were being viewed in Internet Explorer versions 7, 8, 9, or 10
QUESTION 384
WHATWG Stands for
A. What Hypertext Application Technology Working Group
B. Web Hypertext Application Technology Working Group
C. Web Hypertext Application Technology Work Group
D. Web Hypertext Transfer Application Technology Working Group
Correct Answer: B
QUESTION 385
What are the aims HTML5 ?
A. Not to "break the web". HTML5 is backwards compatible with previous versions of HTML.
B. Add new features that reflect how the web is now used. For example, HTML5 supports form validation and
video.
C. Specify how every browser should behave when working with HTML. All HTML implementations can be
interoperable. This behavior includes defining how to handle errors.
D. Be universally accessible. Features should work across all devices, in any language, and for the disabled.
Correct Answer: ABCD
Explanation/Reference:
All the Above Features come under aim of HTML5
QUESTION 386
Margin and padding are both shorthand properties. you can just use padding or margin. example, padding is
set to 10px. How you could write this ?
A. padding-top: 10px;
padding-bottom : 10px;
padding-left : 10px;
padding-right : 10px;
B. padding-right : 10px;
padding-left : 10px;
padding-top: 10px;
padding-bottom : 10px;
C. padding-top: 10px;
padding-right : 10px;
padding-bottom : 10px;
padding-left : 10px;
D. padding-top: 10px;
padding-right : 10px;
padding-left : 10px;
padding-bottom : 10px;
Correct Answer: C
Explanation/Reference:
Here sequence is matter
You can easily recall the order of the sides by thinking of the word TRouBLe: Top, Right, Bottom, and Left.
QUESTION 387
What are the new elements that HTML5 provides for specifying the semantic meaning of content in a web
page?
A. The <html>, <head>, <title> and <body> element
B. The <section>, <header>, <footer>, <nav>, <article>, and <aside> elements
C. The <section> and <article> elements
D. The <section>, <p>, <b> elements
Correct Answer: B
Explanation/Reference:
The <section>, <header>, <footer>, <nav>, <article>, and <aside> elements
QUESTION 388
JavaScript supports two different styles of comment (Select Any Two)
A. /* */
B. ///
C. //
D. <--- -->
Correct Answer: AC
Explanation/Reference:
multi-line comments that begin with /* and end with */, and single-line comments that begin with // and finish at
the end of the line.
QUESTION 389
Find the out put of following javascript code
<script type="text/javascript">
var zero = 0;
var emptyString = "";
var False = false;
document.write("</br> zero == False returns " + (zero == False));
document.write("</br> zero === False returns " + (zero === False));
document.write("</br> emptyString == False returns " + (emptyString == False));
document.write("</br> emptyString === False returns " + (emptyString === False));
</script>
A. zero == False returns true
zero === False returns true
emptyString == False returns true
emptyString === False returns true
B. zero == False returns true
zero === False returns false
emptyString == False returns true
emptyString === False returns false
C. zero == False returns false
zero === False returns true
emptyString == False returns false
emptyString === False returns true
D. zero == False returns true
zero === False returns false
emptyString == False returns false
emptyString === False returns false
Correct Answer: B
Explanation/Reference:
0, "" (the empty string), undefined, and null all evaluate to false in Boolean operations.
Always use === when comparing to any of these values.
var zero = 0;
var emptyString = "";
var False = false;
zero == False; // returns true;
zero === False; // returns false;
emptyString == False; // returns true;
emptyString === False; // returns false;
QUESTION 390
Which of following statement is correct
A. all functions have a name.
B. Not all functions have a name.
C. all functions must have a name.
D. Non of above.
Correct Answer: B
Explanation/Reference:
Not all functions have a name. You can even declare anonymous functions. You typically use anonymous
functions when writing code to handle events or implement callbacks. In these cases, the function is invoked by
the browser (or whatever environment your code happens to be running in) rather than by your code, and it is
referenced by a variable rather than its name
QUESTION 391
What is True about DOM (Document Object Model)
A. The DOM was designed to be dependent of any one programing language
B. The DOM was designed to be independent of any one programing language
C. The DOM was designed to be dependent of one programing language
D. Non of the above
Correct Answer: B
Explanation/Reference:
The DOM was designed to be independent of any one programing language The DOM specification was
completed in 2004 and assumes that a web page is written in HTML 4.01 or XHTML 1, which were the
standards available at that time. Work is currently under way to simplify the DOM specification and to update it
for HTML5 and CSS3. This work is currently known as DOM4.
QUESTION 392
What are correct statement ?
A. Note that Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 do not support addEventListener()
and removeEventListener(). Use the similar attachEvent() and detachEvent() functions instead.
B. Note that Internet Explorer 6, Internet Explorer 7, do not support addEventListener() and
removeEventListener(). Use the similar attachEvent() and detachEvent() functions instead.
C. Note that Internet Explorer 7, and Internet Explorer 8 do not support addEventListener() and
removeEventListener(). Use the similar attachEvent() and detachEvent() functions instead.
D. Note that Internet Explorer 8 do not support addEventListener() and removeEventListener(). Use the similar
attachEvent() and detachEvent() functions instead.
Correct Answer: A
Explanation/Reference:
Note that Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 do not support addEventListener()
and removeEventListener(). Use the similar attachEvent() and detachEvent() functions instead.
Keep the code in an event handler short and concise. Long-running event handlers may impact the
responsiveness of the browser.
Some events in the HTML DOM 'bubble', meaning that if the event occurs on an element (and it is or isn't
handled), the event will then also fire on the element's parent node and then on its grandparent node and so on
until the event reaches an element where it may not bubble any further or it reaches the root node. Both
addEventListener and removeEventListener have an optional third Boolean parameter indicating whether or not
this is the case.
QUESTION 393
What is the purpose of the DOM?
A. The DOM represents the structure of a web page. You use it to add dynamic functionality to the page.
B. The DOM represents the structure of a web page. You use it to add static functionality to the page.
C. The DOM represents the structure of a web page. You use it to add functions to the page.
D. The DOM represents the structure of a tags. You use it to add dynamic functionality to the page.
Correct Answer: A
Explanation/Reference:
The DOM represents the structure of a web page. You use it to add dynamic functionality to the page.
QUESTION 394
If you perform validation in the browser, is it necessary to perform the same validation checks in the server
code that processes the data, or is this additional processing redundant?
A. You should not validate data at the server regardless of whether it has already been validated by the
browser.
B. You should validate data at the server regardless of whether it has already been validated by the browser.
C. You should sometime validate data at the server regardless of whether it has already been validated by the
browser.
D. You should always validate data at the server regardless of whether it has already been validated by the
browser.
Correct Answer: D
QUESTION 395
Which attribute need Emphasize in input controls of HTML 5
A. name
B. id
C. name and id
D. non of the above
Correct Answer: C
Explanation/Reference:
An id and name attribute. The id attribute is typically used by CSS to style the field and JavaScript code that
control the field in the browser; the name attribute is used by the server to reference fields on the form when it
is submitted.
QUESTION 396
Specify the type attribute of the <input> element
A. button, checkbox, color, date, datetime, datetime-local, email, file, hidden, image, month, number,
password, radio, range, reset, search, submit, tel, text, time, url, or week
B. checkbox, color, date, datetime, datetime-local, email, file, hidden, image, month, number, password, radio,
range, reset, search, submit, tel, text, time, url, or week
C. button, color, date, datetime, datetime-local, email, file, hidden, image, month, number, password, radio,
range, reset, search, submit, tel, text, time, url, or week
D. datetime, datetime-local, email, file, hidden, image, month, number, password, radio, range, reset, search,
submit, tel, text, time, url, or week
Correct Answer: A
Explanation/Reference:
Specify the type attribute of the <input> element, providing
one of the following values: button, checkbox, color, date, datetime, datetime-local, email, file, hidden, image,
month, number, password, radio, range, reset, search, submit, tel, text, time, url, or week.
Note that not all these types are not yet fully adopted or even implemented by most browsers. They are
designed to fail back to harmless text fields where they are not implemented.
QUESTION 397
Where we can use this validation
<input id="orderRef" name="orderReference" type="text" pattern="[0-9]{2}[A-Z]{3}" title="2 digits and 3
uppercase letters" />
A. if you require an order reference to comply with the pattern 99XXX, where 9 is any digit and X is any case
letter
B. if you require an order reference to comply with the pattern 99XXX, where 9 is only digit 9 and X is any case
letter
C. if you require an order reference to comply with the pattern 99XXX, where 9 is any digit and X is any
uppercase letter
D. non of the above
Correct Answer: C
Explanation/Reference:
if you require an order reference to comply with the pattern 99XXX, where 9 is any digit and X is any uppercase
letter,
use the HTML5 pattern attribute to specify a regular expression to validate the field. You can provide feedback
to the user about the expected format of the data by using the title attribute.
QUESTION 398
Correct code ajax() to get LuckyId number from webservice method at the URL /luckydip/enter and set result
element ID=answer
A. $.ajax({
url: '/luckydip/enter',
type: 'GET',
timeout: 12000,
dataType: 'text'
}).succes(function( responseText ){
$('#answer').text( responseText );
}).error(function() {
alert('An error has occurred - you may not have been entered');
});
B. $.ajax({
type: 'GET',
timeout: 12000,
dataType: 'text'
}).done(function( responseText ){
$('#answer').text( responseText );
}).fail(function() {
alert('An error has occurred - you may not have been entered');
});
C. $.ajax({
url: '/luckydip/enter',
type: 'GET',
timeout: 12000,
dataType: 'text'
}).done(function( responseText ){
$('#answer').text( responseText );
}).fail(function() {
alert('An error has occurred - you may not have been entered');
});
D. Non of the above
Correct Answer: C
Explanation/Reference:
The example on the slide uses the done and fail functions to handle the success and error cases.
Version 1.7 of jQuery defined the success and error callbacks as part of the object defined by the ajax()
function,
but these are deprecated in version 1.8.
The url property is the URL of the web service method or remote resource.
The type property can be set to GET or POST.
The timeout property causes the call to abort after a time specified in milliseconds.
The dataType property governs the response type you are expecting from the server, and can be set to a
variety of values, including text, xml, html, json, and script.
The done function is called when the call returns and the response data is parsed correctly.
The fail function is called if the request fails for any reason.
QUESTION 399
What are the main differences between the CSS box model, flex-box, and multi-column layout?
A. Flex-box is sets out the number of content columns within a box. Multi-column layout module for the box
model.
B. Flex-box is a layout module for the box model. Multi-column layout sets out the number of content rows
within a box.
C. Flex-box is a layout module for the box model.Multi-column layout sets out the number of content columns
within a box.
D. Non of above
Correct Answer: C
Explanation/Reference:
Flex-box is a layout module for the box model.Multi-column layout sets out the number of content columns
within a box.
QUESTION 400
How can you guard against name clashes in JavaScript?
A. You can use immediately invoked functions, define namespaces, and use strict mode.
B. You can use immediately invoked functions, define classes, and use strict mode.
C. You can use immediately invoked functions, define namespaces, and use explicit mode.
D. Non of the above
Correct Answer: A
Explanation/Reference:
You can use immediately invoked functions, define namespaces, and use strict mode.
QUESTION 401
Which of the following statements is true?
A. JavaScript uses the public, private, and protected keywords to implement encapsulation.
B. JavaScript does not support encapsulation.
C. JavaScript uses the Object.create() function to implement encapsulation.
D. JavaScript uses closures to achieve encapsulation.
Correct Answer: D
Explanation/Reference:
JavaScript uses closures to achieve encapsulation.
QUESTION 402
What are the example of singleton classess
A. database driver manager class :that is responsible for choosing which database driver to use to open a
connection to a database.
B. screen manager class that is responsible for organizing the layout of windows in a single screen.
C. mathematical class that provides algebraic and trigonometric functions such as sin, cos, and
D. Non of above
Correct Answer: ABC
Explanation/Reference:
One of the best known design patterns in object-oriented development is the singleton pattern. The singleton
pattern describes how to ensure that there is only ever a single instance of a class in existence. Typical uses of
the singleton pattern might include the following classes:
A database driver manager class that is responsible for choosing which database driver to use to open a
connection to a database.
A screen manager class that is responsible for organizing the layout of windows in a single screen.
A mathematical class that provides algebraic and trigonometric functions such as sin, cos, and tan
QUESTION 403
What is the correct JavaScript syntax to write "Hello World"?
A. response.write("Hello World")
B. document.write("Hello World")
C. "Hello World"
D. ("Hello World")
Correct Answer: B
QUESTION 404
What is the correct syntax for referring to an external script called "xxx.js"?
A. <script type="text/javascript" href="xxx.js">
B. <script type="text/javascript" src="xxx.js">
C. <script type="text/javascript" name="xxx.js">
Correct Answer: B
QUESTION 405
How do you call a function named "myFunction"?
A. myFunction()
B. call function myFunction
C. call myFunction()
Correct Answer: A
QUESTION 406
How do you write a conditional statement for executing some code if "i" is NOT equal to 5?
A. if =! 5 then
B. if (i != 5)
C. if (i <> 5)
D. if <>5
Correct Answer: B
QUESTION 407
How can you add a comment in a JavaScript?
A. 'This is a comment
B. //This is a comment
C. <!--This is a comment-->
Correct Answer: B
QUESTION 408
How do you find the number with the highest value of x and
A. top(x,y)
B. Math.ceil(x,y)
C. ceil(x,y)
D. Math.max(x,y)
Correct Answer: D
QUESTION 409
How do you put a message in the browser's status bar?
A. status("put your message here")
B. window.status("put your message here")
C. statusbar = "put your message here"
D. window.status = "put your message here"
Correct Answer: B
QUESTION 410
With jQuery, look at the following selector: $("div"). What does it select?
A. All div elements
B. The first div element
Correct Answer: A
QUESTION 411
What is the correct jQuery code to set the background color of all p elements to red?
A. $("p").style("background-color","red");
B. $("p").manipulate("background-color","red")
C. $("p").css("background-color","red");
D. $("p").layout("background-color","red");
Correct Answer: C
QUESTION 412
Which jQuery method is used to hide selected elements?
A. hidden()
B. hide()
C. display(none)
D. visible(false)
Correct Answer: B
QUESTION 413
Which jQuery method is used to perform an asynchronous HTTP request?
A. jQuery.ajax()
B. jQuery.ajaxSetup()
C. jQuery.ajaxAsync()
Correct Answer: A
QUESTION 414
Which statement is true?
A. To use jQuery, you must buy the jQuery library at www.jquery.com
B. To use jQuery, you do not have to do anything. Most browsers (Internet Explorer, Chrome, Firefox and
Opera) have the jQuery library built in the browser
C. To use jQuery, you can refer to a hosted jQuery library at Google
Correct Answer: C
QUESTION 415
Which jQuery method should be used to deal with name conflicts?
A. noConflict()
B. noNameConflict()
C. nameConflict()
D. conflict()
Correct Answer: B
QUESTION 416
Look at the following jQuery selector: $("div#intro .head"). What does it select?
A. All elements with class="head" inside the first div element with id="intro"
B. All div elements with id="intro" or class="head"
C. The first element with id="head" inside any div element with class="intro"
Correct Answer: B
QUESTION 417
Slect Interfaces in HTMl5 File API
A. Blob : interface represents immutable raw data.
B. File : interface inherits from Blob, and represents an individual file.
C. FileList : interface is a collection of File objects.
D. FileReader : interface enables an application to read a file or blob into a JavaScript variable.
Correct Answer: ABCD
Explanation/Reference:
All the above are correct answers.
QUESTION 418
FileReader interface provides three methods for reading data ?
A. readAsString() reads a file or blob and makes the contents available as an string.
B. readAsText() reads a file or blob and makes the contents available as plain text.
C. readAsDataURL() reads a file or blob and makes the contents available as a data URL.
D. readAsArrayBuffer() reads a file or blob and makes the contents available as an ArrayBuffer.
Correct Answer: BCD
QUESTION 419
Find Correct Code in HTML5 for creates a video player that is 300 pixels wide and 200 pixels high. An image
named "MyPoster.jpg" will be displayed while the video is being downloaded. As soon as the video has been
downloaded, it will start playing immediately with the audio muted.
A. <video src="MyVideo.mp4"
width="300" height="200"
poster="MyPoster.jpg"
/>
B. <video src="MyVideo.mp4"
width="300" height="200"
poster="MyPoster.jpg"
autoplay muted controls loop />
C. <video src="MyVideo.mp4"
width="200" height="300"
poster="MyPoster.jpg"
autoplay muted controls loop />
D. <video src="MyVideo.mp4"
width="300" height="200"
poster="MyPoster.jpg"
autoplay muted controls />
Correct Answer: B
QUESTION 420
What is use of HTML5 Geolocation API ?
A. To get IP Address.
B. To get browser details.
C. To get geographical maps.
D. To determine the current location of the browser
Correct Answer: D
QUESTION 421
Geolocation API enables a web application to detect the current location of the device, expressed in ?
A. longitude
B. sealevel
C. altitude.
D. latitude
Correct Answer: ACD
Explanation/Reference:
Typical uses of the Geolocation API include:
. Locating the current position of the user, and giving instructions on how to get to a new location.
. Tracking the movement of a user to see how far they have travelled in a certain time period.
QUESTION 422
HTML5 Geolocation API supports two types of position request select from following ?
A. navigator.geolocation.CurrentPosition()
B. navigator.geolocation.watchPosition()
C. navigator.geolocation.getPosition()
D. navigator.geolocation.getCurrentPosition()
Correct Answer: BD
Explanation/Reference:
One-shot position request. To perform a one-shot position request, invoke the
navigator.geolocation.getCurrentPosition() method.
Repeated position updates. To start receiving position updates, invoke the
navigator.geolocation.watchPosition() method. This method returns a watch ID value.
To stop receiving position updates, invoke navigator.geolocation.clearWatch(), and pass the watch ID as a
parameter.
QUESTION 423
The Page Visibility API consists of following properties and event:
A. The document.visibleState property indicates the detailed page visibility state, such as PAGE_VISIBLE or
PAGE_PREVIEW.
B. The visibilitychange event fires any time the visibility state of the page changes
C. The document.visibilityState property indicates the detailed page visibility state, such as PAGE_VISIBLE or
PAGE_PREVIEW.
D. The document.hidden property describes whether the page is visible or not.
Correct Answer: BCD
QUESTION 424
HTML5 enables a web application to determine the browser type, also commonly known as the user agent.?
A. The navigator.userAgentDetails property, which returns a string indicating the user agent string for the
browser
B. The navigator.userAgentInfo property, which returns a string indicating the user agent string for the browser
C. The navigator.userAgent property, which returns a string indicating the user agent string for the browser
D. Non of the abcve
Correct Answer: C
QUESTION 425
HTML5 provides the Navigation Timing API that enables you ?
A. To determine the navigation system of your web application
B. To determine the no of pages in your web application
C. To determine the different timings in your web application
D. To determine the download speed of your web application
Correct Answer: D
QUESTION 426
What methods are provided by the navigator.geolocation object for obtaining geolocation information?
A. getCurrentLocation() and watchPosition().
B. getCurrentPosition() and watchLocation().
C. getCurrentPosition() and watchPosition().
D. getCurrentGeoLocation() and watchPosition().
Correct Answer: C
QUESTION 427
What are the primary differences between data retained on a user's device by using session storage and by
using local storage?
A. Data stored by using session storage has a same scope and lifetime than data retained by using local
storage.
B. Data stored by using session storage has scope and lifetime not than data retained by using local storage.
C. Data stored by using session storage has a different scope and lifetime than data retained by using local
storage.
D. Non of the above
Correct Answer: C
QUESTION 428
Cookies can only store a very small amount of data, up to
A. 4 KB.
B. 5 KB.
C. 3 KB.
D. 2 KB.
Correct Answer: A
QUESTION 429
Find the correct statement session storage?
A. There is specified maximum size for session storage; independ on the operating system,
B. There is up to 4KB size for session storage; Independ on the operating system,
C. There is no specified maximum size for session storage; any limits depend on the operating system,
D. Non of the above
Correct Answer: C
QUESTION 430
You can test whether a browser implements session storage by querying for the presence of this property ?
A. if( window.sessionStorage )
{ ...
}
B. if( window.sessionStorageEnabled )
{ ...
}
C. if( window.HassessionStorage )
{ ...
}
D. Non of the above
Correct Answer: A
QUESTION 431
Which is correct statement session data in HTML5 ?
A. Session data is only available to the page that wrote it.
B. Session data is only available to all pages in web application.
C. Session data is only available to the cross page posting.
D. Non of the above
Correct Answer: A
QUESTION 432
What is correct statement about LocalStorage ?
A. Data persisted in local storage is available same web page e.g webpage1.html in same website
B. Data persisted in local storage is available in two web pages e.g webpage1.html and webpage2.html in
same website
C. Data persisted in local storage is available across different web pages e.g webpage1.html, webpage2.html,
webpage3.html .....webpageN.html in same website
D. Non of the above
Correct Answer: C
QUESTION 433
Use Following methods to complete the sentense w.r,t storage type.
To remove an item from LocalStorage store []; To remove all items from the store [] ;
To remove an item from SessionStorage store []; To remove all items from the store [];
a) localStorage.removeItem("key") b) sessionStorage.removeIndex[0]
c) localStorage.clearAll() d) sessionStorage.clear()
e) sessionStorage.removeItem("key") f) localStorage.clear()
Correct Answer: To remove an item from LocalStorage store [localStorage.removeItem("key")]; To remove all
items from the store [localStorage.clear()]; To remove an item from SessionStorage store
[sessionStorage.removeItem("key")]; To remove all items from the store [sessionStorage.clear()];
Explanation/Reference:
To remove an item from LocalStorage store localStorage.removeItem("key"); To remove all items from the
store localStorage.clear();
To remove an item from SessionStorage store sessionStorage.removeItem("key"); To remove all items from
the store sessionStorage.clear();
QUESTION 434
What is correct statement about the Indexed Database API, or IndexedDB which is currently in the Working
Draft stage from W3C
A. Provides an efficient mechanism for storing, retrieving, and searching for RDBMS data held locally on the
device running the browser
B. Provides an efficient mechanism for storing, retrieving, and searching for logical data held locally on the
device running the browser
C. Provides an efficient mechanism for storing, retrieving, and searching for structured data held locally on the
device running the browser
D. Non of the above
Correct Answer: C
QUESTION 435
Find the correct statement about the application cache.
A. The application cache is a server-side storage mechanism that enables the developer to explicitly declare
which static files should be cached by the browser
B. The application cache is a client-side storage mechanism that enables the developer to explicitly declare
which static files should be cached by the server
C. The application cache is a client-side storage mechanism that enables the developer to explicitly declare
which dynamic files should be cached by the browser
D. The application cache is a client-side storage mechanism that enables the developer to explicitly declare
which static files should be cached by the browser
Correct Answer: D
Explanation/Reference:
The cache manifest file specifies the data that the web browser should retain in the application cache. This file
is a list of resources divided into separate sections labeled CACHE, NETWORK, and FALLBACK
To add a manifest file to an application, create a new text file and store it in the root folder of the web
application. In this file, list all the static resources that should be downloaded and cached. This list will most
likely include any graphics and images in the application, any HTML pages that do not have URL data
dependencies, CSS files and JavaScript files, and so on. An example manifest file looks like this:
CACHE MANIFEST
CACHE:
index.html
verification.js
site.css
graphics/logo.jpg
NETWORK:
login
# alternatives paths
FALLBACK:
ajax/account/ noCode.htm
This file should have the .manifest file extension.
You can add comments to the manifest file by creating a new line starting with the pound symbol, #.
To use the application cache, each web page must reference the manifest file that lists the resources to cache.
A website can contain multiple manifest files, and different web pages can reference different manifest files.
You specify the name of the manifest file to use in a web page by adding the manifest attribute to the <html>
element.
<html manifest="appcache.manifest">
QUESTION 436
The behavior of the cache depends entirely on updates to the manifest file. Making a change to a resource on
the server no longer guarantees the browser will get the latest version of the file
which of following code forces the web page to use the new resources
A.
applicationCache.updateReady();
...
if (applicationCache.status == 4 ) {
applicationCache.swapCache();
}
B.
applicationCache.update();
...
if (applicationCache.status == 4 ) {
applicationCache.UpdateCache();
}
C.
applicationCache.Refresh();
...
if (applicationCache.status == 4 ) {
applicationCache.swapCache();
}
D. Non of above
Correct Answer: A
Explanation/Reference:
The behavior of the cache depends entirely on updates to the manifest file. Making a change to a resource on
the server no longer guarantees the browser will get the latest version of the file
The best way to force an update is to add a comments field in the manifest with a version number, for
example:
#version=1.2.3
You can also use the update() function of the applicationCache object to initiate a check for updates, similar to
the one performed when a web page is first loaded. Any existing cached resources will continue to be used until
the page is reloaded or you invoke the swapCache() function of the applicationCache object.
In the code example below, the swapCache() function is called if the cache has been updated with new
resources (status code 4 is the UPDATEREADY status).
This code forces the web page to use the new resources.
applicationCache.update();
...
if (applicationCache.status == 4 ) {
applicationCache.swapCache();
}
QUESTION 437
What are the main device characteristics used by media queries to detect whether a client device is a hand-
held tablet?
A. device-width, device-height, and orientation
B. device-Name, device-Model, and orientation
C. device-Manufacture, device-size, and orientation
D. Non of the above
Correct Answer: A
QUESTION 438
How can you detect whether a user is running Internet Explorer to view your web page?
A. Use a conditional comment with the !=(IE) expression.
B. Use a conditional comment with the <>(IE) expression.
C. Use a conditional comment with the !(IE) expression.
D. Non of the above
Correct Answer: C
QUESTION 439
Creating adaptive user interface requires considering which of following items ?
A. Screen Resolution
B. Screen Readers
C. Display Density
D. Browser Capabilities
Correct Answer: ABCD
Explanation/Reference:
All the above
Screen Resolution
The most obvious difference between a smartphone and a desktop monitor is the screen resolution, and
therefore the potential size of the browser window or viewport. As part of a responsive design, your site must be
usable on any screen, whether it is 480, 1280, or 2560 pixels wide. Your website may adapt different types of
content by using the strategies in the following list:
Display Density
The resolution of a screen has varied widely for a while, but only recently has the density of a screen (measured
in dots per inch, or dpi) started to vary enough to make it worthwhile for browsers to detect and react to it.
Increased screen density enables applications to present data with much greater clarity by using common
screen resolutions. However, a larger screen density can cause the operating system to scale up all elements
on a page, which can result in blurry images. T
Browser Capabilities
Different browsers often have very different levels of functionality. For example, Internet Explorer 10
implements many (but not all) of the features specified by HTML5 and CSS3, while browsers from other
vendors implement a frequent cycle of releases to react to standards changes. You also need to consider the
mobile versions of browsers (including mobile versions of Internet Explorer) that have their own levels of
compliance.
Screen Readers
Using the web is an entirely different experience for the visually impaired. Reading web content and navigation
are both achieved aurally. When using aural properties, the canvas consists of a three-dimensional physical
space (sound surrounds) and a temporal space (one may specify sounds before, during, and after other
sounds). The CSS properties also allow you to vary the quality of synthesized speech (voice type, frequency,
inflection, and so on.), the direction it comes from, and modify pauses, cues, and volume.
QUESTION 440
What is use of following conditional comments introduced by Microsoft
<html>
<head>
<!--[if lt IE 10]>
<p>Please upgrade to Internet Explorer 10.</p>
<![endif]-->
</head>
A. which detects whether the user is running a version of Internet Explorer equal to version 10:
B. which detects whether the user is running a version of Internet Explorer upgraded version 10:
C. which detects whether the user is running a version of Internet Explorer prior to version 10:
D. Non of the above
Correct Answer: C
QUESTION 441
Which of the following statements about SVG is false?
A. You can use SVG to draw complex shapes, and fill them with gradients and patterns.
B. SVG elements are parsed by the browser when the page is first loaded, and they are then discarded from
memory.
C. You can create SVG elements dynamically by using DOM functions such as document.createElement().
D. SVG elements must be enclosed in an <svg> container element on a web page.
Correct Answer: B
QUESTION 442
Summerise the output of following SVG code
<svg xmlns="http://www.w3.org/2000/svg">
<rect x="50" y="50" width="100" height="75" rx="20" ry="20" fill="red" stroke="blue" />
<rect x="75" y="75" width="100" height="75" fill="yellow" stroke="blue" />
</svg>
A. The following example creates an <svg> element that contains one rectangles. The first rectangle is red and
has rounded corners, as specified by the rx and ry attributes. The second rectangle is yellow, and partially
obscures the first rectangle because it is defined after it in the <svg> element:
B. The following example creates an <svg> element that contains two rectangles. The first rectangle is yellow
and has rounded corners, as specified by the rx and ry attributes. The second rectangle is red and partially
obscures the first rectangle because it is defined after it in the <svg> element:
C. The following example creates an <svg> element that contains two rectangles. The first rectangle is red and
has not round corners, as specified by the rx and ry attributes. The second rectangle is yellow, and partially
obscures the first rectangle because it is defined after it in the <svg> element:
D. The following example creates an <svg> element that contains two rectangles. The first rectangle is red and
has rounded corners, as specified by the rx and ry attributes. The second rectangle is yellow, and partially
obscures the first rectangle because it is defined after it in the <svg> element:
Correct Answer: D
QUESTION 443
which of the following statement is correct w.r.t canvas API and SVG
A. The Canvas API is an alternative to SVG graphics and is useful if you want to perform one-off graphical
operations in a web page
B. The Canvas API is replacement for SVG graphics and is useful if you want to perform one-off graphical
operations in a web page
C. The Canvas API is same as the SVG graphics and is useful if you want to perform one-off graphical
operations in a web page
D. Non of the above
Correct Answer: A
QUESTION 444
Select the proper numbers and fill the blanks
Canvas API is JavaScript APIs and drawing primitives with [ ] methods and [ ] attributes
a) 31 b) 55 c) 21 d) 45
Correct Answer: Canvas API is JavaScript APIs and drawing primitives with [45] methods and [21] attributes
Explanation/Reference:
Canvas API is JavaScript APIs and drawing primitives with [45] methods and [21] attributes
QUESTION 445
Which is following is true statement
A. DOM support for canvas
B. DOM partially support for canvas
C. DOM not support for canvas
D. Non of the above
Correct Answer: C
Explanation/Reference:
Canvas is box for painting so no DOM support needed.
QUESTION 446
In html page canvas element is there
<canvas id="myCanvas">No canvas support in this browser</canvas>
after calling document.getElementById(myCanvas)
what is reply from this method ?
A. <canvas> element found
B. Error
C. do not recognize the <canvas> element.
D. Non of the above
Correct Answer: C
QUESTION 447
What happens if you do not set the transition-duration property of a CSS transition?
A. The transition occurs after some immediately.
B. The transition not occurs at all.
C. The transition occurs immediately.
D. Non of the above
Correct Answer: C
QUESTION 448
Which of the following operations can you NOT perform by using a CSS transformation?
A. Rotate
B. Translate
C. Animate
D. Skew
Correct Answer: C
QUESTION 449
How does a client create a connection to a web socket server?
A. The client uses the open() function of the WebSocket object and specifies the URL of the server.
B. The client uses the connect() function of the WebSocket object and specifies the URL of the server.
C. Web sockets use a stateless protocol similar to HTTP. A client application simply specifies the address of
the server as a parameter of the send() function of the WebSocket object. A connection is automatically
established while the message is sent and then closed.
D. The client creates a new WebSocket object and specifies the URL of the server.
Correct Answer: D
QUESTION 450
What are the two established ways to implement real-time communications
A. Continuous polling
B. Long polling
C. Async polling
D. Sync pooling
Correct Answer: AB
Explanation/Reference:
When creating real-time web applications, the need for continuous communication between the web page in a
browser and the web server is paramount. As soon as a user views a web page, the data it displays might
already be obsolete; stock values may have fallen or risen, or the tickets for a concert may have sold out. A
great deal of data is time dependent. Users must be able to trust the information on the page in front of them
without having to refresh it constantly.
There are two established ways to implement real-time communications:
. Continuous polling. The page connects to the server and sends an AJAX request to the server for new
data. The server instantly responds, indicating that the data has not changed since the last request, or sends
back the new data. The page then closes the connection. This process is repeated every few seconds.
. Long polling. The page connects to the server, setting the connection timeout value to a very long period
of time (up to several hours, depending on the application), and then sends a request to the server for new
data. The server only replies if it has new data to send. The connection is closed when either the timeout period
is reached or new data is sent to the page. The process then starts again. This mechanism has an advantage
over the continuous polling approach in that the overhead of opening and closing many short-lived network
connections is reduced, but the cost is the need to maintain an open network channel to the server. The server
may only be able to support a limited number of concurrent network connections, and a web page may not be
able to connect to a server when this limit is reached
QUESTION 451
How does a web page communicate with a web worker?
A. A web page and a web worker communicate by recieving messages.
B. A web page and a web worker can not communicate at all
C. A web page and a web worker communicate by sending and receiveing messages.
D. Non of the above
Correct Answer: C
QUESTION 452
Which of following statement is correct about web worker ?
A. Web workers enable you to perform long-running tasks synchronously, enabling the browser to remain
responsive
B. Web workers enable you to perform long-running tasks in faster speed, enabling the browser to remain
responsive
C. Web workers enable you to perform long-running tasks asynchronously, enabling the browser to remain
responsive
D. Non of the above
Correct Answer: C
QUESTION 453
Web workers are ideally suited to a variety of scenarios
A. Creating static web site
B. Performing lengthy calculations
C. Dividing work between concurrent threads
D. Performing long-running or slow I/O operations
Correct Answer: BCD
Explanation/Reference:
Web workers are ideally suited to a variety of scenarios, including:
. Performing long-running or slow I/O operations. A web worker could be used to send data to a web
service and await a response, while the web page continues running. Alternatively, a web worker could use the
File API to read data from the local file system for processing, and then upload this data to a web service or
pass it to the web page for display.
. Performing lengthy calculations. A web worker could be used to implement a complex algorithm that
implements a computation-intensive calculation. The results can be returned to the web page when the
calculation is complete.
. Dividing work between concurrent threads. Operations that involve processing a large amount of data,
such as the information held in a large array or a file on disk, could be delegated to a collection of concurrent
web workers. A master web-worker initiated by the web page can act as a controller that creates subordinate
web workers and delegates work to them. The master web worker aggregates the results and sends them back
to the web page. If the computer running the browser has a processor with multiple cores, and depending on
how the browser implements web workers, this model provides a good way to exploit the parallel processing
capabilities of the processor.
QUESTION 454
What are the two types of web worker ?
A. pulled workers
B. dedicated workers
C. satellite workers
D. shared workers
Correct Answer: BD
Explanation/Reference:
A dedicated worker is the exclusive property of the page that created it. It runs asynchronously from the page,
but can be controlled by the page. Only the page that created the worker can post messages to it and receive
messages back from it. A dedicated web worker can be terminated by the page that created it. Note that if the
web page is closed (if the browser terminates, or the user navigates to a different page), then any dedicated
web workers created by that page will stop. A web worker can also forcibly terminate itself. A dedicated worker
is ideal for performing a long-running task on behalf of a web page, such as uploading a large file or processing
a large amount of data.
A shared worker is created by one page, but other pages running as part of the same web application can post
messages to, and receive messages from, the same shared worker. Shared workers can be controlled by any
page in the web application. Shared workers stop if the user navigates to a different website.
A shared worker provides a mechanism for implementing centralized application processes, and can also be
used to implement cross-page communication. For example, a shopping cart on a catalog site could be
implemented by using a shared worker that uses AJAX methods to quietly download and share very detailed
product information for items in the cart
QUESTION 455
How to create web worker ?
A. var webWorker;
if( typeof(Worker)== "undefined") {
webWorker = new Worker("processScript.js");
}
B. var webWorker;
if( typeof(Worker)= "undefined") {
webWorker = new Worker("processScript.js");
}
C. var webWorker;
if( typeof(Worker)!== "undefined") {
webWorker = new Worker("processScript.js");
}
D. Non of the above
Correct Answer: C
QUESTION 456
How to stop web worker ?
A. webWorker.sleep();
B. webWorker.stop();
C. webWorker.shutdown();
D. webWorker.Terminate();
Correct Answer: D
QUESTION 457
How Web workers may also terminate themselves?
A. self.poweroff();
B. self.exit();
C. self.abandom();
D. self.close();
Correct Answer: D
QUESTION 458
To send a message to a web worker, the web page can use ?
A. postMessage() function of the web worker object
B. putMessage() function of the web worker object
C. GetMessage() function of the web worker object
D. Non of the above
Correct Answer: A
QUESTION 459
You are validating user input by using JavaScript and regular expressions. A group of predefined regular
expressions will validate two input fields:
. An email address in a function named validateEmail . A nine-digit number that allows optional hyphens after
the second and fifth character in a function named validateSSN
You need to use the correct expression to validate the input. Which expression should you insert into each
function? (To answer, drag the appropriate regular expression statement to the correct location. Each regular
expression statement may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
A.
B.
C.
D.
E.
Correct Answer: BD
Explanation/Reference:
QUESTION 460
HOTSPOT
You are developing a web application that retrieves data from a web service.
The data being retrieved is a custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
. Retrieve and parse data from the web service using binary format if possible
. Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, select the appropriate options from the drop-down lists in the answer area.)
A.
B.
C.
D.
E.
F.
Correct Answer: AD
Explanation/Reference:
QUESTION 461
DRAG DROP
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
. All runners must enter their age.
. Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
. The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in the answer
area. Each word or number may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
A. slider, 18, 90, value, 37, optional
B. slider, 18, 90, value, 37, required
C. range, 18, 90, value, 37, required
D. range, 18, 90, value, 37, optional
E. slider, 18, 90, default, 37, required
F. range, 18, 90, default, 37, required
Correct Answer: C
Explanation/Reference:
QUESTION 462
You are developing an HTML5 web application that displays the current temperature whenever a button is
clicked.
The following code provides this functionality.
When the temperature is loaded, the status property on the loader instance does not change.
You need to ensure that the status property on the loader instance is updated when the temperature is loaded.
Which code segment should you use to replace the Loader function?
Correct Answer: A
Explanation/Reference:
http://www.quirksmode.org/js/this.html
Mary-Q110/11. Annie-Q7
QUESTION 463
HOTSPOT
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets.
You have the following requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which lines of code should you use? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
A.
B.
C.
D.
Correct Answer: AB
Explanation/Reference:
QUESTION 464
You are creating a JavaScript object that represents a customer.
You need to extend the Customer object by adding the GetCommission() method.
You need to ensure that all future instances of the Customer object implement the GetCommission() method.
Which code segment should you use?
Correct Answer: D
Explanation/Reference:
Prototype
A prototype is an object from which other objects inherit properties
function.apply()
Calls a function with a given this value and arguments provided as an array
Mary-Q115/16,Q3/73. Annie-Q10
slightly another question: You are creating a JavaScript object that represents an employee. You need to
extend the Employee object by adding the GetPayroll() method.
QUESTION 465
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 466
HOTSPOT
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker:
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down list in the
answer area.)
A. self.postMessage('Worker : ', + data);
B. self.addEventListener('message', function(event));
C. self.attachEvent('Worker', data);
D. self.teminate();
E. self.close();
Correct Answer: ABE
Explanation/Reference:
QUESTION 467
HOTSPOT
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in
the answer area.)
A. switch, case, break, case, break, default
B. switch, case, break, case, break, case
C. switch, case, break, case, break, break
D. switch, case, break, case, default, break
Correct Answer: A
Explanation/Reference:
QUESTION 468
DRAG DROP
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. throw new Error (200, "Invalid");
B. throw new Error ("Invalid", 200);
C. throw new Error ("Invalid", "Invalid");
Correct Answer: A
QUESTION 469
You are creating a web form that users will use to enter their personal information. The form includes the
following HTML.
You have the following requirements:
. When a user enters an input box, the cell on the right must turn green.
. When a user leaves an input box, the ceil on the right must turn white.
You need to create the web form to meet these requirements.
Which code segment should you use?
A.
B.
C.
D.
Correct Answer: A
QUESTION 470
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
A.
B.
C.
D.
Correct Answer: A
QUESTION 471
You are developing a web page by using HTML5.
You have the following requirements:
An H1 element must be placed at the top left corner of the page.
The size and location of the H1 element must not change if additional elements are added to the page.
You need to position the H1 element on the page.
Which CSS3 style should you use?
Correct Answer: A
Explanation/Reference:
Mary-Q134/35. Annie-Q24
QUESTION 472
You are styling a box object on a page by using CSS3.
You need to set the transparency of the object to 50%.
Which two CSS3 styles will achieve the goal?
(Each correct answer presents a complete solution. Choose two.)
Correct Answer: BC
Explanation/Reference:
http://www.css3.info/introduction-opacity-rgba/
QUESTION 473
HOTSPOT
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
. The appropriate display resolution must be selected dynamically based on the device connecting to the page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
A.
B.
C.
D.
Correct Answer: AC
Explanation/Reference:
QUESTION 474
You are developing a web page that has a group of H1 and H2 elements. The page also includes a CSS class
named underlineMe.
You have the following requirements.
. The font color of all H1 and H2 elements must be changed to red.
. The CSS class underlineMe must be applied to all H1 and H2 elements.
You need to update the web page to meet the requirements.
Which code segment should you use?
A.
B.
C.
D.
Correct Answer: D
QUESTION 475
DRAG DROP
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
. The appropriate display resolution must be selected dynamically based on the device that is connecting to the
page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct location. Each
media statement may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer: AC
Explanation/Reference:
QUESTION 476
You are developing a web form that includes the following HTML.
<input id="txtValue" type="text" />
You need to ensure that a value is entered into txtValue before the form is submitted.
Which code segment should you use?
Correct Answer: A
Explanation/Reference:
Mary-Q148/49. Annie-Q34
QUESTION 477
DRAG DROP
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page.
The application must:
. Retrieve and parse data from the web service by using binary format if possible
. Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, drag the appropriate code segment to the correct location. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
A.
B.
C.
D.
E.
F.
Correct Answer: AD
Explanation/Reference:
QUESTION 478
You are developing a customer web form that includes following HTML.
<input id="txtValue"/>
You need to develop the form so that customers can enter only a valid country code consisting of three English
alphabet characters.
Which code segment should you use?
Correct Answer: C
Explanation/Reference:
Mary-Q152/53. Annie-Q36
QUESTION 479
You are developing an application that consumes an external web service that returns the latest stock rate.
The application has two methods:
. The getResults() method makes an AJAX web service request
. The ShowRate() method displays the stock rate from the web service response
You need to ensure that the ShowRate() method always displays the latest stock rate.
Which code segment should you use?
A.
B.
C.
D.
Correct Answer: D
QUESTION 480
DRAG DROP
You are developing an application that reads information from a file.
The application must:
. Execute a block of code if there is an error accessing the file
. Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate statements
from the list of actions to the answer area and arrange them in the correct order.)
A. try, catch(e), debug
B. try, catch(e), catch(e)
C. try, catch(e), finally
D. try, catch(e), throw
Correct Answer: C
Explanation/Reference:
try
catch(e)
finnaly
The fileopen statement is put within the try clause.
The catch(e) will catch a fileopen error.
The finally clause will be executed regardless of whether an error occurs in the try clause proceeding it
QUESTION 481
HOTSPOT
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer
area.)
A. throw new Error (200, "Invalid");
B. throw new Error ("Invalid", 200);
C. throw new Error ("Invalid", "Invalid");
Correct Answer: A
Explanation/Reference:
For IE browsers, use ErrorCode, ErrorMessage.
throw Statement (JavaScript), http://msdn.microsoft.com/en-us/library/85fscz6h%28v=VS.94%29.aspx
QUESTION 482
You are creating a JavaScript function to display the current version of a web application You declare a button
as follows.
<input type="button" id="About" value="About" />
You need to create an event handler for the button by using an anonymous function.
Which code segment should you use?
Correct Answer: C
Explanation/Reference:
Mary-Q156/57. Annie-Q38
QUESTION 483
DRAG DROP
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
. The function must return "Number" if the object is a number
. The function must return "String" if the object is a string
. The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. switch, case, break, default, case, break
B. switch, case, break, case, break, default
C. switch, default, case, break, case, break
D. switch, default, case, break, case, default, break
Correct Answer: B
Explanation/Reference:
QUESTION 484
DRAG DROP
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker;
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, drag the appropriate line or lines of code to the correct location
or locations. Each line of code may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
A.
B.
C.
D.
E.
Correct Answer: ABE
Explanation/Reference:
QUESTION 485
DRAG DROP
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which line or lines of code should you use? (To
answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area. Each line of code may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
A.
B.
C.
D.
Correct Answer: AB
Explanation/Reference:
QUESTION 486
You are creating a class named Sedan that must inherit from the Car class. The Sedan class must modify the
inherited fourDoor () method.
The Car class is defined as follows.
Future instances of Sedan must be created with the overridden method. You need to write the code to
implement the Sedan class.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: BC
Explanation/Reference:
Mary-Q163/64. Annie-Q41
QUESTION 487
You are developing application web form by using HTML5 and JavaScript.
You need to prevent users from submitting form data more than once.
Which code segment should you use?
Correct Answer: A
QUESTION 488
You are validating user input by using JavaScript and regular expressions. A group of predefined regular
expressions will validate two input fields:
. An email address in a function named validateEmail
. A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN
You need to use the correct expression to validate the input. Which expression should you insert into each
function? (To answer, drag the appropriate regular expression statement to the correct location. Each regular
expression statement may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
A. (First Text Box)Expression-B, (Second Text Box)Expression-D By CPP
Correct Answer: A
Explanation/Reference:
QUESTION 489
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service using binary format if possible
. Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, select the
appropriate options from the drop-down lists in the answer area.)
A. (First DropDown Box)Expression-D, (Second DropDown Box)Expression-A by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 490
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
. All runners must enter their age.
. Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
. The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements. What should you do? (To answer, drag the
appropriate word or number to the correct location in the answer area. Each word or number may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A. (First Text Box)Expression-A, (Second Text Box)Expression-D,(Third Text Box)Expression-E, (Fourth Text
Box)Expression-J,(Fifth Text Box)Expression-G, (Second Text Box)Expression-K by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 491
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which lines of code should you use? (To answer, select
the appropriate options from the drop-down lists in the answer area.)
A. (First DropDown Box)Expression-A, (Second DropDown Box)Expression-B by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 492
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker:
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks. Which code segment should you use? (To
answer, select the appropriate option from the drop-down list in the answer area.)
A. (First Dropdown Box)Expression-B, (Second Dropdown Box)Expression-A,(First Dropdown Box)
Expression-E by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 493
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, select the appropriate options from the drop-down lists in the answer area.)
A. Switch -> Case -> Break -> Case -> Break -> Default. by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 494
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements. How should you write the code? (To answer, drag the
appropriate code segment or segments to the correct location in the answer area. Each code segment may be
used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view
content.)
A. throw new Error(200,"Invalid"); (For only Microsoft IE-Browsers) otherwise throw new Error("Invalid",200);
(For all other Browsers) by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 495
You are developing a web page that will be accessed from various types of devices. You have the following
requirements:
. The appropriate display resolution must be selected dynamically based on the device connecting to the page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device. How should you build the code? (To answer, select the appropriate
options from the drop-down lists in the answer area.)
A. (First Dropdown Box)Expression-A, (Second Dropdown Box)Expression-C by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 496
You are developing an HTML5 web application and are styling text. You need to use the text- transform CSS
property. Which values are valid for the text-transform property?
A. hidden
B. blink
C. lowercase or Capitalize(in some papers)
D. line-through
Correct Answer: C
QUESTION 497
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
. The appropriate display resolution must be selected dynamically based on the device that is connecting to the
page.
. Mobile devices with a maximum width of 480 pixels must be able to use the page. You need to ensure that the
page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct location. Each
media statement may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
A. (First Text Box)Expression-A, (Second Text Box)Expression-C by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 498
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page. The application must:
. Retrieve and parse data from the web service by using binary format if possible
. Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, drag the
appropriate code segment to the correct location. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
A. (First Text Box)Expression-D, (Second Text Box)Expression-A by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 499
You are developing an application that reads information from a file.
The application must:
. Execute a block of code if there is an error accessing the file
. Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met. Which three statements should you
implement in sequence? (To answer, move the appropriate statements from the list of actions to the answer
area and arrange them in the correct order.)
A. I would say answer is try -> catch -> finally by CPP
Correct Answer: A
QUESTION 500
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements. How should you write the code? (To answer, select
the appropriate option from the drop-down list in the answer area.)
A. throw new Error(200,"Invalid"); (For only Microsoft IE-Browsers) otherwise throw new Error("Invalid",200);
(For all other Browsers) by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 501
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object. You have the following requirements:
. The function must return "Number" if the object is a number
. The function must return "String" if the object is a string
. The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A. switch -> case -> break -> case -> break -> defaule. by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 502
You are developing an application for an online retailer. The company ships only to certain countries. The
application must:
. Store a list of country codes in an array
. Validate the country code of the shipping address against the countries array
. Include a Boolean value in the array that indicates whether or not you can ship to the country
. Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to
You need to develop the application to meet the requirements. Which code segment or segments should you
use? (To answer, drag the appropriate code segment or segments from the list of code segments to the correct
location or locations in the work area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. (First Text Box)Expression-A, (Second Text Box)Expression-B by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 503
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker;
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks. Which line of code should you use? (To answer,
drag the appropriate line or lines of code to the correct location or locations. Each line of code may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A. (First Text Box)Expression-B, (Second Text Box)Expression-A,(Third Text Box)Expression-A by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 504
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which line or lines of code should you use? (To
answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area. Each line of code may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
show
A. (First Text Box)Expression-A, (Second Text Box)Expression-A,(Third Text Box)Expression-B by CPP
Correct Answer: A
Explanation/Reference:
QUESTION 505
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 506
What tool does the service manual recommend you use to separate plastics and lift components of
PowerBook and iBook computers?
A. Nylon probe tool
B. Jeweler screwdriver
C. Flatblade screwdriver
D. Precision needle nose pliers
Correct Answer: A
QUESTION 507
Which TWO of the following are true statements about screws inside a PowerBook or iBook?
A. All screws are interchangeable.
B. It is not necessary to replace all screws after a repair.
C. Screws should always be only comfortably tightened.
D. Screws should always be tightened as much as possible.
E. Screws should always be replaced exactly where they came from.
F. Torx and Hex (Allen) screws can both be driven by either type of driver.
Correct Answer: CE
QUESTION 508
Identify the correct procedure for starting up a PowerBook in Target Disk Mode.
A. Press the D key during startup.
B. Press the T key during startup.
C. Press the Control and D keys during startup.
D. Press the Control and T keys during startup.
E. Press the Command and D keys during startup.
F. Press the Command and T keys during startup.
Correct Answer: B
QUESTION 509
Which THREE of the following features are available in the Aluminum PowerBook G4 models but not in
the iBook G4 models?
A. USB ports
B. Audio Input
C. PCMCIA slot
D. Built-in modem
E. Built-in Ethernet
F. FireWire 800 port
Correct Answer: BCF
QUESTION 510
What function does Target Disk Mode perform?
A. It enables direct connectivity with a remote Macintosh over the Internet.
B. It converts a PC-formatted hard disk for use when connected to a Macintosh.
C. It allows access to a Macintosh's internal hard disk from the Finder of a connected Macintosh via FireWire.
D. It allows two external FireWire hard disks to be connected and transfer data directly between them without
need of a computer.
Correct Answer: C
QUESTION 511
Which of the following iBook or PowerBook models requires the use of the 65 watt AC power adapter?
A. iBook (14-inch)
B. iBook G4 (Early 2004)
C. PowerBook G4 (12-inch)
D. PowerBook G4 (1 GHz/867 MHz)
Correct Answer: D
QUESTION 512
Which of the following iBook or PowerBook models requires the use of the 65 watt AC power adapter?
A. iBook G4
B. iBook G4 (14-inch)
C. PowerBook G4 (DVI)
D. PowerBook G4 (15-inch FW800)
Correct Answer: D
QUESTION 513
Which TWO of the following features are available in the Aluminum PowerBook G4 models but not in the
Titanium PowerBook G4 models?
A. USB ports
B. PCMCIA slot
C. Built-in modem
D. FireWire 800 port
E. Built-in Bluetooth
F. Built-in wireless networking
Correct Answer: DE
QUESTION 514
The basis for the component isolation troubleshooting technique is an understanding of _______ within
computers.
A. power flow
B. software data flow
C. firmware data flow
D. processor instruction flow
Correct Answer: A
QUESTION 515
When setting up a minimal system using the component isolation technique, you start with only the
components necessary to _____.
A. boot the system into Mac OS 9
B. boot the system into Mac OS X
C. boot the system into Open Firmware diagnostics
D. hear a boot chime and/or see a flashing question mark on a display
Correct Answer: D
QUESTION 516
In the component isolation technique, if you do not get a startup chime and/or a flashing question mark,
you check the components of the minimal system by _____.
A. visually inspecting them for damage
B. replacing them with known-good parts in any order
C. adding more known-good parts in a specified order
D. replacing them with known-good parts in a specified order
Correct Answer: D
QUESTION 517
When practicing component isolation, which ONE of the following components would NOT be a part of
a minimal system configuration for a PowerBook G4 (12-inch 1.5GHz)?
A. SDRAM
B. Speaker
C. Hard Drive
D. DC-in Board
E. Backup battery
F. Power adapter
Correct Answer: C
QUESTION 518
A customer is experiencing intermittent battery drain while using her PowerBook G4 (17-inch 1.67 GHz)
connected to a working power adapter. You have reset the PMU and the problem persists. What is the most
likely cause of the problem?
A. Corrupt OS
B. Faulty PMU
C. Faulty logic board
D. Incompatible power adapter
Correct Answer: D
QUESTION 519
To isolate a video problem to hardware or software on a PowerBook G4 (17-inch 1.67GHz), which of the
following steps should you try FIRST?
A. Replace the built-in display.
B. Reinstall the appropriate Mac OS.
C. Verify the hard disk with Disk First Aid.
D. Start up from a known-good startup disc.
Correct Answer: D
QUESTION 520
Which one of the following troubleshooting steps is NOT appropriate when troubleshooting an iBook or
PowerBook with no video on its built-in display?
A. Hold a bright light against the screen.
B. Check if brightness settings are all the way down.
C. Connect an external display to the iBook or PowerBook.
D. Check the network settings on the iBook or PowerBook.
E. Check the internal video cables & connectors for damage.
Correct Answer: D
QUESTION 521
A customer's iBook G4 (Late 2004) is freezing intermittently. Which of the following steps should you try
FIRST to identify the problem?
A. Try quick fixes.
B. Repair the iBook.
C. Perform a split-half search.
D. Run appropriate diagnostics.
E. Escalate the problem to Apple.
F. Gather information about the problem.
Correct Answer: F
QUESTION 522
Which of the following is ALMOST CERTAINLY a software-related problem?
A. No video on display
B. Single beep at startup
C. No Internet connectivity
D. iPhoto quits when launched
Correct Answer: D
QUESTION 523
A customer states that he cannot open an AppleWorks file. What is the most productive question to ask
him FIRST?
A. Can you open any files?
B. Can you open other AppleWorks files?
C. What version of AppleWorks are you using?
D. Is your Mac connected to a network?
Correct Answer: B
QUESTION 524
A PowerBook G4 has no video, but powers on with a normal startup chime, and normal startup sounds
from the hard drive. Which of the following steps should you try next?
A. Update the PowerBook G4's firmware.
B. Replace the PowerBook G4 logic board.
C. Replace the PowerBook G4 LCD display.
D. Connect a known-good external display.
Correct Answer: D
QUESTION 525
You have replaced the optical drive in an iBook G4 (Late 2004). In what THREE ways should you test
the repair before returning the system to the customer?
A. Leave the computer on overnight.
B. Verify that the original symptom is resolved.
C. Verify that no new symptoms have occurred.
D. Run all Apple Service Diagnostic tests for the iBook G4 (Late 2004).
E. Run Apple Service Diagnostic optical drive tests for the iBook G4 (Late 2004).
F. Start up the computer in Target Disk Mode to test the internal hard drive.
Correct Answer: BCD
QUESTION 526
You are troubleshooting an intermittent video issue on an PowerBook G4 (17-inch 1.67 GHz). Which
of the following is the most appropriate way to approach this problem?
A. Do nothing. The problem may resolve itself.
B. Run looping diagnostics to verify the issue.
C. Replace the Display Assembly inside the PowerBook.
D. Follow component isolation steps to resolve the issue.
Correct Answer: B
QUESTION 527
Which of the following is ALMOST CERTAINLY a hardware-related problem?
A. No video at startup
B. Error beep at startup
C. Distorted video at startup
D. Blinking question mark at startup
Correct Answer: B
QUESTION 528
You are troubleshooting an iBook G4 that will not boot, and emits error tones when powered on. You
suspect that the customer may have installed incompatible or faulty RAM, but you aren't sure. What
should you do to verify the RAM requirements for this iBook G4?
A. Call Apple.
B. Order Apple RAM.
C. Check Specifications.
D. Count the RAM sockets on the logic board.
Correct Answer: C
QUESTION 529
Which of the following is the best way to eject a disc when normal methods for ejecting it, such as using
the Mac OS X Finder or the keyboard, have not succeeded?
A. Boot into Open Firmware and type 'reset-nvram'.
B. Restart the computer while holding down the trackpad button.
C. Remove and disassemble the optical drive to remove the disc.
D. Remove the computer's front bezel and manually pry the disc out of the drive.
Correct Answer: B
QUESTION 530
Which of the following would be the most appropriate question to ask FIRST, when gathering
information from customers about a problem with their Apple product?
A. What is the issue?
B. What operating system are you using?
C. Did you turn off the computer improperly?
D. Is this the first time you have had this problem?
Correct Answer: A
QUESTION 531
A customer's PowerBook G4 (12-inch 1.5GHz) fails to power on with a known-good power adapter
connected and plugged in. Which of the following steps should be tried FIRST?
A. Replace the logic board.
B. Replace the DC-In Board.
C. Run Apple Service Diagnostic.
D. Perform a keyboard PMU reset.
Correct Answer: D
QUESTION 532
The image displayed on an iBook (Late 2004) appears small and does not fill the screen. Which of the
following best explains the cause of this symptom?
A. The logic board has failed.
B. The display backlight has failed.
C. The iBook's battery power is depleted.
D. An earlier version of system software is installed.
Correct Answer: D
QUESTION 533
A PowerBook G4 (17-inch 1.67GHz) has a malfunctioning logic board. You replace the logic board.
Which of the following diagnostic utilities should you run to verify that the new logic board is functioning
properly?
A. MacTest Pro
B. Disk First Aid
C. TechTool Deluxe
D. Apple Service Diagnostic
Correct Answer: D
QUESTION 534
Verifying that a computer functions properly after you repair it ensures that _____.
A. No new issues have arisen.
B. Third-party software is working.
C. The original issue has been resolved.
D. The computer falls under service warranty.
E. System Preferences settings are set correctly.
Correct Answer: AC
QUESTION 535
Which of the following is a valid reason to perform a soft reset on an AirPort Extreme Base Station?
A. to update base station firmware
B. to reset the base station password
C. to return the base station to its default settings
D. to erase AirPort client software from Mac OS X
Correct Answer: B
QUESTION 536
AirPort Extreme operates under which TWO of the following IEEE standards?
A. 802.11a
B. 802.11b
C. 802.11c
D. 802.11g
E. 802.11h
F. 802.11i
Correct Answer: BD
QUESTION 537
A customer states that he cannot transfer files over the Internet after connecting his new iBook G4 (Late
2004) to his cable modem via Ethernet. According to the Apple General Troubleshooting Flowchart, which
of the following is the most efficient area to pursue FIRST?
A. The Internet Connect application is not running.
B. The iBook is not running the latest version of Mac OS X.
C. The computer and cable modem are not compatible with each other.
D. The iBook network system preferences are not configured properly.
Correct Answer: D
QUESTION 538
A customer states that he cannot access the Internet after connecting his new PowerBook G4 (12-inch
1 GHz) to his cable modem via Ethernet. Which of the following is most likely the cause of this problem?
A. AppleTalk is not enabled on the computer's Ethernet port.
B. The computer is not running the latest version of Mac OS X.
C. A faulty cable was used to connect the computer and the cable modem.
D. The cable modem's Ethernet port is not compatible with the computer's Ethernet port.
Correct Answer: C
QUESTION 539
A customer complains that his PowerBook G4 (17-inch) will not allow a number of other workers in his
office to share his files simultaneously. All the other computers are iMac G5 that are networked and
configured properly. According to the Apple General Troubleshooting Flowchart which of the following is
the best area to explore FIRST?
A. Does the customer have a firewall enabled?
B. Is the customer's PowerBook Ethernet port faulty?
C. How many simultaneous users does the customer's network have?
D. What version of Mac OS X is the customer's PowerBook running?
Correct Answer: C
QUESTION 540
A customer claims that her iBook G4 cannot connect to her AirPort Express network at home. Which
of the following would be the BEST question to ask her FIRST?
A. Can any other computer successfully join this network?
B. Does your ISP support wireless access to the Internet?
C. What type of wireless card is installed in your iBook G4?
D. Have you upgraded to Mac OS X v10.4.2?
Correct Answer: A
QUESTION 541
Which of the following AirPort Extreme ports should be used to connect to a DSL or Cable modem for
Internet access?
A. LAN
B. WAN
C. Modem
D. Antenna
Correct Answer: B
QUESTION 542
To utilize Gigabit Ethernet, you must use an Ethernet cable with:
A. two wires (one pair) present.
B. four wires (two pairs) present.
C. six wires (three pairs) present.
D. eight wires (four pairs) present.
Correct Answer: D
QUESTION 543
Basic computer-to-computer wireless networking with AirPort requires _____.
A. two or more AirPort clients
B. two or more AirPort Base Stations
C. version 2.0.4 or later of the AirPort software
D. an AirPort Base Station and an AirPort client
Correct Answer: A
QUESTION 544
A customer states that when an external antenna is connected to her AirPort Extreme Base Station, the
external antenna does not appear in the Show Summary screen of AirPort Admin Utility. What is the most
likely problem?
A. The base station's firmware needs to be updated.
B. The base station is malfunctioning and requires service.
C. The base station needs to be powered down and restarted.
D. The base station needs to be upgraded to use the external antenna.
Correct Answer: C
QUESTION 545
A customer states that she sees an error message appear when she opens her Web browser with her
iBook G4 using dial-up Internet service. The message displayed in the Web browser is "The specified
server could not be found." When she attempts to access the same Web page a second time the Web
page is loaded without a problem. Which of the following is the BEST explanation for what is happening?
A. The iBook needs to warm up before it can access the Web page.
B. The Web browser is configured to only access Web pages when reloaded.
C. The iBook dial-up modem is configured for extra error correction resulting in the delay.
D. The Web browser attempted to load the page before the iBook dial-up modem had finished connecting to
the Internet Service Provider.
Correct Answer: D
QUESTION 546
What is the proper way to calibrate a lithium Ion battery used in a PowerBook G4 or iBook?
A. Charge the battery while running the Battery Calibration Utility.
B. The battery is calibrated out of the box; no further steps are needed.
C. Charge the battery fully. Run computer on battery until it goes to sleep. Charge it fully again.
D. Charge the battery overnight. Make sure battery status indicates 100% before disconnecting AC adapter.
Correct Answer: C
QUESTION 547
Which THREE of the following have an effect on the lifespan of Lithium Ion batteries used in
PowerBooks and iBooks?
A. Memory effect
B. Processor speed
C. Energy Saver settings
D. Temperature extremes
E. Number of discharge cycles
Correct Answer: CDE
QUESTION 548
Which of the following steps is NOT recommended to maximize battery life in a PowerBook G4?
A. Reduce brightness settings
B. Turn AirPort card off if installed
C. Disconnect any bus-powered USB peripherals
D. Remove any PC (PCMCIA) card from the PC card expansion slot.
E. Choose 'Highest Performance' in the Energy Saver System Preferences
Correct Answer: E
QUESTION 549
What does recalibrating a Lithium Ion battery inside a PowerBook or iBook actually do?
A. Reconditions the battery to overcome the memory effect.
B. Keeps the onscreen battery time and percent display accurate.
C. Extends the number of full discharge cycles available in the battery.
D. Readjusts the Energy Saver preferences to correspond to the battery's performance.
Correct Answer: B
QUESTION 550
How often should you calibrate a PowerBook G4's Lithium Ion battery?
A. Never
B. Just once when you first use the PowerBook
C. Whenever the PowerBook is forced into sleep mode
D. When you first use the PowerBook and then every couple of months thereafter
Correct Answer: D
QUESTION 551
A customer asks about RAM speed requirements to upgrade his iBook G4 (Late 2004). What Apple
resource should you refer this customer to?
A. Downloads
B. Discussions
C. User's manual
D. Service manual
Correct Answer: C
QUESTION 552
You require additional information about a specific problem with a customer's iBook G4. Which one of
the following resources is the Apple-recommended choice for researching the problem?
A. Downloads
B. Discussions
C. User's manual
D. Knowledge Base
Correct Answer: D
QUESTION 553
According to Apple service manuals, what steps should you take before performing any take-apart steps
when replacing a part in any Apple product?
A. Lay the product on its side so it will not fall over.
B. Update the product's firmware to the latest version.
C. Discharge the CRT and establish an ongoing ground.
D. Gather all necessary tools and perform all preliminary steps.
E. Order all available service parts for the appropriate configuration of the product.
Correct Answer: D
QUESTION 554
Which section of the PowerBook G4 (12-inch 1.5 GHz) Service manual is the BEST place to look for
instructions for replacing a DC-In board?
A. Views
B. Basics
C. Take Apart
D. Troubleshooting
Correct Answer: C
QUESTION 555
Where is the BEST place to look for information regarding special take-apart tools for an Apple product?
A. Discussions
B. Service News
C. User's manual
D. Service manual
Correct Answer: D
QUESTION 556
Which of the following can permanently damage an LCD display?
A. Rubbing the display.
B. Using a screen saver.
C. Not using a screen saver.
D. Turning brightness up too high.
Correct Answer: A
QUESTION 557
Identify the correct procedure to reset the Power Manager on a PowerBook G4 (12-inch 1.5GHz).
A. Press the PMU Reset button on the main logic board.
B. Shut the computer down and press the reset button for 10 to 15 seconds.
C. Shut the computer down and press Shift-Control-Option-Power on the keyboard.
D. Remove the AC power adapter and battery, and let the computer sit for a minimum of 15 minutes.
Correct Answer: C
QUESTION 558
An iBook operating on battery power is in sleep mode and cannot be awakened. Which of the
following is most likely the cause of this problem?
A. The iBook is malfunctioning.
B. The iBook has a crashed PMU.
C. The iBook's battery is too low to operate the iBook.
D. The iBook's security features have been activated.
Correct Answer: C
QUESTION 559
Which THREE of the following symptoms would be best resolved by performing a PMU reset as a first
step?
A. Computer does not turn on
B. Fans run too loudly after startup
C. Network / Internet connectivity issues
D. USB and/or FireWire port(s) do not function
E. Computer does not sleep / wake from sleep
Correct Answer: ADE
QUESTION 560
What is the function of the PMU in an Apple portable computer?
A. The PMU controls all aspects of power flow.
B. The PMU controls the speed of the hard drive.
C. The PMU manages the amount of virtual memory used.
D. The PMU manages all communication with attached peripherals.
Correct Answer: A
QUESTION 561
An iBook G4 is running from the AC adapter, and has a battery installed which is charging. Which TWO
of the following indicate that the battery is fully charged?
A. The iBook backlight will return to full intensity.
B. All lights on the battery will illuminate when the button on the battery is pressed.
C. The sleep light will blink three times, indicating that the iBook is no longer charging.
D. The lighted ring on the power adapter connector will change from amber to green.
E. The sleep light will solidly illuminate, indicating that the iBook can be powered on or awakened from sleep.
Correct Answer: BD
QUESTION 562
Which THREE of the following actions can put a PowerBook to sleep?
A. Close the PowerBook lid.
B. Press Command-Option-S.
C. Select Sleep from the Apple menu.
D. Select Sleep from the Location Manager.
E. Select Sleep in the Energy Saver pane of System Preferences.
F. Press the Power button and select Sleep from the dialog box.
Correct Answer: ACF
QUESTION 563
A customer needs to transfer data from her PowerBook G4 (17-inch 1.67 GHz) for use on her Power
Mac G5, but the PowerBook fails to start up completely due to a video issue. Which of the following would
most easily accomplish the data transfer?
A. Remove the hard drive from the PowerBook and install it into the Power Mac G5.
B. The PowerBook will need to be repaired before any data can be recovered from it.
C. Boot the PowerBook into Mac OS X Safe Mode and connect the PowerBook and Power Mac G5 with an
Ethernet cable.
D. Boot the PowerBook into Target Disk Mode and connect the PowerBook and Power Mac G5 with a FireWire
cable.
Correct Answer: D
QUESTION 564
Which of the following Apple diagnostic utilities is the most appropriate for a service technician to test an
iBook (G4)?
A. Mac Test Pro
B. Tech Tool Deluxe
C. Apple Hardware Test
D. Apple Service Diagnostic
Correct Answer: D
QUESTION 565
What is the first step to take if you have an iBook G4 that constantly ejects any CD / DVD that is
inserted?
A. Replace the logic board.
B. Replace the optical drive.
C. Replace the optical drive cable.
D. Disconnect all peripheral devices, especially the mouse.
Correct Answer: D
QUESTION 566
You are replacing the logic board in a PowerBook G4 (12-inch 1.5 GHz). Which of the following
special tools is recommended during disassembly?
A. Nylon probe tool
B. Torque screwdriver
C. Spring tensioning tool
D. Jumper adjustment tool
Correct Answer: A
QUESTION 567
Which of the following diagnostic utilities can be used by all customers to verify functionality of their own
PowerBooks and iBooks?
A. Mac Test Pro
B. Apple Display Utility
C. Apple Hardware Test
D. Apple Service Diagnostic
Correct Answer: C
QUESTION 568
An iBook (G4) displays a flashing question mark at startup. Which step does Apple recommend you
take FIRST?
A. Replace the logic board.
B. Try to start up from a bootable CD or DVD.
C. Reinitialize the hard disk and reinstall the Mac OS.
D. Replace the internal hard drive with a known-good hard drive.
Correct Answer: B
QUESTION 569
You are troubleshooting an PowerBook G4 system that has Mac OS X. The icon of a connected
external FireWire drive is not appearing on the Finder Desktop. Which of the following would be MOST
useful in troubleshooting this issue?
A. Terminal
B. Network Utility
C. Process Viewer
D. System Profiler
E. Apple Hardware Test
Correct Answer: D
QUESTION 570
A customer brings her iBook G4 (Late 2004) in with severely distorted sound. You boot to a
known-good disc to rule out software, but the issue persists. Which of the following parts is most likely to
be causing the problem and should be replaced?
A. Top Case
B. Logic board
C. Sound board
D. Inverter board
Correct Answer: A
QUESTION 571
What is the purpose of Sudden Motion Sensor technology used in the newer PowerBook G4 models?
A. It physically locks the PowerBook down while it is activated.
B. It helps prevent hard drive failures if the computer is dropped.
C. It helps conserve energy by sensing when the hard disk spins up too often.
D. It Changes all Mac OS X location settings based upon your current GPS location.
Correct Answer: B
QUESTION 572
A customer's iBook G4 (Late 2004) will not charge when the AC adapter is plugged in. You test the
iBook with a known good battery and known good A.C. adapter, but the issue persists. What part is the
most likely to have failed?
A. DC board
B. Logic board
C. Reed switch
D. Inverter board
Correct Answer: A
QUESTION 573
In the picture below, what is item number 3?
A. USB port
B. FireWire 400 port
C. FireWire 800 port
D. 10/100/1000Base-T Ethernet port
Correct Answer: C
QUESTION 574
What is the function of the inverter board inside a PowerBook or iBook?
A. The inverter board inverts the speaker signal phase.
B. The inverter board powers the LCD display backlight.
C. The inverter board controls the flow of power to the logic board.
D. The inverter board inverts the image that is displayed on the LCD.
Correct Answer: B
QUESTION 575
What is the module shown in this picture?
A. Zip drive
B. Hard drive
C. Optical drive
D. Blower assembly
E. Lithium Ion battery
Correct Answer: C
QUESTION 576
Which of the following items are appropriate to use for ESD prevention?
A. Metal work surface
B. CRT discharge tool
C. Wrist strap and cord
D. Static-shielding bags
E. Static-shielding bags
Correct Answer: CDE
QUESTION 577
Which FOUR of the following actions help reduce the risk of damage from ESD?
A. Ground yourself and the equipment you are working on.
B. Always place ESD-sensitive components on metal surfaces.
C. Handle all ESD-sensitive boards by the connectors, not the edges.
D. Use static-shielding storage bags for ESD-sensitive components.
E. Do not touch anyone who is working on ESD-sensitive components.
F. Do not bring plastic, vinyl, or foamed polystyrene near ESD-sensitive components.
Correct Answer: ADEF
QUESTION 578
Which of the following is the most common example of electrostatic discharge?
A. You touch an object and feel a brief spark.
B. You see a bright flash on the LCD display of an iBook.
C. You plug a power cord into an outlet and you see a spark.
D. You hear a crackling noise coming from inside the computer.
Correct Answer: A
QUESTION 579
What humidity level should be maintained to ensure an ESD-safe environment?
A. 25%-40%
B. 50%-75%
C. 70%-90%
D. 90%-100%
Correct Answer: C
QUESTION 580
What is the BEST way to properly ground an ESD workbench mat?
A. Attach the mat to the unit being serviced.
B. Connect the mat to a grounded electrical outlet.
C. Connect only the wrist strap and cord to a grounded electrical outlet.
D. Connect the wrist strap and cord only to the mat.
Correct Answer: B
QUESTION 581
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 582
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
. Add a drop shadow that is one inch below the text in the paragraph
. Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 0px lin 5px;
C. text-shadow: 72pt 5em 0px
D. text-shadow:72pt 0em 5px;
Correct Answer: B
Explanation/Reference:
See http://www.w3.org/TR/css3-text/#text-shadow
@guy
there was no correct answer in previous exams.
72pt = 1 inch (in)
A and D did not have a vertical offset.
B and C did not have a blur radius.
text-shadow property (Internet Explorer), http://msdn.microsoft.com/en-us/library/ie/hh771872%28v=vs.85%
29.aspx
QUESTION 583
You are developing an HTML5 page.
You need to add author and copyright information.
Which tag should you use?
A. <aside>
B. <section>
C. <header>
D. <footer>
Correct Answer: D
QUESTION 584
You are validating user input by using JavaScript and regular expressions.
A group of predefined regular expressions will validate two input fields:
. An email address in a function named validateEmail
. A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN
You need to use the correct expression to validate the input.
Which expression should you insert into each function?
(To answer, drag the appropriate regular expression statement to the correct location. Each regular expression
statement may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.)
E.
Correct Answer: BD
Explanation/Reference:
QUESTION 585
DRAG DROP
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
. All runners must enter their age .
. Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
. The slider control must be set to the average age (37) of all registered runners when the page is
first displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in the answer
area. Each word or number may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
A. slider, 18, 90, value, 37, optional
B. slider, 18, 90, value, 37, required
C. range, 18, 90, value, 37, required
D. range, 18, 90, value, 37, optional
E. slider, 18, 90, default, 37, required
F. range, 18, 90, default, 37, required
Correct Answer: C
Explanation/Reference:
QUESTION 586
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 587
HOTSPOT
An HTML page has a canvas element. You need to draw a red rectangle on the canvas element
dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment?
(To answer, select the appropriate options from the drop- down lists in the answer area.)
Correct Answer: ABC
Explanation/Reference:
QUESTION 588
HOTSPOT
You are creating a web worker for an HTML5 application. The following tasks must be performed from within
the web worker:
. Register an event listener for the web worker
. Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down list in the
answer area.)
A. self.postMessage('Worker : ', + data);
B. self.addEventListener('message', function(event));
C. self.attachEvent('Worker', data);
D. self.teminate();
E. self.close();
Correct Answer: ABE
Explanation/Reference:
QUESTION 589
HOTSPOT
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
. The function must return "Number" if the object is a number.
. The function must return "String" if the object is a string.
. The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements.
How should you build the code segment?
(To answer, select the appropriate options from the drop-down lists in the answer area.)
A. switch, case, break, case, break, default
B. switch, case, break, case, break, case
C. switch, case, break, case, break, break
D. switch, case, break, case, default, break
Correct Answer: A
Explanation/Reference:
http://www.w3schools.com/js/js_switch.asp
QUESTION 590
You are developing an application that uses a third-party JavaScript library named doWork().
The library occasionally throws an "object is null or undefined" error with an error code of -2146823281.
The application must:
Extract and handle the exceptions thrown by doWork()
Continue normal program execution if other exceptions occur
You need to implement the requirements.
Which code segment should you use?
A. if( doWork() == -2146823281) {
...
}
B. if( doWork() == "object is null or undefined") {
...
}
C. try {
doWork();
} catch(e) {
if(e.number == -2146823281)
. ..
}
D. try {
doWork();
} catch(e) {
if(e.message == -2146823281)
. ..
}
Correct Answer: C
Explanation/Reference:
Mary-Q124/25. Annie-Q16
QUESTION 591
DRAG DROP
You are developing an online shopping application that accepts credit cards for payment. If the credit card
number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code?
(To answer, drag the appropriate code segment or segments to the correct location in the answer area.
Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. throw new Error (200, "Invalid");
B. throw new Error ("Invalid", 200);
C. throw new Error ("Invalid", "Invalid");
D. throw new Error ("Invalid", break);
Correct Answer: A
Explanation/Reference:
http://www.w3schools.com/html/html5_new_elements.asp
QUESTION 592
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 593
You are developing a web page that has a group of H1 and H2 elements.
The page also includes a CSS class named underlineMe.
You have the following requirements.
The font color of all H1 and H2 elements must be changed to red.
The CSS class underlineMe must be applied to all H1 and H2 elements.
You need to update the web page to meet the requirements.
Which code segment should you use?
Correct Answer: D
Explanation/Reference:
http://www.w3schools.com/jquery/sel_header.asp
Mary-Q140/41. Annie-Q28
QUESTION 594
DRAG DROP
You are developing a web page by using HTML5 and CSS3.
Styles must be defined for all hyperlinks on the page so that the applied style reflects the last user action.
You need to style the four anchor elements in the document.
In what order should you specify the four anchor selectors?
(To answer, move the appropriate anchor selectors from the list of CSS codes to the answer area and arrange
them in the correct order.)
A. A:link
A:visited
A:hover
A:active
B. A:link
A:hover
A:active
A:visited
C. A:link
A:hover
A:visited
A:active
D. A:hover
A:visited
A:active
A:link
Correct Answer: A
Explanation/Reference:
You can learn about the anchor pseudo-classes here: http://www.w3schools.com/css/css_pseudo_classes.asp
As it states:
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!
QUESTION 595
DRAG DROP
You are developing a web application that retrieves data from a web service.
The data being retrieved is a custom binary datatype named bint.
The data can also be represented in XML. Two existing methods named parseXml() and parseBint() are
defined on the page.
The application must:
. Retrieve and parse data from the web service by using binary format if possible
. Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do?
(To answer, drag the appropriate code segment to the correct location.
Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
E.
F.
Correct Answer: AD
Explanation/Reference:
QUESTION 596
DRAG DROP
You are developing an application that reads information from a file.
The application must:
. Execute a block of code if there is an error accessing the file
. Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence?
(To answer, move the appropriate statements from the list of actions to the answer area and arrange them in
the correct order.)
A. try, catch(e), debug
B. try, catch(e), catch(e)
C. try, catch(e), finally
D. try, catch(e), throw
Correct Answer: C
Explanation/Reference:
try
catch(e)
finnaly
The fileopen statement is put within the try clause.
The catch(e) will catch a fileopen error.
The finally clause will be executed regardless of whether an error occurs in the try clause proceeding it
QUESTION 597
HOTSPOT
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
. Generate an error
. Assign "200" to the error number
. Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code?
(To answer, select the appropriate option from the drop-down list in the answer area.)
A. throw new Error (200, "Invalid");
B. throw new Error ("Invalid", 200);
C. throw new Error ("Invalid", "Invalid");
D. throw new Error (break, "Invalid");
Correct Answer: A
QUESTION 598
DRAG DROP
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
. The function must return "Number" if the object is a number
. The function must return "String" if the object is a string
. The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
A. switch, case, break, default, case, break
B. switch, case, break, case, break, default
C. switch, default, case, break, case, break
D. switch, default, case, break, case, default, break
Correct Answer: B
Explanation/Reference:
http://www.w3schools.com/js/js_switch.asp
QUESTION 599
DRAG DROP
You are developing an airline reservation website by using HTML5 and JavaScript.
A page on the site allows users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
. Users must be able to save information in the application about their favorite destination airport .
. The airport information must be displayed in the destination text box whenever the user returns to
the page.
You need to develop the site to meet the requirements. Which line or lines of code should you use?
(To answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area.
Each line of code may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Correct Answer: AB
Explanation/Reference:
QUESTION 600
DRAG DROP
An HTML page has a CANVAS element.
You need to draw a red rectangle on the CANVAS element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment?
(To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
E.
Correct Answer: ABC
Explanation/Reference:
http://www.w3schools.com/html/html5_canvas.asp
QUESTION 601
A. static
B. fixed
C. absolute
D. relative
Correct Answer: C
QUESTION 602
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 603
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 604
DRAG DROP
You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new window.
Which jQuery code segment or segments should you use?
(To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Correct Answer: AB
Explanation/Reference:
QUESTION 605
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 606
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
. Add a drop shadow that is one inch below the text in the paragraph
. Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 5px lin 0px;
C. text-shadow: 72pt 5em 0px
D. text-shadow:72pt 0em 5px
Correct Answer: D
Explanation/Reference:
See http://www.w3.org/TR/css3-text/#text-shadow
All options are incorrect
correct answers are D???
#obj { text-shadow: <x-offset> <y-offset> <blur-radius> <color>; }
<x-offset> +n right -n left
<y-offset> +n bottom -n top
1 inch below means <y-ffset> is 1in or 72 pt
Hence actually answer must be
0px,1in,5px 0r 0px, 72pt, 5px
QUESTION 607
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 608
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <nav>
B. <section>
C. <td>
D. <tbody>
Correct Answer: B
Explanation/Reference:
http://www.w3schools.com/tags/tag_article.asp
http://www.w3schools.com/html/html5_new_elements.asp
QUESTION 609
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 610
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 611
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 612
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 613
Question about how to get the data with ajax, the correct answer should be very similar
(see http://www.w3schools.com/ajax/ajax_xmlhttprequest_create.asp):
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
xmlDoc = xmlhttp.responseXml
// set the div's values
Correct Answer:
QUESTION 614
There were 3 boxes that were one-by-one. In order to achieve the nice flow of them I selected flex-box attribute
values
- stretch and then
- justify
Correct Answer:
QUESTION 615
Get the data from web service. The difference was with the Http method and the way you passed the
arguments (here below is just the idea),
a) $.ajax( url ="http://contoso.com/webservice.asmx/GetProducts", type ="POST", data ={ cat ='A'})
b) $.ajax( url ="http://contoso.com/webservice.asmx/GetProducts", type ="SEND", data ={ cat ='A'})
c) $.ajax( url ="http://contoso.com/webservice.asmx/GetProducts?cat='A'", type ="POST")
d) $.ajax( url ="http://contoso.com/webservice.asmx/GetProducts?cat='A'", type ="SEND")
I marked Post and data ={}
Correct Answer:
QUESTION 616
One conceptual how to send data from contoso.com to fabricam.com. I do not remeber all answers:
a) websockets
b) CQRS?
c) REST
d) crossdomain.xml
Correct Answer:
QUESTION 617
There was svg and circle inside of it. You had to increase circle size by 1,5.
a) c.r = c.r *1,5
b) c.setAttribute()
c) c.setTransformSthIdontRemember
d) svg.setAttribute()
Correct Answer:
QUESTION 618
How to capture click on canvas
Correct Answer:
QUESTION 619
Change color of canvas when mouse is over or is movin with one event (i selected onmouseover, but there was
onmousemove and onmouseout).
Correct Answer:
QUESTION 620
There was a form with checkbox and input field. The main taks was to disable input if checkbox is not checked.
There was some part of css like
input:placeholder {
bg-color: gray
}
and i chose placeholder = disabled (http://www.w3schools.com/cssref/sel_disabled.asp)
and the secod part was to disable this input by checkbox
if(cheb.checked){
i. disabled = false;
}
else{
i. disabled = true;
}
A.
B.
C.
D.
Correct Answer:
QUESTION 621
There was div with two ul-s
<div id="d">
<ul> <li>/<li>
<ul>..<ul>
</div>
The task was to append the border with 1px the first ul on the page
a) answer with $.each(div) then $.each ul
b) answer with first-of-type()
c) direct border="1px" assignment to the ul
d) div#d > ul css selector
Correct Answer:
QUESTION 622
One multiselectable with table that has header only, and yo have json like:
<table id="t">
<tr>
<th>Friut</tr>
<th>Quantity</tr>
</tr>
</table>
var fruits = {"bananas", 12, "oranges" 11}. You need to add them to the table
he answer was like (IMHO):
$. each(fruits, function(key,val){
$(#t).after("<tr>" + key + "</tr>" +...)
});
But were also
$. Json()
var data = parseJSON()
append()
A.
B.
C.
D.
Correct Answer:
QUESTION 623
The most stupid was with images you had response from Ajax call with JSON format, and had function that was
appending object to some div:
function ImageData(image){
// requested code
}
var imgageData = new ImageData(json);
and $(#div).html(imageData.img);
This question IMHO was not possible to do, beacause you could only select 3 answers but this required 4 to
complete the task:
1) var img = document.CreateElement(img)
2) img.src = image.FileName;
img.alt = image.Description;
????????
3) return this.img;
one missing part that was available was this.img = img that I could not set between 2 and 3 because of 3
elements limitation.
others answers were
return img.HTMLImage()
this.img = document.CreateElement(img)
this.img.Description = image.Description
.. .
A.
B.
C.
D.
Correct Answer:
QUESTION 624
One question with the processing UI related things with web workers, what should they process (select 2):
a) canvas operations
b) long and large data localStorage write/writes
c) long mathematical operations with looping through array
d) applying DOM styles
Correct Answer:
QUESTION 625
Theres a code snipet and the requirements: if the value is greather then 500 show "DENIED". If the value is
less than 300 show "aproved with warnings" and if the value is greater than 300 and less then 300 show
"aproved".
It`s a drag and drop question. Just drag if (foo > 500), then else if (foo <300) and else { }.
Correct Answer:
QUESTION 626
Q. 2 You develop an HTML5 webpage. You have the following JavaScript code:
You need to handle the click event when a user clicks the show/Dialog button.
Which code segment should you insert at line 02?
A. $ (document).trigger("click", "#showDialog", function (e) {
B. $ (document).on ("#showDialog", "click", function (e) {
C. $(document).toggle("click", "#showDialog", function (e) {
D. $(document).on("click", "#showDialog", function (e) {
Correct Answer: D
QUESTION 627
Q. 3 You are developing an application that processes order information. Thousands of orders are processed
daily. The application includes the following code segment. (Line numbers are included for reference only.)
The application must:
Display the number of orders processed and the number of orders remaining Update the display for every 25th
record processed
You need to develop the application to meet these requirements.
Which line of code should you insert at line 04?
A. If (!(counter % 25))
B. if (counter == 25)
C. if (counter >> 25 == 0)
D. if (counter >> 25 == 0)
Correct Answer: A
QUESTION 628
AQ.4
You develop an HTML5 webpage. You have the following HTML markup:
<input type="text" id="username" />
You need to prevent users from entering specific characters into the username field.
What should you do?
A. Using the keyup event, add an anonymous function that returns true when a specific character keycode
value is determined.
B. Using the change event, add an anonymous function that returns true when a specific character keycode
value is determined.
C. Using the keydown event, add an anonymous function that returns false when a specific character keycode
value is determined.
D. Using the change event, add an anonymous function that returns false when a specific character keycode
value is determined.
Correct Answer: B
QUESTION 629
Q. 6
You develop a webpage by using HTML5.
The user interface of the webpage must show a gray-lined box that contains the label Enter your
information:. Inside the box are two labels and two input boxes. The first input box must be labeled
Name:. The second input box must be labeled Email:. Below the box is a Submit button.
The user interface must look like the following;
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: B
QUESTION 630
Q. 7
You are developing an application to track project management for your company. The status of the
project is stored in a variable named percentComplete.
The method must execute only when percentComplete is equal to the numeric value 100.
You need to develop the application to meet the requirement.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Correct Answer: D
QUESTION 631
Q8.
DRAG DROP
You develop a website for a company by using HTML5.
You have the following requirements:
Allow multiple news postings per page under the title "Welcome to the Semantic Web!".
Search engines must be able to index individual news postings.
News postings must be styled by using the following CSS markup:
.posting { line-height: 150%; )
You need to structure the markup for each individual news posting.
How should you complete the relevant markup? (To answer, drag the appropriate markup to the
correct location or locations in the answer area. Use only markup that applies.)
Select and Place:
Correct Answer:
QUESTION 632
Q. 9
You have a webpage that includes the following markup and code:
You need to troubleshoot the code by clicking the Submit button.
Which value will be displayed?
A. 10
B. 20
C. Undefined
D. Runtime error
Correct Answer: A
QUESTION 633
Q. 10
You develop an HTML5 webpage with custom CSS. You have the following HTML markup:
<div class="new" Item">...</div>
You have the following requirements:
In addition to your CSS, you must use a corporate branded stylesheet named corporate.ess.
The corporate.ess file contains the style rule that must be used for .newsItem.
You must use the corporate.ess file to ensure that the webpage changes when the brand changes.
You must add additional style rules to the webpage.
You cannot modify the corporate.ess file.
You need to apply the appropriate CSS rules to meet the requirements.
What should you do?
A. Add a CSS class named .newsItemUpdates to the webpage, add only the new styles to this class,
and update the class attribute of the HTML markup:
<div class=nnewsltem newsItemUpdates">..,</div>
B. Update the corporate.ess file to include! important for each rule for the .newsItem. class, and add
the new CSS rules to the webpage by using the CSS class .newsItem.
C. Add a CSS class named .newsitemUpdates to the webpage, add the new styles to this class, and
update the HTML markup to replace the .newsItem class with this new class:
<div class*"newsItemOpdates">...</div>
D. Add the new CSS rules to the webpage by using the CSS class .newsItem, and add! important to
each rule.
Correct Answer: D
QUESTION 634
Q. 11
You are developing an e-commerce website. Users place products into a shopping cart.
You need to ensure that the shopping cart data is available between browser sessions.
Which object should you use to store the shopping cart data?
A. clientStorage
B. localStorage
C. applicationStorage
D. sessionStorage
Correct Answer: B
QUESTION 635
Q. 12
You develop an HTML5 webpage. You have the following HTML markup:
A. $ ('input [name!="name"]') .ess ({ 'background-color' : ' #E0ECF8'}) ;
B. ${'input [name~="name"] ') .ess ({ 'background-color' : ' #E0ECF8' }) ;
C. ${'input[name*="name"]').ess({'background=color': #E0ECF8'});
D. $( 'input [name$="name"] ') .ess ({ 'background-color' : '#E0ECF8'});
Correct Answer: D
QUESTION 636
Q. 13
You are developing a web application by using HTML5.
You have the following requirements.
The color of a menu item must change when a user hovers over the item.
The color of the menu item must change back to its original color after five seconds.
You need to ensure that the animation is applied to all menu items.
Which CSS3 code should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
QUESTION 637
Q. 14
HOTSPOT
You are implementing an HTML page that uses a custom sans-serif font. The CSS statement for the
page is as follows.
Some users report that text is displayed in the default font for the browser.
You need to modify the CSS statement to ensure that the content is displayed with the custom font.
Hot Area:
Correct Answer:
QUESTION 638
Q. 15
Your company uses a third-party component that generates HTML for a website. The third-party
component creates DIV elements that display a yellow background.
The third-party component uses inline styles in the DIV elements that are inconsistent with your
corporate standards. You must override the DIV elements in the style sheet with the corporate
styles.
You need to ensure that the website meets corporate standards.
Which style should you
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
QUESTION 639
Q. 17
You are developing a website that helps users locate theaters in their area from a browser. You
created a function named findTheaters ().
The function must:
Get the current latitude and longitude of the user's device
Pass the user's location to findTheaters()
The user needs to access the geolocation information from the browser before searching for
theaters.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: C
QUESTION 640
Q. 18
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: B
QUESTION 641
Q. 19
You are developing a web page that performs CPU-intensive calculations. A web worker processes
these calculations on a separate background thread. The process is instantiated from the web page.
You need to stop the web worker process after the calculations are completed.
Which two actions can you perform to achieve this goal? (Each correct answer presents a complete
solution. Choose two.)
A. From the web page, call the close() method.
B. From the web worker process, call the terminate() method.
C. From the web page, call the terminate() method.
D. From the web worker process, call the close() method.
Correct Answer: CD
QUESTION 642
Q. 20
You are developing an HTML5 page named main.html. The JavaScript code for the main page is
located in a file named myApp.js.
You need to create a web worker and instantiate it from main.html.
Where should you place the web worker code?
A. In the myApp.js file
B. In the main.html file
C. In a separate .js (JavaScript) file
D. In a separate executable file
Correct Answer: C
QUESTION 643
Q. 21
You are developing a JavaScript library.
You have the following requirements:
Custom exceptions must include an error message and custom error number.
These exceptions must be thrown when data validation errors occur.
Developers must call the library to easily catch the exception and identify the problem.
You develop the following code. (Line numbers are included for reference only.)
A. throw new Validatior.Exception (123, "Day of week must be les3 than 7");
B. return new ValidationException(123, "Day of week must be less than 7");
C. throw ValidationException(123, "Day of week must be less than 7");
D. catch ValidationException(123, "Day of week: must be less than 7");
Correct Answer: A
QUESTION 644
Q. 23
You are developing an application that retrieves a stock rate from an external web service. A web
page displays a simple rotating animation to indicate whether the stock rate is increased or
decreased.
The default image, as shown in the following graphic, indicates unchanged or neutral.
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
QUESTION 645
Q. 24
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 646
Q. 24
You develop an HTML5 chat application.
You need to provide real-time updates to the messages that users post in the chat application.
What should you do?
A. Use get o to obtain data updates.
B. Use a RESTful web service.
C. Use WebSockets.
D. Use ajaxo to obtain data updates.
Correct Answer: C
QUESTION 647
Q. 25
You are creating a rotating image of a company logo.
The logo must spin on a horizontal axis and on a vertical axis.
You need to use the least amount of development effort to meet the requirement.
What should you do?
A. Create an Image Spinner object, load the image into the spinner, and set the horizontal and
vertical rotation properties.
B. Create a Canvas Globe transform and set the image as the globe object. Set the horizontal and
vertical rotation properties.
C. Create a single Canvas 3D transform and load the image into it. Set the rotation properties.
D. Create a Canvas 2D transform and set the image to rotate horizontally and vertically.
Correct Answer: C
QUESTION 648
Q. 26
You are developing an HTML5 web application that provides a discussion forum for users. When a
user registers to access the application, the user enters an email address.
Users can enter data that can result in cross-site scripting (XSS) attacks.
You need to ensure that email input is as secure as possible.
Which two techniques should you use? (Each correct answer presents a complete solution. Choose
two.)
A. Remove all nonalphanumeric characters before submitting data.
B. Use the email tag in forms where the email address is entered.
C. Display all email addresses inside of an HTML5 ADDRESS element.
D. Use jQuery validation with a regular expression to ensure that email addresses are valid.
E. Ensure that all form data is encrypted when it is submitted.
Correct Answer: BD
QUESTION 649
Q. 27
You are creating a blog site by using HTML5 and JavaScript. An inline frame enables users to post
comments. It is possible for users to inject malicious scripts into their comments.
You need to minimize the ability for malicious scripts to execute on the site.
Which line of code should you use?
A. <iframe sandbox src="frame1.htmlnX/iframe>
B. <iframe seamless="allowscripts" src="frame1.html"<>/iframe>
C. <iframe seamless src="frame1.html"></iframe>
D. <iframe sandbox="allowscripts" src"frame1.html"x/iframe>
Correct Answer: A
QUESTION 650
Q. 28
You develop an HTML5 application that interacts with a REST service. The REST service accepts JSON
data. A JavaScript object named form Data contains data that is sent to the REST service.
You need to convert the JavaScript object named formData into JSON.
Which code segment should you use?
A. jQuery.ajax.valueOf(formData);
B. window.evai(formData);
C. JSON.stringify (formData);
D. formData.toString();
Correct Answer: C
QUESTION 651
Q. 29
You are developing an HTML page that includes the following code.
<h1 id="header">A Static Page</hl>
You need to modify the content of the HI element dynamically by using JavaScript.
Which code segment should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: D
QUESTION 652
Q. 30
You are developing a web page that will contain an animated logo. The web page currently has a
logo image on a canvas object.
You need to spin the logo image on the canvas.
Which method should you use?
A. context.rotate()
B. context.spin()
C. context.translatePosition()
D. context.setTransform()
Correct Answer: A
QUESTION 653
Q. 31
You create the following JavaScript code:
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Correct Answer: C
QUESTION 654
You troubleshoot a webpage that contains the following HTML element:
<canvas id="clickCanvas" width="300" height= "300">
Your browser does not support the HTML5 canvas.
</canvas>
The following JavaScript code is included in a script tag in the HEAD section of the webpage: (Line numbers
are included for reference only.)
You need to invoke the clickReporter() JavaScript function when a user clicks the mouse on the canvas HTML
element. What should you do?
A. Add the following attribute to the canvas HTML element: clicked="clickReporter()"
B. Replace the code segment at line 06 with the following code segment: drawBox.Click += clickReporter;
C. Insert the following code segment at line 07: canvas.onclick = clickReporter;
D. Insert the following code segment at line 07: canvas.click = clickReporter;
Correct Answer: C
Explanation/Reference:
http://www.w3schools.com/tags/canvas_strokerect.asp
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript">
var canvas;
var context;
window.onload = function initialize() {
canvas = document.getElementById('cl1ckCanvas');
context = canvas.getContext('2d');
drawBox();
canvas.onclick = clickReporter;
}
function clickReporter(e) {
alert('clicked');
}
function drawBox () {
context.fillStyle = 'black';
context.strokeRect(20, 20, canvas.width - 20, canvas.height - 20);
}
</script>
</head>
<body>
<canvas id="cl1ckCanvas" width="300" height= "300">
Your browser does not support the HTML5 canvas.
</canvas>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------
Mary: Answer B (Replace the code segment at line 06...)
Hebert from Mexico - Oct 21, 2013:
Hi, Should be de Answer option C Insert the following code segment at line 07 : canvas.onclick = clickreporter;
And no the option B Replace the code segment at line 06 with the following segment: drawbox.Click +=
clickReporter
if I test the letter B when the page loads appears the alert, I am a little confused, can you help me
Hebert from Mexico - Oct 22, 2013:
Looks some wrong the answer should be Option D and not option B, can any one help with this question?
Mary-Q23/93
QUESTION 655
You are developing a customer web form that includes following HTML.
<input id= "textAccountType"/>
You need to develop the form so that customers can enter only a valid account type consisting of two English
alphabet characters.
Which code segment should you use?
Correct Answer: B
QUESTION 656
You are developing an application that uses a JavaScript library. The library contains the following functions.
The application uses the following code. (Line numbers are included for reference only.)
The library may throw many types of exceptions. The exceptions are grouped by category.
You need to catch and identify the exceptions by group.
Which code segment should you insert at line 05?
Correct Answer: B
QUESTION 657
You are developing a web application that can function when users are not connected to the Internet.
You need to check the Internet connectivity status of a user's browser.
Which method should you use?
Correct Answer: D
Explanation/Reference:
The onLine property returns a Boolean value that specifies whether the browser is in online or offline mode.
http://www.w3schools.com/jsref/prop_nav_online.asp
--------------------------------------------------------------------------------------------------------------------------------------------------
----------------------
Sam&Mary: Answer A (IsOnline)
cch from New Zealand - Oct 15, 2013:
The right answer should be D to me, as navigator doesn't have 'isOnline' property, but 'onLine' []well in D, it's
'online', so not 100% correct as well :(]
trixter from India - Oct 25, 2013:
You are right. Answer is D
Albarhami from United Arab Emirates - Oct 27, 2013:
The 49Q Answer is A not D. Example
<!DOCTYPE html>
<html>
<head>
<script>
function validateForm()
{
var x=document.getElementById("fname").innerHTML;
if (x==null || x=="")
{
alert("First name must be filled out");
return false;
}
}
</script>
</head>
<body>
<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()"
method="post">
First name: <input type="text" id="fname" name="fname">
<input type="submit" value="Submit">
</form>
</body>
</html>
Daniel from Macedonia - Oct 28, 2013:
Correct answer is navigator.onLine, not navigator.isOnline
madi from Norway - Oct 29, 2013:
Yes correct answer is navigator.onLine . Javascript don't have any object navigator.isOnline
Mary-Q49/119
QUESTION 658
You are developing an application that analyzes population data for major cities in the United States.
The application retrieves population statistics for a city by using a web service.
You need to request data from the web service by using jQuery.
Which code segment should you use?
Correct Answer: D
QUESTION 659
You develop a web application by using jQuery. You develop the following jQuery code: (Line numbers are
included for reference only.)
The web application exposes a RESTful web API that has an endpoint of /product/create.
You need to create a new product by using AJAX.
Which code segment should you insert at line 05?
Correct Answer: D
Explanation/Reference:
jQuery.ajax( url [, settings ]) - Perform an asynchronous HTTP (Ajax) request.
settings - a set of key/value pairs that configure the Ajax request. All settings are optional.
async (default: true)
beforeSend - a pre-request callback function
cache (default: true, false for dataType 'script' and 'jsonp')
complete - a function to be called when the request finishes
contents - an object of string/regular-expression pairs that determine how jQuery will parse the response,
given its content type
contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8'). When sending data to the
server, use this content type.
context - this object will be made the context of all Ajax-related callbacks.
converters (default: {"* text": window.String, "text html": true, "text json": jQuery.parseJSON, "text xml":
jQuery.parseXML}) - an object containing dataType-to-dataType converters.
crossDomain (default: false for same-domain requests, true for cross-domain requests) - if you wish to force
a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true.
data - data to be sent to the server. It is converted to a query string, if not already a string.
dataFilter - a function to be used to handle the raw response data of XMLHttpRequest
dataType (default: Intelligent Guess (xml, json, script, or html)) - the type of data that you're expecting back
from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response.
error - a function to be called if the request fails.
global (default: true) - whether to trigger global Ajax event handlers for this request.
headers (default: {}) - an object of additional header key/value pairs to send along with requests using the
XMLHttpRequest transport.
ifModified (default: false) - allow the request to be successful only if the response has changed since the last
request.
isLocal (default: depends on current location protocol) - allow the current environment to be recognized as
"local," (e.g. the filesystem), even if jQuery does not recognize it as such by default.
jsonp - override the callback function name in a jsonp request.
jsonpCallback - specify the callback function name for a JSONP request. This value will be used instead of
the random name automatically generated by jQuery.
mimeType - a mime type to override the XHR mime type
password - a password to be used with XMLHttpRequest in response to an HTTP access authentication
request.
processData (default: true) - by default, data passed in to the data option as an object (technically, anything
other than a string) will be processed and transformed into a query string, fitting to the default content-type
"application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data,
set this option to false.
scriptCharset - only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or
"script" dataType and "GET" type).
statusCode (default: {}) - an object of numeric HTTP codes and functions to be called when the response
has the corresponding code
success - a function to be called if the request succeeds. The function gets passed three arguments: The
data returned from the server, formatted according to the dataType parameter; a string describing the
status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.
timeout - set a timeout (in milliseconds) for the request
traditional - set this to true if you wish to use the traditional style of param serialization
type (default: 'GET') - the type of request to make ("POST" or "GET"), default is "GET".
url (default: The current page) - a string containing the URL to which the request is sent.
username - a username to be used with XMLHttpRequest in response to an HTTP access authentication
request.
xhr (default: ActiveXObject when available (IE), the XMLHttpRequest otherwise) - callback for creating the
XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise.
xhrFields - an object of fieldName-fieldValue pairs to set on the native XHR object.
The serialize() method creates a URL encoded text string by serializing form values.
You can select one or more form elements (like input and/or text area), or the form element itself.
The serialized values can be used in the URL query string when making an AJAX request.
$(selector).serialize()
REST
REST defines a set of architectural principles by which you can design Web services that focus on a system's
resources, including how resource states are addressed and transferred over HTTP by a wide range of clients
written in different languages. If measured by the number of Web services that use it, REST has emerged in
the last few years alone as a predominant Web service design model. In fact, REST has had such a large
impact on the Web that it has mostly displaced SOAP- and WSDL-based interface design because it's a
considerably simpler style to use.
REST didn't attract this much attention when it was first introduced in 2000 by Roy Fielding at the University of
California, Irvine, in his academic dissertation, "Architectural Styles and the Design of Network-based Software
Architectures," which analyzes a set of software architecture principles that use the Web as a platform for
distributed computing (see Resources for a link to this dissertation). Now, years after its introduction, major
frameworks for REST have started to appear and are still being developed because it's slated, for example, to
become an integral part of JavaTM 6 through JSR-311.
A concrete implementation of a REST Web service follows four basic design principles:
Use HTTP methods explicitly.
Be stateless.
Expose directory structure-like URIs.
Transfer XML, JavaScript Object Notation (JSON), or both.
http://api.jquery.com/jQuery.ajax/
http://www.w3schools.com/jquery/ajax_serialize.asp
http://www.ibm.com/developerworks/webservices/library/ws-restful/
Mary-Q58/128
QUESTION 660
You develop a webpage by using HTML5. You create the following markup and code: (Line numbers are
included for reference only.)
You need to ensure that the values that users enter are only numbers, letters, and underscores, regardless of
the order. Which code segment should you insert at line 04?
Correct Answer: A
Explanation/Reference:
The test() method searches a string for a specified value, and returns true or false, depending on the result.
The \w metacharacter is used to find a word character. A word character is a character from a-z, A-Z, 0-9,
including the _ (underscore) character.
var patt = new RegExp(pattern,modifiers);
or more simply:
var patt = /pattern/modifiers;
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
http://www.w3schools.com/js/js_obj_regexp.asp
Mary-Q64/134
QUESTION 661
You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
* Retrieve the content for any OPTION elements when the value of the selected attribute equals selected.
* Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: CD
QUESTION 662
You are developing an HTML5 web application that displays stock information.
The application loads information from a web service by using AJAX.
The following code defines a Stock object and loads stock data.
You need to implement the loadStock function. Which code segment should you use?
Correct Answer: A
Explanation/Reference:
Inside a function, the value of this depends on how the function is called.
A workaround would be:
var that = this;
Link.onclick = function() {
that.changeName();
};
http://stackoverflow.com/questions/13996794/javascript-prototype-this-issue
Mary-Q76/146
QUESTION 663
You develop an interactive scalable vector graphic (SVG) application.
You write the following code (Line numbers are included for reference only.):
You need to increase the size of the circle by 50 percent. Which code segment should you insert at line 02?
Correct Answer: B
Explanation/Reference:
currentScale property gets or sets the current scale factor, relative to the initial view (when this property is
called from an outermost svg element).
The outermost svg element is the furthest ancestor svg element in the current document fragment.
When the currentScale property is called on an element other than the outermost svg element, this property's
behavior is undefined.
http://msdn.microsoft.com/en-us/library/ie/ff971930%28v=vs.85%29.aspx
Mary-Q82/152
QUESTION 664
You are creating a custom object as described by the following code.
You need to implement the calcArea method. Which code should you use?
Correct Answer: D
QUESTION 665
You develop an HTML5 application. The application uses an image that is returned from an HTTP POST
request.
You develop the following code: (Line numbers are included for reference only.)
You need to display the loaded image in the application. Which code segment should you insert at line 04?
Correct Answer: B
QUESTION 666
You develop an HTML5 webpage that contains the following HTML markup:
<input id="loanTermTextBox" type="text" />
Users must enter a valid integer value into the text box. You need to validate the data type that is received from
the input element.
Which two code segments should you include on the webpage?
(Each correct answer presents a complete solution. Choose two.)
E.
Correct Answer: AB
QUESTION 667
You develop an application to host user-generated HTML and JavaScript content.
A common error handler in your application must process all unhandled errors.
You need to implement global error handling for the application. Which code segment should you use?
Correct Answer: A
QUESTION 668
You develop an HTML5 webpage. You have the following HTML markup:
You need to call the click event for the addOneltem button a determined number of times when the user clicks
the addBoxOfltems button.
Which code segment should you add to the webpage?
Correct Answer: D
QUESTION 669
You are developing a customer web form that includes the following HTML.
<input id="txtValue" type="text" />
A customer must enter a valid age in the text box prior to submitting the form.
You need to add validation to the control. Which code segment should you use?
Correct Answer: D
Explanation/Reference:
Qualcuno dice A
QUESTION 670
You are developing an HTML5 web application that displays the current temperature whenever a button is
clicked. The following code provides this functionality.
When the temperature is loaded, the status property on the loader instance does not change.
You need to ensure that the status property on the loader instance is updated when the temperature is loaded.
Which code segment should you use to replace the Loader function?
Correct Answer: A
QUESTION 671
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 672
You are creating a JavaScript function that displays the name of a web application.
You declare the following button element.
<input type="button" id= "About" value="About" />
When a user clicks the button, a JavaScript function named About must be called.
You need to create an event handler that calls the About function when the button is clicked.
Which two code segments can you use? (Each correct answer presents a complete solution. Choose two.)
Correct Answer: CD
Explanation/Reference:
Altri dicono AC
QUESTION 673
You are developing an application that uses a third-party JavaScript library named doWork().
The library occasionally throws an "object is null or undefined" error with an error code of -2146823281.
The application must:
* Extract and handle the exceptions thrown by doWork()
* Continue normal program execution if other exceptions occur
You need to implement the requirements.
Which code segment should you use?
Correct Answer: C
QUESTION 674
You are developing an HTML5 web application that displays customer mailing address information.
The application loads addresses from a web service by using AJAX.
The following code defines a Customer object and loads address data.
You need to implement the loadAddress function. Which code segment should you use?
Correct Answer: C
QUESTION 675
You are creating a web form that users will use to enter their personal information. The form includes the
following HTML.
You have the following requirements:
* When a user enters an input box, the cell on the right must turn green.
* When a user leaves an input box, the cell on the right must turn white.
You need to create the web form to meet these requirements.
Which code segment should you use?
Correct Answer: A
QUESTION 676
You are developing a web page that has a group of HI and H2 elements.
The page also includes a CSS class named underlineMe.
You have the following requirements:
* The font color of all H1 and H2 elements must be changed to red.
* The CSS class underlineMe must be applied to all H1 and H2 elements.
You need to update the web page to meet the requirements.
Which code segment should you use?
Correct Answer: D
QUESTION 677
You are developing an application that consumes an external web service that returns the latest stock rate.
The application has two methods:
* The getResults() method makes an AJAX web service request
* The ShowRate() method displays the stock rate from the web service response
You need to ensure that the ShowRate() method always displays the latest stock rate.
Which code segment should you use?
Correct Answer: D
QUESTION 678
You are creating a JavaScript function to display the current version of a web application
You declare a button as follows.
<input type="button" id="About" value="About" />
You need to create an event handler for the button by using an anonymous function. Which code segment
should you use?
Correct Answer: C
QUESTION 679
You are creating a class named Sedan that must inherit from the Car class.
The Sedan class must modify the inherited fourDoor () method.
The Car class is defined as follows.
Future instances of Sedan must be created with the overridden method. You need to write the code to
implement the Sedan class.
Which two code segments should you use? (Each correct answer presents part of the solution. Choose two.)
Correct Answer: BC
QUESTION 680
DRAG DROP You are developing a web page for runners who register for a race. The page includes a slider
control that allows users to enter their age.
You have the following requirements:
* All runners must enter their age.
* Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
* The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in the answer
area.
Each word or number may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 681
You are creating a JavaScript object that represents an employee. You need to extend the Employee object by
adding the GetPayroll() method. You need to ensure that all future instances of the Employee object implement
the GetPayroll() method. Which code segment should you use?
Correct Answer: D
QUESTION 682
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets.
The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets?
(To answer, move the style sheet types from the list of style sheet types to the answer area and arrange them
in the correct order.)
Select and Place:
Correct Answer:
QUESTION 683
You develop an HTML5 webpage. You have the following HTML markup:
<
You also have the following JavaScript variable defined: var languages = [];
You need to add statements to an existing JavaScript function to sort the list items.
Which four actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 684
You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment: var jsonFruit = { "apples" : "12", "bananas" : "8",
"watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 685
You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
* Create an object that represents an image that will be displayed.
* Set the image properties from the values that are returned by the web service.
* Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 686
You develop an HTML application that calls a web service to retrieve JSON data.
The web service contains one method named GetFullName that returns an Object named data.
The data object contains two properties named GivenName and Surname.
You need to load data from the web service to the webpage. How should you complete the relevant code? (To
answer, drag the appropriate code segment or code segments to the correct location or locations in the answer
area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 687
A company asks you to create a function that displays loan amounts to their customers.
You must create the function by using JavaScript to meet the following requirements:
Display three different loan amounts to each customer.
Display loan amounts in order starting with the greatest amount and ending with the least amount.
You need to implement the function. How should you complete the relevant code? (To answer, drag the
appropriate command or commands to the correct location or locations in the answer area. Use only
commands that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
A local variable can have the same name as a global variable, but it is entirely separate; changing the value of
one variable has no effect on the other. Only the local version has meaning inside the function in which it is
declared.
JavaScript processes all variable declarations before executing any code, whether the declaration is inside a
conditional block or other construct. Once JavaScript has found all the variables, it executes the code in the
function. If a variable is implicitly declared inside a function - that is, if it appears on the left side of an
assignment expression but has not been declared with var - it is created as a global variable.
An inner (nested) function stores references to the local variables that are present in the same scope as the
function itself, even after the function returns. This set of references is called a closure. In the following
example, the second call to the inner function outputs the same message ("Hello Bill") as the first call, because
the input parameter for the outer function, name, is a local variable that is stored in the closure for the inner
function.
http://www.w3schools.com/js/js_variables.asp
http://msdn.microsoft.com/en-us/library/ie/bzt2dkta%28v=vs.94%29.aspx
<!doctype html>
<html lang="en">
<head>
<script type="text/javascript">
function showLoanAmounts() {
var loanAmount = 400;
function showSomeLoanAmount() {
var loanAmount = 800;
function showAnotherLoanAmount() {
var loanAmount = 1000;
alert(loanAmount);
}
showAnotherLoanAmount();
alert(loanAmount);
}
showSomeLoanAmount();
alert(loanAmount);
}
</script>
</head>
<body>
<button onclick="showLoanAmounts()">Show Amounts</button>
</body>
</html>
Mary-Q33/103
QUESTION 688
You are creating a function by using JavaScript.
You have the following requirements:
The function must display loan amounts to the user within the following HTML element: <div id="display"></
div>
The loan amount of 2100 must display in the HTML element.
All declared variables and functions must be scoped to the myApp variable.
You need to implement the function. How should you complete the relevant code?
(To answer, drag the appropriate code segments to the correct location or locations in the answer area. Use
only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 689
You are creating a function named getText().
The function must retrieve information from text files that are stored on a web server.
You need to develop the function to meet the requirement.
Which code segment or segments should you use? (To answer, drag the appropriate command from the list of
commands to the correct location or locations in the work area. Each code segment may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 690
You are developing an application for a retail store. The application will be used on mobile devices to provide
real-time directions to the store.
You have the following requirements:
The application must find out a user's location.
As the user moves, the application must update the screen with the new location.
As the user moves, the application must display the user's speed.
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or
segments to the correct location in the work area. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
The HTML5 Geolocation API is used to get the geographical position of a user.
Since this can compromise user privacy, the position is not available unless the user approves it.
Use the getCurrentPosition() method to get the user's position.
watchPosition() returns the current position of the user and continues to return updated position as the user
moves (like the GPS in a car).
clearWatch() - Stops the watchPosition() method.
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
else { x.innerHTML = "Geolocation is not supported by this browser."; }
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
The second parameter of the getCurrentPosition() method is used to handle errors. It specifies a function to
run if it fails to get the user's location:
function showError(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
x.innerHTML="User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML="Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML="The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML="An unknown error occurred."
break;
}
}
The getCurrentPosition() method returns an object if it is successful. The latitude, longitude and accuracy
properties are always returned. The other properties below are returned if available.
coords.latitude The latitude as a decimal number
coords.longitude The longitude as a decimal number
coords.accuracy The accuracy of position
coords.altitude The altitude in meters above the mean sea level
coords.altitudeAccuracy The altitude accuracy of position
coords.heading The heading as degrees clockwise from North
coords.speed The speed in meters per second
timestamp The date/time of the response
http://www.w3schools.com/html/html5_geolocation.asp
-------------------------------------------------------------------------------------------------------------------
Mary: getCurrentPosition, not watchPosition
trixter from India - Oct 25, 2013:
Shouldnt the answer be navigator.geolocation,watchlocation(locSuccess, locFail)??
BioK from Ireland - Nov 06, 2013:
I think the same. Because it says "as the user moves, the app must update the screen with the new location"
and for that you'll need the navigator.geolocation.watchPosition
equiman from Colombia - Nov 03, 2013:
Q106: correct answer is navigator.geolocation.watchPosition and not getCurrentPosition.
Because current position only works one time. watchPosition work on each device move.
Anon from Netherlands - Nov 11, 2013:
navigator.geolocation.watchPosition(locSucces, locFail);
not
navigator.geolocation.getCurrentPosition(locSucces, locFail);
As equiman says, watchPosition keeps track of the position. getCurrentPosition just gets the position, but
doesn't keep track of it.
Mary-Q36/106
QUESTION 691
You develop an HTML application that calls a Simple Object Access Protocol (SOAP) web service to retrieve
data. You need to load data from the web service.
What should you do? (To answer, drag the appropriate code segment or code segments to the correct location
or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 692
You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
* Display the message Denied! If the PaymentAmount variable is greater than 500.
* Display the message Approved! If the PaymentAmount variable is less than 300.
* Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater than
300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 693
You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page. The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page. How should you create the JavaScript
code? (Develop the solution by selecting the required code segments and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
QUESTION 694
You are developing a shared library to format information.
The library contains a method named _private. The _private method must never be called directly from outside
of the shared library.
You need to implement an API for the shared library.
How should you complete the relevant code? (Develop the solution by selecting the required code segments
and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
Da confermare
QUESTION 695
You create a webpage that includes the following HTML markup: (Line numbers are included for reference
only.)
You need to ensure that a form cannot be submitted unless the INPUT element contains the word OK.
Which five actions should you perform in sequence? (To answer, move the appropriate actions from the list of
actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
The :first selector selects the first element.
Note: This selector can only select one single element. Use the :first-child selector to select more than one
element (one for each parent).
This is mostly used together with another selector to select the first element in a group
$("p:first")
The :first-child selector selects all elements that are the first child of their parent.
http://www.w3schools.com/jquery/sel_first.asp
http://www.w3schools.com/jquery/sel_firstchild.asp
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
</head>
<body>
<p>type OK to validate form.</p>
<form action="javascript:alert('success!');">
<div>
<input type="text" />
<input type="submit" />
</div>
</form>
<script type="text/javascript">
$("form").submit(function() {
if ($("input:first").val() == "OK") {
return true;
}
return false;
});
</script>
</body>
</html>
Mary-Q66/136
QUESTION 696
You are implementing a web worker by using JavaScript and HTML5. The web worker processes a long-
running loop and returns the result to a webpage. The web worker is defined on the webpage as follows:
You have the following requirements:
Evaluate the message value in the web worker.
Process the loop based on the iterations value that is passed from the webpage.
Return a value back to the webpage from the web worker.
You need to implement the web worker. How should you complete the relevant code? (To answer, drag the
appropriate code segment to the correct location or locations in the answer area. Use only code segments that
apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
A web worker is a JavaScript running in the background, without affecting the performance of the page.
When executing scripts in an HTML page, the page becomes unresponsive until the script is finished.
A web worker is a JavaScript that runs in the background, independently of other scripts, without affecting the
performance of the page. You can continue to do whatever you want: clicking, selecting things, etc., while the
web worker runs in the background.
Web Workers run in an isolated thread. As a result, the code that they execute needs to be contained in a
separate file. But before we do that, the first thing to do is create a new Worker object in your main page. The
constructor takes the name of the worker script:
var worker = new Worker('task.js');
If the specified file exists, the browser will spawn a new worker thread, which is downloaded asynchronously.
The worker will not begin until the file has completely downloaded and executed. If the path to your worker
returns an 404, the worker will fail silently.
After creating the worker, start it by calling the postMessage() method:
worker.postMessage(); // Start the worker.
Communication between a work and its parent page is done using an event model and the postMessage()
method. Depending on your browser/version, postMessage() can accept either a string or JSON object as its
single argument. The latest versions of the modern browsers support passing a JSON object.
Below is a example of using a string to pass 'Hello World' to a worker in doWork.js. The worker simply returns
the message that is passed to it.
Main script:
var worker = new Worker('doWork.js');
worker.addEventListener('message', function(e) {
console.log('Worker said: ', e.data);
}, false);
worker.postMessage('Hello World'); // Send data to our worker.
doWork.js (the worker):
self.addEventListener('message', function(e) {
self.postMessage(e.data);
}, false);
http://www.w3schools.com/html/html5_webworkers.asp
http://www.html5rocks.com/en/tutorials/workers/basics/
Mary-Q67/137
QUESTION 697
You create an HTML5 application that includes JavaScript. The application performs several AJAX
requests.One AJAX request retrieves order information from a web service and then sends the information
back to a webpage within the application. You must create a custom event.
You have the following requirements:
The webpage must contain an HTML element named ordersListing that will receive the custom event
notification.
The event name must be ordersReceived.
The event must pass a custom value named orderCount.
The event must run a JavaScript method named showOrdersReceivedCount after the orders Listing HTML
element receives the event.
Do not allow other DOM elements to receive the event.
Allow the event to be cancelled.
Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX response.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
HTML DOM events allow JavaScript to register different event handlers on elements in an HTML document.
Events are normally used in combination with functions, and the function will not be executed before the event
occurs (such as when a user clicks a button).
addEventListener allows the registration of event listeners on the event target.
dispatchEvent is the last step of the create-init-dispatch process, which is used for dispatching events into the
implementation's event model. The event can be created using document.createEvent method and initialized
using initEvent or other, more specific, initialization methods, such as initMouseEvent or initUIEvent.
The DOM CustomEvent are events initialized by an application for any purpose.
void CustomEvent(DOMString type, boolean canBubble, boolean cancelable, any detail);
Example:
// add an appropriate event listener
obj.addEventListener("cat", function(e) { process(e.detail) });
// create and dispatch the event
obj.dispatchEvent(new CustomEvent("cat", {"detail":{"hazcheeseburger":true}}));
http://www.w3schools.com/jsref/dom_obj_event.asp
https://developer.mozilla.org/en/docs/Web/API/CustomEvent
http://davidwalsh.name/customevent
----------------------------------------------------------------------------------------------------------------
Mary: Answer
debez from Poland - Nov 12, 2013:
The answer seems to be wrong, but I cannot prepare a correct one with only 3 pieces of code.
Mary-Q78/148
QUESTION 698
You are developing an application by using JavaScript.
You must write a function that returns the sum of the variables named v1, v2, v3, v4.
You need to complete the sum function. How should you complete the relevant code? (To answer, drag the
appropriate code segment or segments to the correct location or locations in the answer area. Use only code
segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
The call method is used to call a method on behalf of another object. It allows you to change the this object of a
function from the original context to the new object specified by thisObj.
If thisObj is not supplied, the global object is used as thisObj.
call([thisObj[, arg1[, arg2[, [, argN]]]]])
http://msdn.microsoft.com/en-us/library/ie/h2ak8h2y%28v=vs.94%29.aspx
Mary-Q79/149
QUESTION 699
You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location.
Each selector may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 700
You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area.
Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 701
You are validating user input by using JavaScript and regular expressions.
A group of predefined regular expressions will validate two input fields:
* An email address in a function named validateEmail (for example, firstname@contoso.com)
* A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN(for example, 555555555 or 555-55-5555)
You need to use the correct expression to validate the input. Which expression should you insert into each
function?
(To answer, drag the appropriate regular expression statement to the correct location. Each regular expression
statement may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Qualche dubbio
QUESTION 702
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter.
The query string parameter must display the @ symbol that is used in the email address.
You need to implement this functionality. How should you develop the form? (To answer, drag the appropriate
code segment to the correct target or targets in the answer area. Each code segment may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 703
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
* Generate an error * Assign "200" to the error number
* Assign "Invalid" to the error description You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area.
Each code segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 704
You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new window.
Which jQuery code segment or segments should you use?
(To answer, drag the appropriate line of code to the correct location. Each line of code may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q138/39. Annie-Q59
QUESTION 705
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
The appropriate display resolution must be selected dynamically based on the device that is connecting to
the page.
Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct location. Each
media statement may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q142/43, Q136/37 Annie-Q58,Q60.
QUESTION 706
You are developing a web page by using HTML5 and CSS3.
Hyperlinks on the page must be rendered with a style that reflects the last user action performed.
You need to style the four anchor elements in the document. In what order should you specify the four anchor
selectors?
(To answer, move the appropriate anchor selectors from the list of CSS codes to the answer area and arrange
them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 707
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint.
The data can also be represented in XML. Two existing methods named parseXml() and parseBint() are
defined on the page.
The application must:
* Retrieve and parse data from the web service by using binary format if possible
* Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, drag the appropriate code segment to the correct location. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 708
You are developing an application that reads information from a file.
The application must:
* Execute a block of code if there is an error accessing the file
* Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met.
Which three statements should you implement in sequence? (To answer, move the appropriate statements
from the list of actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 709
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
* The function must return "Number" if the object is a number
* The function must return "String" if the object is a string
* The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements. How should you build the code segment? (To
answer, drag the appropriate word to the correct location in the code segment. Each word may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 710
You are developing an application for an online retailer. The company ships only to certain countries.
The application must:
* Store a list of country codes in an array
* Validate the country code of the shipping address against the countries array
* Include a Boolean value in the array that indicates whether or not you can ship to the country
* Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer cannot
ship to
You need to develop the application to meet the requirements. Which code segment or segments should you
use? (To answer, drag the appropriate code segment or segments from the list of code segments to the correct
location or locations in the work area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 711
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
* Register an event listener for the web worker
* Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, drag the appropriate line or lines of code to the correct location
or locations. Each line of code may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
http://www.w3schools.com/html/html5_webworkers.asp
QUESTION 712
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
* Users must be able to save information in the application about their favorite destination airport.
* The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use? (To answer, drag the appropriate command or commands from the
list of commands to the correct location or locations in the work area. Each line of code may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 713
An HTML page has a canvas element.
You need to draw a red rectangle on the canvas element dynamically.
The rectangle should resemble the following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q117/18,Q167/68. Annie-Q54,Q69
QUESTION 714
You are reviewing the CSS markup for an HTML5 page that displays a news article. The CSS markup for the
page is as follows:
The HTML markup for the page is as follows:
For each statement in the table, select Yes if the code segments above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 715
You review code that uses WebSockets for a browser-based multiplayer game. Each player sends a move to
the server, which then sends the move to all connected game instances. The following code runs in the browser
and handles the sending and receiving of moves:
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each row.
Hot Area:
Correct Answer:
Explanation/Reference:
The onmessage event is used to notify the app to process incoming data.
The onopen event fires only when a connection is made. To determine if a connection is still open, use
readyState. If you provide a protocol when opening a WebSocket, it is recommended that the app check the
protocol property to ensure the protocol was accepted by the server.
http://msdn.microsoft.com/en-us/library/ie/cc197057%28v=vs.85%29.aspx
Mary-Q20/90
QUESTION 716
You develop an HTML messaging application that allows users to send messages.
The messages can have an optional file attachment that is identified by a filename. You use the following
function to send a message:
You need to send a message with a file attachment. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 717
You develop an HTML5 application that allows images to be dragged and dropped within a webpage. The
webpage contains a DIV element and four IMG elements as defined in the code segment below:
You need to enable drag and drop for the application. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 718
You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows.
The first row spans the entire width of the page and is labeled #Top.
The second row contains three columns.
The first column is labeled #Left; the second column is labeled #Main; and the right column is labeled #Right.
The #Left and #Right columns are a fixed width.
The #Main column occupies the remaining available space.
The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout. How should you complete the relevant styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 719
You are creating a custom style by using CSS3.
You have the following requirements to complete the style:
If the text in a line must wrap to another line, the last word must be able to break across lines.
All text must be black and have a blue shadow, such that the text appears to glow blue.
The text must look like the following:
You need to complete the CSS3 style. How should you complete the relevant code? (To answer, select the
appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The text-shadow property applies shadow to text.
text-shadow: h-shadow v-shadow blur color;
Note: The text-shadow property attaches one or more shadows to text. The property is a comma-separated list
of shadows, each specified by 2 or 3 length values and an optional color. Omitted lengths are 0.
h-shadow - Required. The position of the horizontal shadow. Negative values are allowed
v-shadow- Required. The position of the vertical shadow. Negative values are allowed
blur - Optional. The blur distance
color - Optional. The color of the shadow. Look at CSS Color Values for a complete list of possible color values
The word-break property specifies line breaking rules for non-CJK scripts.
word-break: normal | break-all | keep-all;
hyphens property controls whether hyphenation is allowed to create more soft wrap opportunities within a line
of text.
hyphens: none | manual | auto;
http://www.w3schools.com/cssref/css3_pr_text-shadow.asp
http://www.w3schools.com/cssref/css3_pr_word-break.asp
http://kenneth.io/blog/2012/03/04/word-wrapping-hypernation-using-css/
Mary-Q39/109
QUESTION 720
You are developing a web page. The webpage must display a container. The container must display three
colored rectangles near the top of the container. The colored rectangles are, in order, green, red, and yellow.
The rectangles are aligned horizontally and evenly spaced across the width of the container. The layout of the
page must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant styles? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 721
You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 722
You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 723
You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name. For each statement in the table, select
Yes if the code segment above causes the variable to evaluate as described. Select No if it does not. Make only
one selection in each column.
Hot Area:
Correct Answer:
QUESTION 724
You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
* Display a message if users select the first OPTION element, and then submit the form.
* Do not display an alert message if users select any other OPTION element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 725
You develop a webpage that consumes a web service. The web service provides currency exchange rates.
Visitors enter the currency type on the webpage and press the Submit button. The web service returns the
current exchange rate.
You need to ensure that the webpage always displays the most current information. How should you complete
the relevant code? (To answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
jQuery.ajax( url [, settings ]) - Perform an asynchronous HTTP (Ajax) request.
settings - a set of key/value pairs that configure the Ajax request. All settings are optional.
cache (default: true, false for dataType 'script' and 'jsonp')
http://api.jquery.com/jQuery.ajax/
Mary-Q53/123
QUESTION 726
You develop a webpage. The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 727
A company has an XML file named products.xml on a web server. The file contains a list of the products that
the company sells. You need to display the contents of the products.xml file in a DIV element named Output.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
http://www.w3.org/TR/2006/WD-XMLHttpRequest-20060405/
QUESTION 728
You develop an interactive scalable vector graphics (SVG) application. You write the following HTML markup
that makes a rectangle rotate:
You need to control the speed of the rotating rectangle.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
SVG stands for Scalable Vector Graphics. SVG defines graphics in XML format.
Advantages of using SVG over other image formats (like JPEG and GIF) are:
SVG images can be created and edited with any text editor
SVG images can be searched, indexed, scripted, and compressed
SVG images are scalable
SVG images can be printed with high quality at any resolution
SVG images are zoomable (and the image can be zoomed without degradation)
SVG is an open standard
SVG files are pure XML
The <g> element is a container used to group objects. Transformations applied to the g element are performed
on all of its child elements. Attributes applied are inherited by child elements. In addition, it can be used to
define complex objects that can later be referenced with the <use> element.
The transform attribute defines a list of transform definitions that are applied to an element and the element's
children. The items in the transform list are separated by whitespace and/or commas, and are applied from
right to left.
translate(<x> [<y>]) - this transform definition specifies a translation by x and y. If y is not provided, it is
assumed to be zero.
The setInterval() method calls a function or evaluates an expression at specified intervals (in milliseconds).
The setInterval() method will continue calling the function until clearInterval() is called, or the window is closed.
The ID value returned by setInterval() is used as the parameter for the clearInterval() method.
The transform property applies a 2D or 3D transformation to an element. This property allows you to rotate,
scale, move, skew, etc., elements.
object.style.transform="rotate(7deg)"
http://www.w3schools.com/svg/
http://www.w3.org/TR/SVG/struct.html#Groups
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/g
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/transform
http://www.w3schools.com/jsref/met_win_setinterval.asp
http://www.w3schools.com/cssref/css3_pr_transform.asp
<!DOCTYPE html>
<html>
<head>
<script>
var squareShape;
var myTimer;
function startAnimation() {
squareShape = document.getElementById('mySquare');
squareShape.currentTheta = 0;
myTimer = setInterval(animateImage, speed.value);
animateImage();
}
function animateImage() {
squareShape.setAttribute("transform", "rotate(" +
squareShape.currentTheta + ")");
squareShape.currentTheta += 0.1;
}
</script>
</head>
<body>
<svg width="200px" height="200px">
<g transform="translate(400, 400)" id="myImage">
<rect id="mySquare" x="-10" y="-10" width="20" height="20" color="blue"/>
</g>
</svg>
<input id="speed" type="text" value="10" />
<button id="zoom" onclick="startAnimation();">Start</button>
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------------------
Mary&Sam: Answer
1. squareShape = document.mySquare;
2. myTimer = myTimer.Interval(speed.value);
3. squareShape.setAttribute("transform", "angle" +
cch from New Zealand - Oct 15, 2013:
The answer seems quite wrong.
Hansbla from Netherlands - Nov 04, 2013:
Answers are (at least it works like this in my code)
squareShape = document.getElementById('mySquare');
myTimer = setInterval(animateImage, speed.value);
squareShape.setAttribute("transform", "rotate(" + squareShape.curentTheta + ")");
Mary-Q65/135
QUESTION 729
You create a custom style by using CSS3. A box with rounded corners must appear around text.
The box must match the following illustration:
You need to add the CSS3 markup to your style. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The box-shadow property attaches one or more drop-shadows to the box.
box-shadow: h-shadow v-shadow blur spread color inset;
The box-sizing property allows you to define certain elements to fit an area in a certain way.
For example, if you want two bordered boxes side by side, it can be achieved through setting box-sizing to
"border-box". This forces the browser to render the box with the specified width and height, and place the
border and padding inside the box.
box-sizing: content-box | border-box | inherit;
The border-radius property is a shorthand property for setting the four border-*-radius properties.
border-radius: 1-4 length|% / 1-4 length|%;
The border-spacing property sets the distance between the borders of adjacent cells (only for the "separated
borders" model).
border-spacing: length length;
http://www.w3schools.com/cssref/css3_pr_border-radius.asp
http://www.w3schools.com/cssref/css3_pr_box-shadow.asp
http://www.w3schools.com/cssref/css3_pr_box-sizing.asp
http://www.w3schools.com/cssref/pr_border-spacing.asp
Mary-Q73/143
QUESTION 730
You implement a callback function by using JavaScript. You need to process the returned XML data. How
should you complete the relevant code? (To answer, select the appropriate option from each drop-down list in
the answer area.)
Hot Area:
Correct Answer:
QUESTION 731
You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 732
You are creating a custom CSS3 style.
You have the following requirements to complete the style:
* box1 has a red outline.
* box1 contains box2, and box2 must remain inside box1
* box2 must have a green to black gradient.
* box2 must be surrounded by white space.
The style resembles the following diagram:
You need to add the CSS3 code to the styles. How should you complete the relevant code? (To answer, select
the appropriate code segment in each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 733
You are validating user input by using built-in JavaScript functions.
The application must:
* Store the value that is entered in a variable named inputValue
* Use the built-in isNaN(tnputValue) function to evaluate the data type
You need to validate the return value of the isNaN(inputValue) function.
Which values will be returned? (To answer, configure the appropriate options in the dialog box in the answer
area.)
Hot Area:
Correct Answer:
QUESTION 734
You are developing an HTML5 web application for displaying encyclopedia entries.
Each encyclopedia entry has an associated image that is referred to in the entry.
You need to display the image by using the correct semantic markup.
What should you do? (To answer, select the appropriate options from the drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
Mary-Q114/15. Annie-Q53
QUESTION 735
You are developing an HTML5 application for a company.
You apply the following style to a DIV element on a page.
You need to submit a draft illustration of the results of this code.
Which illustration should you submit? (To answer, select the appropriate illustration in the answer area.)
Hot Area:
Correct Answer:
QUESTION 736
You are developing a customer web form that includes the following HTML.
<input id="txtValue"/>
You need to change the HTML markup so that customers can enter only a valid three-letter country code.
Which HTML should you use?
A. <input id="txtValue" type="country"/>
B. <input id="txtValue" type="text" required="required"/>
C. <input id="txtVa!ue" type="text" pattern=" [A-Za-z] {3} "/>
D. <input id="txtValuen type="code" pattern"="country"/>
Correct Answer: C
QUESTION 737
You are developing an HTML5 web form to collect feedback information from site visitors.
The web form must display an INPUT element that meets the following requirements:
* Allow numeric values between 1 and 10.
* Default to the value of 5.
* Display as a slider control on the page.
You need to add the INPUT element to the form. Which HTML element should you add?
A. Rating (Between 1 and 10): <input type="number" name="rating" min ="1" max-"10">
B. Rating (Between 1 and 10): <input type="number" name="rating" min="1" max="10" defaulc="5">
C. Rating (Between 1 and 10): <input type="range" name="rating" min="0" max="10" default"="5">
D. Rating (Between 1 and 10): <input type="range" name="rating" min="1" max="10" value="5">
Correct Answer: D
QUESTION 738
You develop an HTML5 application for a company. Employees must enter a personal identification number
(PIN) in an INPUT element named SecurityCode to access their employee records.
The SecurityCode element must meet the following requirements:
* Allow up to 6 digits.
* Do not display numbers as they are entered.
* Display the text Enter PIN Code before the user enters any data.
You need to implement the SecurityCode element.
Which HTML markup should you add to the application?
E.
Correct Answer: D
QUESTION 739
You are developing a customer web form that includes the following HTML input field.
<input id="txtValue"/>
If a customer enters a value in the input field, then it must be a numeric value.
You need to add validation to the input field.
Which HTML should you use?
A. <input id="txtValue" type="text" pattern="/#" />
B. <input id="txtValue" type="number" />
C. <input id="txtValue" type="integer" />
D. <input id="txtValue" type="text" required="required"/>
Correct Answer: B
QUESTION 740
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
* Add a drop shadow that is one inch below the text in the paragraph
* Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements. Which CSS style should you use?
A. Text-shadow: 72pt 0pt 5pt
B. Text-shadow: 0px 1in 5px;
C. Text-shadow: 72pt 0em 5px;
D. Text-shadow: 100px 0px 5px;
Correct Answer: B
Explanation/Reference:
text-shadow : left top blur(blur radius) color
also
text-shadow: 0px 72pt 5px; beacuse 1in=72pt
QUESTION 741
You develop a webpage. The webpage must display a grid that contains one row and five columns. Columns
one, three, and five are the same width. Columns two and four are the same width, but much wider than
columns one, three, and five.
The grid resembles the following image:
The grid must meet the following requirements:
Each row must be tall enough to ensure that images are not cut off.
Each row must contain five columns.
The width of the columns must not change when the screen is resized or rotated.
You need to define the style for the grid. Which CSS3 style should you use?
Correct Answer: C
Explanation/Reference:
-ms-grid-columns property gets or sets one or more values that specify the width of each grid column within
the object.
-ms-grid-columns: [ auto | width | min-content | max-content | minmax(min, max) ]
+ | none
-ms-grid-rows property gets or sets one or more values that specify the height of each grid row within the
object.
-ms-grid-rows: [ auto | height | min-content | max-content | minmax(min, max) ] +
| none
auto - The width of a column is computed based on the widest child element in that column. This keyword is
equivalent to minmax(min-content, max-content).
width - The width of each column specified as one of the following values:
A length consisting of an integer number, followed by an absolute units designator ("cm", "mm", "in", "pt", or
"pc") or a relative units designator ("em", "ex", or "px").
A percentage of the object width.
A proportion of the remaining horizontal space (that is, the object width, less the combined widths of other
tracks), consisting of an integer number followed by a fractional designator ("fr"). For example, if "200px 1fr
2fr" is specified, the first column is allocated 200 pixels, and the second and third columns are allocated 1/3
and 2/3 of the remaining width, respectively.
min-content - The minimum width of any child elements is used as the width of the column.
max-content - The maximum width of any child elements is used as the width of the column.
minmax(min, max) - The width of the row is between min and max, as available space allows. The min and
max parameters can be any other value of the -ms-grid-columns property, except for auto.
none - Initial value. The object has no specified columns. Implicit, auto-sized columns will still be created
based on the grid position(s) of the child element(s).
This property also supports a repeating syntax. If there are a large number of columns that are the same or
exhibit a recurring pattern, a repeat syntax can be applied to define the columns in a more compact form.
-ms-grid-columns: 10px 250px 10px 250px 10px 250px 10px 250px 10px;
is equivalent to
-ms-grid-columns: 10px (250px 10px)[4];
http://msdn.microsoft.com/en-us/library/windows/apps/hh466340.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh466350.aspx
Mary-Q21/91
QUESTION 742
You implement an application by using HTML5 and JavaScript. You create a webpage that contains the
following HTML:
The application must place a border on only the first UL element that is contained in the DIV element. You need
to update the webpage. What should you do?
Correct Answer: B
QUESTION 743
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
Correct Answer: A
QUESTION 744
You are developing a web page by using HTML5.
You have the following requirements:
* An H1 element must be placed at the top left corner of the page.
* The size and location of the H1 element must not change if additional elements are added to the page.
You need to position the H1 element on the page.
Which CS53 style should you use?
Correct Answer: A
QUESTION 745
You are developing a web page that includes the following HTML.
<span id = "myTextSpan" class = "redText"> Hello There! </span>
The font color of text inside the span must be red. You need to develop the web page to meet the requirement.
Which two CSS segments will achieve the goal?
(Each correct answer presents a complete solution. Choose two.)
Correct Answer: AC
Explanation/Reference:
TAMARA
QUESTION 746
You are developing a web page that includes the following HTML.
<span id="myTextSpan" class="myStyle">Hello, World!</Span>
You need to use inline CSS styling to format the text with Arial font.
Which code segment should you use?
Correct Answer: B
QUESTION 747
You develop an HTML5 webpage. You have the following JavaScript code:
You need to handle the click event when a user clicks the show/Dialog button.
Which code segment should you insert at line 02?
A. $ (document).trigger("click", "#showDialog", function (e) {
B. $ (document).on ("#showDialog", "click", function (e) {
C. $(document).toggle("click", "#showDialog", function (e) {
D. $(document).on("click", "#showDialog", function (e) {
Correct Answer: D
QUESTION 748
You are developing an application that processes order information. Thousands of orders are processed daily.
The application includes the following code segment. (Line numbers are included for reference only.)
The application must:
Display the number of orders processed and the number of orders remaining Update the display for every 25th
record processed
You need to develop the application to meet these requirements.
Which line of code should you insert at line 04?
A. If (!(counter % 25))
B. if (counter == 25)
C. if (counter >> 25 == 0)
D. if (counter >> 25 == 0)
Correct Answer: A
QUESTION 749
You troubleshoot a webpage that contains the following HTML markup: (Line numbers are included for
reference only.)
The webpage also contains the following JavaScript function named someEvent() that is declared in the HEAD
section of the HTML:
Function someEvent() {
Alert('someEvent fired!');
}
The JavaScript function named someEvent() must run only when the user clicks the DIV element, not the
INPUT elements.
You need to modify the webpage to invoke the JavaScript function named someEvent().
What should you do? (Each correct answer presents a complete solution. Choose two.)
Correct Answer: AC
QUESTION 750
You develop a webpage by using HTML5.
The user interface of the webpage must show a gray-lined box that contains the label Enter your information:.
Inside the box are two labels and two input boxes. The first input box must be labeled Name:. The second input
box must be labeled Email:. Below the box is a Submit button.
The user interface must look like the following;
You need to crate the user Interface.
Which markup should you use?
Correct Answer: B
QUESTION 751
You are developing an application to track project management for your company. The status of the project is
stored in a variable named percentComplete.
The method must execute only when percentComplete is equal to the numeric value 100.
You need to develop the application to meet the requirement.
Which code segment should you use?
E.
Correct Answer: D
QUESTION 752
You develop a website for a company by using HTML5.
You have the following requirements:
Allow multiple news postings per page under the title "Welcome to the Semantic Web!".
Search engines must be able to index individual news postings.
News postings must be styled by using the following CSS markup:
. posting { line-height: 150%; )
You need to structure the markup for each individual news posting.
How should you complete the relevant markup? (To answer, drag the appropriate markup to the correct
location or locations in the answer area. Use only markup that applies.)
Select and Place:
Correct Answer:
QUESTION 753
You have a webpage that includes the following markup and code:
You need to troubleshoot the code by clicking the Submit button.
Which value will be displayed?
A. 10
B. 20
C. Undefined
D. Runtime error
Correct Answer: A
QUESTION 754
You develop an HTML5 webpage with custom CSS. You have the following HTML markup:
<div class="new" Item">...</div>
You have the following requirements:
In addition to your CSS, you must use a corporate branded stylesheet named corporate.ess.
The corporate.ess file contains the style rule that must be used for .newsItem.
You must use the corporate.ess file to ensure that the webpage changes when the brand changes.
You must add additional style rules to the webpage.
You cannot modify the corporate.ess file.
You need to apply the appropriate CSS rules to meet the requirements.
What should you do?
A. Add a CSS class named .newsItemUpdates to the webpage, add only the new styles to this class, and
update the class attribute of the HTML markup:
<div class=nnewsltem newsItemUpdates">..,</div>
B. Update the corporate.ess file to include! important for each rule for the .newsItem. class, and add the new
CSS rules to the webpage by using the CSS class .newsItem.
C. Add a CSS class named .newsitemUpdates to the webpage, add the new styles to this class, and update
the HTML markup to replace the .newsItem class with this new class:
<div class*"newsItemOpdates">...</div>
D. Add the new CSS rules to the webpage by using the CSS class .newsItem, and add! important to each rule.
Correct Answer: D
QUESTION 755
You are developing an e-commerce website. Users place products into a shopping cart.
You need to ensure that the shopping cart data is available between browser sessions.
Which object should you use to store the shopping cart data?
A. clientStorage
B. localStorage
C. applicationStorage
D. sessionStorage
Correct Answer: B
QUESTION 756
You develop an HTML5 webpage. You have the following HTML markup:
A. $ ('input [name!="name"]') .ess ({ 'background-color' : ' #E0ECF8'}) ;
B. ${'input [name~="name"] ') .ess ({ 'background-color' : ' #E0ECF8' }) ;
C. ${'input[name*="name"]').ess({'background=color': #E0ECF8'});
D. $( 'input [name$="name"] ') .ess ({ 'background-color' : '#E0ECF8'});
Correct Answer: D
QUESTION 757
You are developing a web application by using HTML5.
You have the following requirements.
The color of a menu item must change when a user hovers over the item.
The color of the menu item must change back to its original color after five seconds.
You need to ensure that the animation is applied to all menu items.
Which CSS3 code should you use?
Correct Answer: C
QUESTION 758
You are implementing an HTML page that uses a custom sans-serif font. The CSS statement for the page is as
follows.
Some users report that text is displayed in the default font for the browser. You need to modify the CSS
statement to ensure that the content is displayed with the custom font.
What should you do? (To answer, select the appropriate options from the drop-down lists in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 759
Your company uses a third-party component that generates HTML for a website. The third-party component
creates DIV elements that display a yellow background.
The third-party component uses inline styles in the DIV elements that are inconsistent with your corporate
standards. You must override the DIV elements in the style sheet with the corporate styles.
You need to ensure that the website meets corporate standards.
Which style should you apply?
Correct Answer: C
QUESTION 760
You develop an HTML5 webpage that contains the following HTML markup:
Users must receive a message after they click the Submit button if the text entered into the favoriteColor text
box is fewer than 2 characters or greater then 10 characters.
You need to implement the tastLenght() function.
Which code segment should you use?
Correct Answer: D
QUESTION 761
You are developing a website that helps users locate theaters in their area from a browser. You created a
function named findTheaters ().
The function must:
1. Get the current latitude and longitude of the user's device
2. Pass the user's location to findTheaters()
3. The user needs to access the geolocation information from the browser before searching for theaters.
Which code segment should you use?
A.
B.
C.
D.
Correct Answer: C
QUESTION 762
You are developing an HTML web application. The application loads data from a web service by using AJAX.
The application displays the data by calling the displayData function.
The data is loaded using the following code:
You need to ensure that the data is displayed when it is successfully retrived from the web service.
Which code segment should you use?
Correct Answer: B
QUESTION 763
You are developing a web page that performs CPU-intensive calculations. A web worker processes these
calculations on a separate background thread. The process is instantiated from the web page.
You need to stop the web worker process after the calculations are completed.
Which two actions can you perform to achieve this goal? (Each correct answer presents a complete solution.
Choose two.)
A. From the web page, call the close() method.
B. From the web worker process, call the terminate() method.
C. From the web page, call the terminate() method.
D. From the web worker process, call the close() method.
Correct Answer: CD
QUESTION 764
You are developing an HTML5 page named main.html. The JavaScript code for the main page is located in a
file named myApp.js.
You need to create a web worker and instantiate it from main.html.
Where should you place the web worker code?
A. In the myApp.js file
B. In the main.html file
C. In a separate .js (JavaScript) file
D. In a separate executable file
Correct Answer: C
QUESTION 765
You are developing a JavaScript library.
You have the following requirements:
Custom exceptions must include an error message and custom error number.
These exceptions must be thrown when data validation errors occur.
Developers must call the library to easily catch the exception and identify the problem.
You develop the following code. (Line numbers are included for reference only.)
Which code you should insert at line 09 ?
A. throw new ValidatiorException (123, "Day of week must be less than 7");
B. return new ValidationException(123, "Day of week must be less than 7");
C. throw ValidationException(123, "Day of week must be less than 7");
D. catch ValidationException(123, "Day of week: must be less than 7");
Correct Answer: A
QUESTION 766
You are developing an application that retrieves a stock rate from an external web service. A web page displays
a simple rotating animation to indicate whether the stock rate is increased or
decreased.
The default image, as shown in the following graphic, indicates unchanged or neutral.
The arrow must point down if the stock rate is decreased, as shown in the following graphic.
You need to ensure that the arroe points down when the stock rate decreases.
Which CSS style should you apply?
Correct Answer: D
QUESTION 767
You are troubleshooting a web page that includes the following code segment.
You need to evaluate the value of the variable x.
What will be displayed in the user interface?
A. 0
B. 1
C. 2
D. An error
Correct Answer: A
QUESTION 768
You develop an HTML5 chat application.
You need to provide real-time updates to the messages that users post in the chat application.
What should you do?
A. Use get o to obtain data updates.
B. Use a RESTful web service.
C. Use WebSockets.
D. Use ajaxo to obtain data updates.
Correct Answer: C
QUESTION 769
You are creating a rotating image of a company logo.
The logo must spin on a horizontal axis and on a vertical axis.
You need to use the least amount of development effort to meet the requirement.
What should you do?
A. Create an Image Spinner object, load the image into the spinner, and set the horizontal and vertical rotation
properties.
B. Create a Canvas Globe transform and set the image as the globe object. Set the horizontal and vertical
rotation properties.
C. Create a single Canvas 3D transform and load the image into it. Set the rotation properties.
D. Create a Canvas 2D transform and set the image to rotate horizontally and vertically.
Correct Answer: C
QUESTION 770
You are developing an HTML5 web application that provides a discussion forum for users. When a
user registers to access the application, the user enters an email address.
Users can enter data that can result in cross-site scripting (XSS) attacks.
You need to ensure that email input is as secure as possible.
Which two techniques should you use? (Each correct answer presents a complete solution. Choose two.)
A. Remove all nonalphanumeric characters before submitting data.
B. Use the email tag in forms where the email address is entered.
C. Display all email addresses inside of an HTML5 ADDRESS element.
D. Use jQuery validation with a regular expression to ensure that email addresses are valid.
E. Ensure that all form data is encrypted when it is submitted.
Correct Answer: BD
QUESTION 771
You are creating a blog site by using HTML5 and JavaScript. An inline frame enables users to post comments.
It is possible for users to inject malicious scripts into their comments.
You need to minimize the ability for malicious scripts to execute on the site.
Which line of code should you use?
A. <iframe sandbox src="frame1.htmlnX/iframe>
B. <iframe seamless="allowscripts" src="frame1.html"<>/iframe>
C. <iframe seamless src="frame1.html"></iframe>
D. <iframe sandbox="allowscripts" src"frame1.html"x/iframe>
Correct Answer: A
QUESTION 772
You develop an HTML5 application that interacts with a REST service. The REST service accepts JSON data.
A JavaScript object named form Data contains data that is sent to the REST service.
You need to convert the JavaScript object named formData into JSON.
Which code segment should you use?
A. jQuery.ajax.valueOf(formData);
B. window.evai(formData);
C. JSON.stringify (formData);
D. formData.toString();
Correct Answer: C
QUESTION 773
You are developing an HTML page that includes the following code.
<h1 id="header">A Static Page</hl>
You need to modify the content of the HI element dynamically by using JavaScript.
Which code segment should you use?
Correct Answer: D
QUESTION 774
You are developing a web page that will contain an animated logo. The web page currently has a logo image on
a canvas object.
You need to spin the logo image on the canvas.
Which method should you use?
A. context.rotate()
B. context.spin()
C. context.translatePosition()
D. context.setTransform()
Correct Answer: A
QUESTION 775
You create the following JavaScript code:
You must invoke a function that displays the vehicle information within the following HTML element:
<div id="display" />
The output of the function must appear on the webpage as follows:
Vehicle Color is silver
Stay safe!
Vehicle TransmissionType is
manual
Big machine!
You need to invoke a function that displays the required output in the HTML element.
Which two code segments should you use? (each correct answer present a complete solution. Choose two.)
E.
Correct Answer: CE
QUESTION 776
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
Explanation/Reference:
The appendChild method establishes a father-child relationship between two nodes. If the father node has
children already, the new child will be appended as the last one, and hence can be accessed via the lastChild
method. When calling the appendChild, the child node is specified as the method's parameter:
fatherObj.appendChild(childObj);
The applyElement method connects a child to its target father, which has been stripped down from its existing
children and father. When calling the applyElement method, the father node is specified as the method's
parameter:
childObj.applyElement(fatherObj);
QUESTION 777
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
Add a drop shadow that is one inch below the text in the paragraph
Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements.
Which CSS style should you use?
A. text-shadow: 72pt 0pt 5pt
B. text-shadow: 5px 1in 0px;
C. text-shadow: 72pt 5em 0px;
D. text-shadow:72pt 0em 5px;
Correct Answer: D
Explanation/Reference:
See TextShadow
72pnt = 1nch
text-shadow: h-shadow v-shadow blur color;
h-shadow Required. The position of the horizontal shadow. Negative values are allowed
v-shadow Required. The position of the vertical shadow. Negative values are allowed
blur Optional. The blur distance
color Optional. The color of the shadow. Look at CSS Color Values for a complete list of possible color
values
QUESTION 778
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
You must place content in the first column of the second row.
The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 779
You are developing application web form by using HTML5 and JavaScript.
You need to prevent users from submitting form data more than once.
Which code segment should you use?
Correct Answer: A
Explanation/Reference:
Mary-Q165/66. Annie-Q43
QUESTION 780
You are validating user input by using JavaScript and regular expressions.
A group of predefined regular expressions will validate two input fields:
An email address in a function named validateEmail
A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN
You need to use the correct expression to validate the input.
Which expression should you insert into each function?
(To answer, drag the appropriate regular expression statement to the correct location. Each regular expression
statement may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q100/1. Annie-Q46
QUESTION 781
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter. The query string
parameter must display the @ symbol that is used in the email address.
You need to implement this functionality.
How should you develop the form?
(To answer, drag the appropriate code segment to the correct target or targets in the answer area. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
AJAX
EncodeUri
QUESTION 782
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
Generate an error
Assign "200" to the error number
Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, drag the appropriate code segment or segments to the correct
location in the answer area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Throw Error JavaScript
QUESTION 783
You are developing a web application that retrieves data from a web service.
The data being retrieved is a custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
Retrieve and parse data from the web service using binary format if possible
Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, select the appropriate options from the drop-down lists in the answer area.)
Select and Place:
Correct Answer:
QUESTION 784
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets.
You have the following requirements:
Users must be able to save information in the application about their favorite destination airport.
The airport information must be displayed in the destination text box whenever the user returns to
the page.
You need to develop the site to meet the requirements.
Which lines of code should you use? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Select and Place:
Correct Answer:
QUESTION 785
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop-down list in the
answer area.)
Select and Place:
Correct Answer:
QUESTION 786
You are creating a function by using JavaScript.
The function accepts an object as the parameter and returns a string that identifies the data type of the object.
You have the following requirements:
The function must return "Number" if the object is a number
The function must return "String" if the object is a string
The function must return "Unknown" if the object is neither a number nor a string
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, drag the appropriate word to the correct location in the
code segment. Each word may be used once, more than once, or not at all.)
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q122/23, Q157/58. Annie-Q56, Q65.
QUESTION 787
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets. The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets? (To answer, move the style sheet types from the list of style
sheet types to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
See W3.Org
To find the value for an element/property combination, user agents must apply the following sorting order:
1.Find all declarations that apply to the element and property in question, for the target media type.
Declarations apply if the associated selector matches the element in question and the target medium
matches the media list on all @media rules containing the declaration and on all links on the path through
which the style sheet was reached.
2. Sort according to importance (normal or important) and origin (author, user, or user agent). In ascending
order of precedence:
user agent declarations
user normal declarations
author normal declarations
author important declarations
user important declarations
3. Sort rules with the same importance and origin by specificity of selector: more specific selectors will override
more general ones. Pseudo-elements and pseudo-classes are counted as normal elements and classes,
respectively.
4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter
specified wins. Declarations in imported style sheets are considered to be before any declarations in the style
sheet itself.
Apart from the "!important" setting on individual declarations, this strategy gives author's style sheets higher
weight than those of the reader. User agents must give the user the ability to turn off the influence of specific
author style sheets, e.g., through a pull-down menu. Conformance to UAAG 1.0 checkpoint 4.14 satisfies this
condition [UAAG10].
QUESTION 788
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
The appropriate display resolution must be selected dynamically based on the device connecting to
the page.
Mobile devices with a maximum width of 480 pixels must be able to use the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Select and Place:
Correct Answer:
QUESTION 789
You are developing a web page by using HTML5 and CSS3.
Styles must be defined for all hyperlinks on the page so that the applied style reflects the last user action.
You need to style the four anchor elements in the document.
In what order should you specify the four anchor selectors? (To answer, move the appropriate anchor
selectors from the list of CSS codes to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
You can learn about the anchor pseudo-classes here: W3Schools
As it states:
Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!
Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!
QUESTION 790
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter. The query string parameter
must display the @ symbol that is used in the email address.
You need to implement this functionality.
How should you develop the form? (To answer, drag the appropriate code segment to the correct target or
targets in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/jquery/ajax_serialize.asp
http://www.w3schools.com/jsref/jsref_encodeuri.asp
QUESTION 791
You are developing a web application that retrieves data from a web service.
The data being retrieved is a custom binary datatype named bint.
The data can also be represented in XML. Two existing methods named parseXml() and parseBint() are
defined on the page.
The application must:
Retrieve and parse data from the web service by using binary format if possible
Retrieve and parse the data from the web service by using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, drag the appropriate code segment to the correct location. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q107/8,Q151/52. Annie-Q63,Q51
QUESTION 792
You are developing an application for an online retailer.
The company ships only to certain countries.
The application must:
Store a list of country codes in an array
Validate the country code of the shipping address against the countries array
Include a Boolean value in the array that indicates whether or not you can ship to the country
Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer
cannot ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use?
(To answer, drag the appropriate code segment or segments from the list of code segments to the correct
location or locations in the work area. Each code segment may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
http://www.w3schools.com/js/js_loop_for.asp
Mary-Q159/60. Annie-Q66
QUESTION 793
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker;
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which line of code should you use? (To answer, drag the appropriate line or lines of code to the correct location
or locations. Each line of code may be used once, more than once, or not at all. You may need to drag the split
bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Normally, the code pertaining to a web worker resides in a separate JavaScript file. The parent thread creates
a new worker by specifying the script file's URI in the Worker constructor, which asynchronously loads and
executes the JavaScript file.
var primeWorker = new Worker('prime.js');
To start a worker, the parent thread posts a message to the worker, like this:
var current = $('#prime').attr('value');
primeWorker.postMessage(current);
Workers are resource-intensive; they are OS-level threads. Therefore, you do no want to create a large number
of worker threads, and you should terminate the web worker after it completes its work. Workers can terminate
themselves, like this:
self.close();
Or a parent thread can terminate a worker:
primeWorker.terminate();
To send a message back from a worker to the page, the process is reversed; the web worker uses the
postMessage() function, and the web page receives the message by handling the message event on the web
worker object;
The self variable is an alias for this; it references the Worker object from code being run by the object. All
web workers create the self alias when they start running, and it is recommended that you use it rather than
this; it is possible that the code being run by the web worker manipulates this after the web worker has been
started, so performing this.close() might not have expected effect.
http://net.tutsplus.com/tutorials/javascript-ajax/getting-started-with-web-workers/
Mary-Q120/21,Q160/61. Annie-Q55,Q67.
QUESTION 794
You are developing an airline reservation website by using HTML5 and JavaScript.
A page on the site allows users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
Users must be able to save information in the application about their favorite destination airport.
The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use?
(To answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area. Each line of code may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Mary-Q113/14,Q162/63. Annie-Q52,Q68
QUESTION 795
You are developing a HTML5 page.
You need to add author and copyright information.
Which tag should you use?
A. <section>
B. <footer>
C. <header>
D. <aside>
Correct Answer: B
QUESTION 796
Correct Answer: B
Explanation/Reference:
QUESTION 797
Correct Answer: B
Explanation/Reference:
QUESTION 798
Correct Answer: B
Explanation/Reference:
QUESTION 799
Correct Answer: B
Explanation/Reference:
QUESTION 800
You are developing an online shopping application that accepts credit cards for payment.
If the credit card number is invalid, the application must:
- Generate an error
- Assign "200" to the error number
- Assign "Invalid" to the error description
You need to write the code that meets the requirements.
How should you write the code? (To answer, select the appropriate option from the drop-down list in the answer
area.)
A. See Explaination for answer
B.
C.
D.
Correct Answer: A
Explanation/Reference:
QUESTION 801
You are creating a JavaScript object that represents a customer.
You need to extend the Customer object by adding the GetCommission() method.
You need to ensure that all future instances of the Customer object implement the GetCommission() method.
Which code segment should you use?
Correct Answer: A
QUESTION 802
You are developing an HTML5 web application that displays the current temperature whenever a button is
clicked. The following code provides this functionality.
When the temperature is loaded, the status property on the loader instance does not change.
You need to ensure that the status property on the loader instance is updated when the temperature is loaded.
Which code segment should you use to replace the Loader function?
Correct Answer: A
QUESTION 803
You are validating user input by using JavaScript and regular expressions. A group of predefined regular
expressions will validate two input fields:
. An email address in a function named validateEmail
. A nine-digit number that allows optional hyphens after the second and fifth character in a function named
validateSSN
You need to use the correct expression to validate the input. Which expression should you insert into each
function?
(To answer, drag the appropriate regular expression statement to the correct location. Each regular expression
statement may be used once, more than once, or not at all. You may need to drag the split bar between panes
or scroll to view content.)
A. See Explaination for answer
B.
C.
D.
Correct Answer: A
Explanation/Reference:
QUESTION 804
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML. Two existing methods named
parseXml() and parseBint() are defined on the page.
The application must:
. Retrieve and parse data from the web service using binary format if possible
. Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements. What should you do? (To answer, select the
appropriate options from the drop-down lists in the answer area.)
A. See Explaination for answer
B.
C.
D.
Correct Answer: A
Explanation/Reference:
QUESTION 805
You are developing a web page for runners who register for a race. The page includes a slider control that
allows users to enter their age.
You have the following requirements:
. All runners must enter their age.
. Applications must not be accepted from runners less than 18 years of age or greater than 90 years.
. The slider control must be set to the average age (37) of all registered runners when the page is first
displayed.
You need to ensure that the slider control meets the requirements. What should you do? (To answer, drag the
appropriate word or number to the correct location in the answer area. Each word or number may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
A. See Explaination for answer
B.
C.
D.
Correct Answer: A
Explanation/Reference:
QUESTION 806
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
Explanation/Reference:
The appendChild method establishes a father-child relationship between two nodes. If the father node has
children already, the new child will be appended as the last one, and hence can be accessed via the lastChild
method. When calling the appendChild, the child node is specified as the method's parameter:
fatherObj.appendChild(childObj);
The applyElement method connects a child to its target father, which has been stripped down from its existing
children and father. When calling the applyElement method, the father node is specified as the method's
parameter:
childObj.applyElement(fatherObj);
QUESTION 807
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
You must place content in the first column of the second row.
The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 808
You develop an HTML5 web application. The web application contains a form that allows users to enter only
their month of birth.
The value that the users enter must be numbers between 1 and 12, inclusive.
You need to implement the form element for the month of birth. Which element should you use?
A. <input type="time" options="month" />
B. <input types="submit" value="month" />
C. <input type="range" min="1" max="12" />
D. <input type="month" itemscope="numeric" />
Correct Answer: C
Explanation/Reference:
The range type is used for input fields that should contain a value from a range of numbers.
You can also set restrictions on what numbers are accepted.
Define a control for entering a number whose exact value is not important (like a slider control):
<input type="range" name="points" min="1" max="10">
Use the following attributes to specify restrictions:
max - specifies the maximum value allowed
min - specifies the minimum value allowed
step - specifies the legal number intervals
value - Specifies the default value
http://www.w3schools.com/html/html5_form_input_types.asp
Mary-Q46/116
QUESTION 809
You are creating a page that contains detailed employee information for a company portal. The page uses a
jQuery library. The page contains a hidden button named btnEdit that is defined by the following code.
<button id="btnEdit" style="display: none;n>Edit</button>
The button is not displayed by default.
The button must be displayed only if the user is logged on.
You need to add code to the document.ready() function to meet the requirements for the button.
Which line of code should you use?
A. $ (`#btnEdit').appear ();
B. $ (`#btnEdit').visible = true;
C. $ (`#btnEdit').show();
D. $ (`#btnEdit').Visible();
Correct Answer: C
Explanation/Reference:
With no parameters, the .show() method is the simplest way to display an element:
$( ".target" ).show();
QUESTION 810
You develop an HTML5 application for a company. Employees must enter a personal identification number
(PIN) in an INPUT element named SecurityCode to access their employee records.
The SecurityCode element must meet the following requirements:
Allow up to 6 digits.
Do not display numbers as they are entered.
Display the text Enter PIN Code before the user enters any data.
You need to implement the SecurityCode element.
Which HTML markup should you add to the application?
A. Option A
B. Option B
C. Option C
D. Option D
E. Option E
Correct Answer: D
Explanation/Reference:
* The isNaN() function determines whether a value is an illegal number (Not-a-Number).
This function returns true if the value is NaN, and false if not.
* JavaScript Form Validation
JavaScript can be used to validate data in HTML forms before sending off the content to a server.
Form data that typically are checked by a JavaScript could be:
has the user left required fields empty?
has the user entered a valid e-mail address?
has the user entered a valid date?
has the user entered text in a numeric field?
* document.getElementByID
Returns a reference to the element by its ID.
Syntax
element = document.getElementById(id);
where
element is a reference to an Element object, or null if an element with the specified ID is not in the
document.
id is a case-sensitive string representing the unique ID of the element being sought.
* The getElementsByName() method accesses all elements with the specified name. Gets a collection of
objects based on the value of the NAME or ID attribute.
Syntax
document.getElementsByName(name)
QUESTION 811
You develop an HTML5 webpage. You have the following HTML markup:
You need to change the background color for all of the elements whose name attribute ends with the word
name.
Which code segment should you add to the webpage?
A. $ ('input [name!="name"]') .css ({ 'background-color' : ' #E0ECF8'}) ;
B. ${'input [name="~name"] ') .css ({ 'background-color' : ' #E0ECF8' }) ;
C. ${'input[name="*name"]').css({'background=color': #E0ECF8'});
D. $( 'input [name="$name"] ') .css ({ 'background-color' : '#E0ECF8'});
Correct Answer: C
Explanation/Reference:
The string pattern "*name" matches all strings that ends with name.
QUESTION 812
You develop an HTML5 webpage. You have the following HTML markup:
You need to add a background color to the first article in each section.
Which code segment should you add to the webpage?
A. $("section article:first-child").css("background-color", "#f2f2f2");
B. $("section:first-child").css ("background-color", "#f2f2f2");
C. $("article:first-of-type").css("background-color", "#f2f2f2");
D. $("section:first-of-type").css("background-color", "#f2f2f2");
Correct Answer: C
Explanation/Reference:
The :first-child selector is used to select the specified selector, only if it is the first child of its parent.
The :first-of-type selector matches every element that is the first child, of a particular type, of its parent.
http://www.w3schools.com/cssref/sel_firstchild.asp
http://www.w3schools.com/cssref/sel_first-of-type.asp
-------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
function onColor() {
$("article:first-of-type").css("background-color", "#f2f2f2");
}
</script>
</head>
<body>
<section id="news">
<h1>World News</h1>
<article id="news1">News 1</article>
<article id="news2">News 2</article>
<article id="news3">News 3</article>
</section>
<section id="sports">
<h1>Sports</h1>
<article id="sports1">Sport 1</article>
<article id="sports2">Sport 2</article>
<article id="sports3">Sport 3</article>
</section>
<button onclick="onColor()">Color</button>
</body>
</html>
Mary-Q87/157
QUESTION 813
You are developing an HTML5 web form to collect feedback information from site visitors.
The web form must display an INPUT element that meets the following requirements:
Allow numeric values between 1 and 10.
Default to the value of 5.
Display as a slider control on the page.
You need to add the INPUT element to the form.
Which HTML element should you add?
A. Rating (Between 1 and 10): <input type="number" name="rating" min ="1" max-"10">
B. Rating (Between 1 and 10): <input type="number" name="rating" min="1" max="10" default="5">
C. Rating (Between 1 and 10): <input type="range" name="rating" min="1" max="10" default"="5">
D. Rating (Between 1 and 10): <input type="range" name="rating" min="10" max="10" value="5">
Correct Answer: C
Explanation/Reference:
input type="range"
The <input type="range"> is used for input fields that should contain a value within a range.
Depending on browser support, the input field can be displayed as a slider control.
Example
<form>
<input type="range" name="points" min="0" max="10"> </form>
QUESTION 814
You develop an HTML application that is located at www.adventure-works.com. The application must load
JSON data from www.fabrikam.com.
You need to choose an approach for loading the data.
What should you do?
A. Add a crossdomain.xml file to the second server.
B. Configure Cross-Origin Resource Sharing (CORS) on the servers.
C. Load the data in a JavaScript timeout callback.
D. Reference the remote data as an XML resource.
Correct Answer: B
QUESTION 815
You are developing a customer contact form that will be displayed on a page of a company's website. The
page collects information about the customer.
If a customer enters a value before submitting the form, it must be a valid email address. You need to
ensure that the data validation requirement is met.
What should you use?
A. <input name="email" type="input" required="required"/>
B. <input name=email" type="url" required="email"/>
C. <input name="email" class" email"/>
D. <input name="email" type="email"/>
Correct Answer: D
QUESTION 816
You develop an HTML5 webpage with custom CSS. You have the following HTML markup:
<div class="new" Item">...</div>
You have the following requirements:
In addition to your CSS, you must use a corporate branded stylesheet named corporate.css.
The corporate.css file contains the style rule that must be used for .newsItem.
You must use the corporate.css file to ensure that the webpage changes when the brand changes.
You must add additional style rules to the webpage.
You cannot modify the corporate.css file.
You need to apply the appropriate CSS rules to meet the requirements.
What should you do?
A. Add a CSS class named .newsItemUpdates to the webpage, add only the new styles to this class, and
update the class attribute of the HTML markup:
<div class=nnewsltem newsItemUpdates">..,</div>
B. Update the corporate.css file to include! important for each rule for the .newsItem. class, and add the
new CSS rules to the webpage by using the CSS class .newsItem.
C. Add a CSS class named .newsitemUpdates to the webpage, add the new styles to this class, and
update the HTML markup to replace the .newsItem class with this new class:
<div class*"newsItemOpdates">...</div>
D. Add the new CSS rules to the webpage by using the CSS class .newsItem, and add! important to each
rule.
Correct Answer: D
QUESTION 817
You are developing a JavaScript library.
You have the following requirements:
Custom exceptions must include an error message and custom error number.
These exceptions must be thrown when data validation errors occur.
Developers must call the library to easily catch the exception and identify the problem.
You develop the following code. (Line numbers are included for reference only.)
You need to complete the code to meet the requirements.
Which line of code should you insert at line 09?
A. throw new ValidationException.Exception (123, "Day of week must be les3 than 7");
B. return new ValidationException(123, "Day of week must be less than 7");
C. throw ValidationException(123, "Day of week must be less than 7");
D. catch ValidationException(123, "Day of week: must be less than 7");
Correct Answer: A
Explanation/Reference:
Example:
if (value < -100 || value > 100)
{
throw new ValidationException(String.Format("Value is {0} than {1}.", (value > 100 ? "greater" : "less"),
value));
}
QUESTION 818
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter. The query
string parameter must display the @ symbol that is used in the email address.
You need to implement this functionality.
How should you develop the form? (To answer, drag the appropriate code segment to the correct
target or targets in the answer area. Each code segment may be used once, more than once, or not
at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/jquery/ajax_serialize.asp
http://www.w3schools.com/jsref/jsref_encodeuri.asp
QUESTION 819
You are developing a web application that retrieves data from a web service. The data being
retrieved is a custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
Retrieve and parse data from the web service using binary format if
possible
Retrieve and parse the data from the web service using XML when binary
format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, select the appropriate options from the drop-down lists in the
answer area.)
Hot Area:
Correct Answer:
QUESTION 820
You are developing a web page for runners who register for a race. The page includes a slider
control that allows users to enter their age.
You have the following requirements:
All runners must enter their age.
Applications must not be accepted from runners less than 18 years of age
or greater than 90 years.
The slider control must be set to the average age (37) of all registered
runners when the page is first displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in
the answer area. Each word or number may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 821
You are developing an airline reservation website by using HTML5 and JavaScript. A page on
the site allows users to enter departure and destination airport information and search for tickets.
You have the following requirements:
Users must be able to save information in the application about their
favorite destination airport.
The airport information must be displayed in the destination text box
whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which lines of code should you use? (To answer, select the appropriate options from the dropdown
lists in the answer area.)
Hot Area:
Correct Answer:
QUESTION 822
You are developing an HTML5 web application for displaying encyclopedia entries.
Each encyclopedia entry has an associated image that is referred to in the entry.
You need to display the image by using the correct semantic markup. What should you do? (To answer, select
the appropriate options from the drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 823
An HTML page has a CANVAS element.
You need to draw a red rectangle on the CANVAS element dynamically. The rectangle should
resemble the following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the
correct location. Each line of code may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/html/html5_canvas.asp
QUESTION 824
You are creating a web worker for an HTML5 application.
The following tasks must be performed from within the web worker:
Register an event listener for the web worker
Start and stop the web worker
You need to define a function that performs the required tasks.
Which code segment should you use? (To answer, select the appropriate option from the drop- down list in the
answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 825
You are creating a function by using JavaScript. The function accepts an object as the parameter
and returns a string that identifies the data type of the object.
You have the following requirements:
The function must return "Number" if the object is a number
The function must return "String" if the object is a string
The function must return "Unknown" if the object is neither a number nor
a string
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, drag the appropriate word to the correct
location in the code segment. Each word may be used once, more than once, or not at all. You
may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/js/js_switch.asp
QUESTION 826
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived
from five style sheets.
The styles are not being applied correctly to the pages in the application.
You need to apply the styles from highest priority to lowest priority.
In which order should you use the five style sheets? (To answer, move the style sheet types from
the list of style sheet types to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3.org/TR/CSS21/cascade.html
From highest priority to lowest priority.
User important style sheets
Author important style sheets
Author normal style sheets
User normal style sheets
User agent style sheets
It is pretty clear in this article: http://www.quora.com/In-what-order-do-CSS-definitions-takepriority
CSS declarations are applied in this order (from lowest to highest priority):
User agent declarations (the default styles your browser applies to elements)
User normal declarations (a user's own stylesheet if they're using one)
Author normal declarations (this is your normal stylesheet)
Author important declarations (anything your mark important)
User important declarations (any important styles from the user's stylesheet)
QUESTION 827
You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new
window.
Which jQuery code segment or segments should you use? (To answer, drag the appropriate line
of code to the correct location. Each line of code may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 828
You are developing an HTML5 application for a company. You apply the following style to a
DIV element on a page.
You need to submit a draft illustration of the results of this code.
Which illustration should you submit? (To answer, select the appropriate illustration in the
answer area.)
Hot Area:
Correct Answer:
QUESTION 829
You are developing a web page that will be accessed from various types of devices.
You have the following requirements:
The appropriate display resolution must be selected dynamically based on
the device that is connecting to the page.
Mobile devices with a maximum width of 480 pixels must be able to use
the page.
You need to ensure that the page displays correctly on any device.
How should you build the code? (To answer, drag the appropriate media statement to the correct
location. Each media statement may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 830
You are developing a web page by using HTML5 and CSS3.
Hyperlinks on the page must be rendered with a style that reflects the last user action performed.
You need to style the four anchor elements in the document.
In what order should you specify the four anchor selectors? (To answer, move the appropriate
anchor selectors from the list of CSS codes to the answer area and arrange them in the correct
order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
You can learn about the anchor pseudo-classes here:
http://www.w3schools.com/css/css_pseudo_classes.asp
As it states:
Note: a: hover MUST come after a: link and a: visited in the CSS definition in order to be
effective!
Note: a: active MUST come after a: hover in the CSS definition in order to be effective!!
QUESTION 831
You are developing an application for an online retailer. The company ships only to certain
countries.
The application must:
Store a list of country codes in an array
Validate the country code of the shipping address against the countries
array
Include a Boolean value in the array that indicates whether or not you can
ship to the country
Display a list of countries that can be shipped to if the user inputs a code
for a country that the retailer cannot ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code
segment or segments from the list of code segments to the correct location or locations in the
work area. Each code segment may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 832
You are developing an airline reservation website by using HTML5 and JavaScript. A page on
the site allows users to enter departure and destination airport information and to search for
tickets.
You have the following requirements:
Users must be able to save information in the application about their
favorite destination airport.
The airport information must be displayed in the destination text box
whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use? (To answer, drag the appropriate command or
commands from the list of commands to the correct location or locations in the work area. Each
line of code may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 833
You are developing a web page for runners who register for a race.
The page includes a slider control that allows users to enter their age.
You have the following requirements:
All runners must enter their age.
Applications must not be accepted from runners less than 18 years of age
or greater than 90 years.
The slider control must be set to the average age (37) of all registered
runners when the page is first displayed.
You need to ensure that the slider control meets the requirements.
What should you do? (To answer, drag the appropriate word or number to the correct location in
the answer area. Each word or number may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 834
You are creating a function named getText().
The function must retrieve information from text files that are stored on a web server.
You need to develop the function to meet the requirement.
Which code segment or segments should you use? (To answer, drag the appropriate command
from the list of commands to the correct location or locations in the work area. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar
between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 835
You are developing an application for a retail store. The application will be used on mobile
devices to provide real-time directions to the store.
You have the following requirements:
The application must find out a user's location.
As the user moves, the application must update the screen with the new
location.
As the user moves, the application must display the user's speed.
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code
segment or segments to the correct location in the work area. Each code segment may be used
once, more than once, or not at all. You may need to drag the split bar between panes or scroll to
view content.)
Select and Place:
Correct Answer:
QUESTION 836
You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows. The first row spans the entire width of the
page and is labeled #Top. The second row contains three columns. The first column is labeled
#Left; the second column is labeled #Main; and the right column is labeled #Right. The #Left
and #Right columns are a fixed width. The #Main column occupies the remaining available
space. The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout.
How should you complete the relevant styles? (To answer, select the appropriate option from
each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 837
You develop an HTML application that calls a Simple Object Access Protocol (SOAP) web
service to retrieve data.
You need to load data from the web service.
What should you do? (To answer, drag the appropriate code segment or code segments to the
correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 838
You are creating a custom style by using CSS3.
You have the following requirements to complete the style:
If the text in a line must wrap to another line, the last word must be able to
break across lines.
All text must be black and have a blue shadow, such that the text appears
to glow blue.
The text must look like the following:
You need to complete the CSS3 style.
How should you complete the relevant code? (To answer, select the appropriate option from each
drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 839
You are developing a web page.
The webpage must display a container. The container must display three colored rectangles near
the top of the container. The colored rectangles are, in order, green, red, and yellow. The
rectangles are aligned horizontally and evenly spaced across the width of the container.
The layout of the page must resemble the following image:
You need to ensure that the page renders properly.
How should you complete the relevant styles? (To answer, select the appropriate option from
each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 840
You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater
than 500.
Display the message Approved! If the PaymentAmount variable is less
than 300.
Display the message Approved with caution! If the PaymentAmount
variable is less than 500 and greater than 300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the
requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the
required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
Use > for greater than comparison.
Use < for less than comparison.
QUESTION 841
You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the
information on the page.
The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page.
How should you create the JavaScript code? (Develop the solution by selecting the required code
segments and arranging them in the correct order. You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
Parse an XML Document
Example. The following code fragment parses an XML document into an XML DOM object:
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
QUESTION 842
You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave
as described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 843
You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks
the add and divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 844
You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
Display a message if users select the first OPTION element, and then
submit the form.
Do not display an alert message if users select any other OPTION
element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment
from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 845
You develop a webpage that consumes a web service. The web service provides currency
exchange rates. Visitors enter the currency type on the webpage and press the Submit button.
The web service returns the current exchange rate.
You need to ensure that the webpage always displays the most current information.
How should you complete the relevant code? (To answer, select the appropriate option from each
drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 846
You develop a webpage.
The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly.
How should you complete the relevant CSS styles? (To answer, select the appropriate option from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 847
A company has an XML file named products.xml on a web server. The file contains a list of the
products that the company sells.
You need to display the contents of the products.xml file in a DIV element named Output.
How should you complete the relevant code? (To answer, select the appropriate option from each
drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 848
You are developing a shared library to format information. The library contains a method named
_private.
The _private method must never be called directly from outside of the shared library.
You need to implement an API for the shared library.
How should you complete the relevant code? (Develop the solution by selecting the required
code segments and arranging them in the correct order. You may not need all of the code
segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
* Here there is a basic example:
// our constructor
function Person(name, age){
this.name = name;
this.age = age;
};
// prototype assignment
Person.prototype = (function(){
// we have a scope for private stuff
// created once and not for every instance
function toString(){
return this.name + " is " + this.age;
};
// create the prototype and return them
return {
// never forget the constructor ...
constructor:Person,
// "magic" toString method
toString:function(){
// call private toString method
return toString.call(this);
}
};
})();
* Example:
You can simulate private methods like this:
function Restaurant() {
}
Restaurant.prototype = (function() {
var private_stuff = function() {
// Private code here
};
return {
constructor:Restaurant,
use_restroom:function() {
private_stuff();
}
};
})();
var r = new Restaurant();
// This will work:
r.use_restroom();
// This will cause an error:
r.private_stuff();
QUESTION 849
You develop an interactive scalable vector graphics (SVG) application. You write the following
HTML markup that makes a rectangle rotate:
You need to control the speed of the rotating rectangle.
How should you complete the relevant code? (To answer, select the appropriate option from each
drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
Note:
* What is SVG?
SVG stands for Scalable Vector Graphics
SVG is used to define vector-based graphics for the Web
SVG defines the graphics in XML format
SVG graphics do NOT lose any quality if they are zoomed or resized
Every element and every attribute in SVG files can be animated
SVG is a W3C recommendation
* Example:
<script>
/* CONSTANTS */
var initialTheta = 0; // The initial rotation angle, in degrees.
var thetaDelta = 0.3; // The amount to rotate the square every "delay" milliseconds, in degrees.
var delay = 10; // The delay between animation stills, in milliseconds. Affects animation
smoothness.
var angularLimit = 90; // The maximum number of degrees to rotate the square.
/*
Note that it will take the square (angularLimit/thetaDelta)*delay milliseconds to rotate an
angularLimit
number of degrees. For example, (90/0.3)*10 = 3000 ms (or 3 seconds) to rotate the square
90 degrees.
*/
/* GLOBALS */
var theSquare; // Will contain a reference to the square element, as well as other things.
var timer; // Contains the setInterval() object, used to stop the animation.
function init()
/*
Assumes that this function is called after the page loads.
*/
{
theSquare = document.getElementById("mySquare"); // Set this custom property after the
page loads.
theSquare.currentTheta = initialTheta; // The initial rotation angle to use when the animation
starts, stored in
timer = setInterval(doAnim, delay); // Call the doAnim() function every "delay" milliseconds
until "timer" is cleared.
}
function doAnim()
/*
This function is called by setInterval() every "delay" milliseconds.
*/
{
if (theSquare.currentTheta > angularLimit)
{
clearInterval(timer); // The square has rotated enough, instruct the browser to stop calling
the doAnim() function.
return; // No point in continuing; stop now.
}
theSquare.setAttribute("transform", "rotate(" + theSquare.currentTheta + ")"); // Rotate the
square by a small amount.
theSquare.currentTheta += thetaDelta; // Increase the angle that the square will be rotated to,
by a small amount.
}
</script>
</head>
QUESTION 850
You create a webpage that includes the following HTML markup: (Line numbers are included
for reference only.)
You need to ensure that a form cannot be submitted unless the INPUT element contains the word
OK.
Which five actions should you perform in sequence? (To answer, move the appropriate actions
from the list of actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 851
You are implementing a web worker by using JavaScript and HTML5. The web worker
processes a long-running loop and returns the result to a webpage.
The web worker is defined on the webpage as follows:
You have the following requirements:
Evaluate the message value in the web worker.
Process the loop based on the iterations value that is passed from the
webpage.
Return a value back to the webpage from the web worker.
You need to implement the web worker.
How should you complete the relevant code? (To answer, drag the appropriate code segment to
the correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* The event object for a message event supports the following additional properties:
the data property contains the message,
the origin property retrieves the scheme, hostname and port of the document that invoked the
postMessage method,
the source property refers to the window object that contains the document that invoked the
postMessage method,
the lastEventId property returns the identifier of the last message.
QUESTION 852
How does the page render? For each statement in the table, select Yes if the behavior is
described. Select No if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 853
You are creating a function by using JavaScript.
You have the following requirements:
The function must display loan amounts to the user within the following HTML element:
<div id="display"></div>
The loan amount of 2100 must display in the HTML element.
All declared variables and functions must be scoped to the myApp variable.
You need to implement the function.
How should you complete the relevant code? (To answer, drag the appropriate code segments to
the correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 854
You create a custom style by using CSS3.
A box with rounded corners must appear around text. The box must match the following
illustration:
You need to add the CSS3 markup to your style.
How should you complete the relevant CSS styles? (To answer, select the appropriate option
from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 855
You implement a callback function by using JavaScript.
You need to process the returned XML data.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 856
You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is
described. Select No if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 857
You create an HTML5 application that includes JavaScript. The application performs several
AJAX requests. One AJAX request retrieves order information from a web service and then
sends the information back to a webpage within the application.
You must create a custom event. You have the following requirements:
The webpage must contain an HTML element named ordersListing that
will receive the custom event notification.
The event name must be ordersReceived.
The event must pass a custom value named orderCount.
The event must run a JavaScript method named
showOrdersReceivedCount after the orders Listing HTML element
receives the event.
Do not allow other DOM elements to receive the event.
Allow the event to be cancelled.
Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX
response.
Which three actions should you perform in sequence? (Develop the solution by selecting the
required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* From Scenario: Do not allow other DOM elements to receive the event.
So: bubbles: false
* From scenario: Allow the event to be cancelled.
So: cancellable: true
* From scenario:
The webpage must contain an HTML element named ordersListing that will receive the custom
event notification.
* Events which are designated as bubbling will initially proceed with the same event flow as
non-bubbling events. The event is dispatched to its target EventTarget and any event listeners
found there are triggered. Bubbling events will then trigger any additional event listeners found
by following the EventTarget's parent chain upward, checking for any event listeners registered
on each successive EventTarget. This upward propagation will continue up to and including the
Document. EventListeners registered as capturers will not be triggered during this phase. The
chain of EventTargets from the event target to the top of the tree is determined before the initial
dispatch of the event. If modifications occur to the tree during event processing, event flow will
proceed based on the initial state of the tree.
* Ajax (an acronym for Asynchronous JavaScript and XML) is a group of interrelated web
development techniques used on the client-side to create asynchronous web applications. With
Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the
background) without interfering with the display and behavior of the existing page. Data can be
retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required
(JSON is often used instead), and the requests do not need to be asynchronous.
QUESTION 858
You are developing an application by using JavaScript.
You must write a function that returns the sum of the variables named v1, v2, v3, v4.
You need to complete the sum function.
How should you complete the relevant code? (To answer, drag the appropriate code segment or
segments to the correct location or locations in the answer area. Use only code segments that
apply.)
Select and Place:
Correct Answer:
QUESTION 859
You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check
box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct
location. Each selector may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 860
You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and
when the mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to
the correct location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 861
You are creating a custom CSS3 style.
You have the following requirements to complete the style:
Box1 has a red outline.
Box1 contains box2, and box2 must remain inside box1
Box2 must have a green to black gradient.
Box2 must be surrounded by white space.
The style resembles the following diagram:
You need to add the CSS3 code to the styles.
How should you complete the relevant code? (To answer, select the appropriate code segment in each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 862
You are validating user input by using built-in JavaScript functions.
The application must:
Store the value that is entered in a variable named inputValue
Use the built-in isNaN(tnputValue) function to evaluate the data type
You need to validate the return value of the isNaN(inputValue) function.
Which values will be returned? (To answer, configure the appropriate options in the dialog box
in the answer area.)
Hot Area:
Correct Answer:
QUESTION 863
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 864
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 865
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 866
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 867
98-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript variable defined: var languages = [];
You need to add statements to an existing JavaScript function to sort the list items. Which four actions should
you perform in sequence? (Develop the solution by selecting the required code segments and arranging them
in the correct order.)
Select and Place:
Correct Answer:
QUESTION 868
99-DRAG DROP You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment: var jsonFruit = { "apples" : "12", "bananas" : "8",
"watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 869
100-DRAG DROP You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
* Create an object that represents an image that will be displayed.
* Set the image properties from the values that are returned by the web service.
* Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation?
(Develop the solution by selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 870
107-HOTSPOT You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows.
The first row spans the entire width of the page and is labeled #Top.
The second row contains three columns.
The first column is labeled #Left; the second column is labeled #Main; and the right column is labeled #Right.
The #Left and #Right columns are a fixed width.
The #Main column occupies the remaining available space.
The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout. How should you complete the relevant styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 871
111-DRAG DROP You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
* Display the message Denied! If the PaymentAmount variable is greater than 500.
* Display the message Approved! If the PaymentAmount variable is less than 300.
* Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater than
300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 872
112-DRAG DROP You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page. The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page. How should you create the JavaScript
code? (Develop the solution by selecting the required code segments and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
QUESTION 873
113-HOTSPOT You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 874
114-HOTSPOT You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 875
121-HOTSPOT You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name. For each statement in the table, select
Yes if the code segment above causes the variable to evaluate as described. Select No if it does not. Make only
one selection in each column.
Hot Area:
Correct Answer:
QUESTION 876
122-HOTSPOT You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
* Display a message if users select the first OPTION element, and then submit the form.
* Do not display an alert message if users select any other OPTION element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 877
124-HOTSPOT You develop a webpage. The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
QUESTION 878
138-HOTSPOT
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 879
141-You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
* Retrieve the content for any OPTION elements when the value of the selected attribute equals selected.
* Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: BD
QUESTION 880
147-HOTSPOT You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
QUESTION 881
158-You are creating a custom object as described by the following code.
You need to implement the calcArea method. Which code should you use?
Correct Answer: D
QUESTION 882
159-DRAG DROP You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location.
Each selector may be used once, more than once, or not at all.
You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 883
164-DRAG DROP You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area.
Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 884
168-You develop an HTML5 webpage. You have the following HTML markup:
You need to call the click event for the addOneltem button a determined number of times when the user clicks
the addBoxOfltems button.
Which code segment should you add to the webpage?
Correct Answer: D
QUESTION 885
17-You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 886
33-You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
* You must place content in the first column of the second row.
* The content must span two columns.
You need to ensure that the style of the grid meets the requirements. Which CSS segment should you use?
Correct Answer: A
QUESTION 887
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the email address and return it as a query string parameter. The query string parameter
must display the @ symbol that is used in the email address.
You need to implement this functionality.
How should you develop the form?
(To answer, drag the appropriate code segment to the correct target or targets in the answer area. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
If you are working with the URI-encoded data and you want to decode the data, you can use either the
decodeURI function to decode a complete URI or the decodeURIComponent function to decode a QueryString.
For example, you can use the following code sample to serialize the form data and then decode the data.
var formData = $('#myForm').serialize();
var data = decodeURIComponent(formData);
Annie: decodeUri, not decodeURIComponent.
http://www.w3schools.com/jquery/ajax_serialize.asp
http://www.w3schools.com/jsref/jsref_encodeuri.asp
http://stackoverflow.com/questions/747641/what-is-the-difference-between-decodeuricomponent-and-decodeuri
Mary-Q103/4,Q149/50. Annie-Q47,Q62
QUESTION 888
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
Explanation/Reference:
The createElement() method creates an element node. This method returns an Element object.
The appendChild() method establishes a father-child relationship between two nodes. If the father node has
children already, the new child will be appended as the last one, and hence can be accessed via the lastChild
method. This method returns the new child node. When calling the appendChild, the child node is specified as
the method's parameter:
fatherObj.appendChild(childObj);
The applyElement() method connects a child to its target father, which has been stripped down from its
existing children and father. This method is only supported by Internet Explorer. When calling the applyElement
method, the father node is specified as the method's parameter:
childObj.applyElement(fatherObj);
http://www.w3schools.com/dom/met_document_createelement.asp
http://www.w3schools.com/dom/met_element_appendchild.asp
http://help.dottoro.com/ljvtwjfo.php
Mary-Q116/17. Annie-Q11
QUESTION 889
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
You must place content in the first column of the second row.
The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
Explanation/Reference:
Mary-Q132/33. Annie-Q23
QUESTION 890
You are creating an application by using HTML5 and CSS3. The styles for the pages are derived from five style
sheets.
The styles are not being applied correctly to the pages in the application.
You need to determine the order in which the style sheets will be applied by the browser.
In which order will the five style sheets be applied? (To answer, move the style sheet types from the list of style
sheet types to the answer area and arrange them in the order that they will be applied.)
Select and Place:
Correct Answer:
Explanation/Reference:
To find the value for an element/property combination, user agents must apply the following sorting order:
1.Find all declarations that apply to the element and property in question, for the target media type.
Declarations apply if the associated selector matches the element in question and the target medium
matches the media list on all @media rules containing the declaration and on all links on the path through
which the style sheet was reached.
2. Sort according to importance (normal or important) and origin (author, user, or user agent). In ascending
order of precedence:
user agent declarations
user normal declarations
author normal declarations
author important declarations
user important declarations
3. Sort rules with the same importance and origin by specificity of selector: more specific selectors will override
more general ones. Pseudo-elements and pseudo-classes are counted as normal elements and classes,
respectively.
4. Finally, sort by order specified: if two declarations have the same weight, origin and specificity, the latter
specified wins. Declarations in imported style sheets are considered to be before any declarations in the style
sheet itself.
Apart from the "!important" setting on individual declarations, this strategy gives author's style sheets higher
weight than those of the reader. User agents must give the user the ability to turn off the influence of specific
author style sheets, e.g., through a pull-down menu. Conformance to UAAG 1.0 checkpoint 4.14 satisfies this
condition [UAAG10]
http://www.w3.org/TR/CSS21/cascade.html#cascading-order
Mary-Q16/86, Q133/34. Annie-Q57
Slightly another question: You need to apply the styles from highest priority to lowest priority.
QUESTION 891
You are styling a box object on a page by using CSS3.
You need to set the transparency of the object to 50%.
Which two C5S3 styles will achieve the goal? (Each correct answer presents a complete solution. Choose two.)
Correct Answer: BC
Explanation/Reference:
podlodkin from Latvia - Nov 01, 2013:
B&C
http://www.w3schools.com/cssref/css3_pr_opacity.asp
http://www.w3schools.com/cssref/css_colors_legal.asp
Mary-Q135/36. Annie-Q25
QUESTION 892
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. blink
B. line-through
C. lowercase
D. 20px
E. italic
F. hidden
G. red
Correct Answer: C
Explanation/Reference:
Mary: D(20px)
trixter from India - Oct 22, 2013:
shouldnt the answer be lowercase?
http://www.w3schools.com/cssref/pr_text_text-transform.asp
Mary-Q1/71,Q14/84,Q15/85
QUESTION 893
You are developing an HTML5 web application and are styling text.
You need to use the text-transform CSS property.
Which value is valid for the text-transform property?
A. italic
B. red
C. line-through
D. capitalize
E. 20px
F. hidden
G. blink
Correct Answer: D
Explanation/Reference:
Mary-Q5/75,Q10/80,Q11/81,Q17/87,Q137/38. Annie-Q26
QUESTION 894
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <article>
B. <table>
C. <div>
D. <span>
E. <tbody>
F. <cd>
G. <div>
Correct Answer: A
Explanation/Reference:
The <article> tag specifies independent, self-contained content. An article should make sense on its own and it
should be possible to distribute it independently from the rest of the site.
Potential sources for the <article> element:
Forum post
Blog post
News story
Comment
The <tbody> tag is used to group the body content in an HTML table.
The <tbody> element is used in conjunction with the <thead> and <tfoot> elements to specify each part of a
table (body, header, footer).
http://www.w3schools.com/tags/tag_article.asp
http://www.w3schools.com/tags/tag_tbody.asp
Mary-Q6/76,Q12/82,Q60/130,Q164/65. Annie-Q42
QUESTION 895
You are modifying a blog site to improve search engine readability.
You need to group relevant page content together to maximize search engine readability.
Which tag should you use?
A. <span>
B. <nav>
C. <table>
D. <section>
E. <tbody>
F. <div>
Correct Answer: D
Explanation/Reference:
Mary: Answer A (<span>)
vva from Lithuania - Oct 16, 2013:
A (span) is marked as the correct one. Shouldn't it be D (section)?
Sanju from Norway - Oct 17, 2013:
Yes. This answer is wrong but you can see that this question is already repeated in this set of questions and the
correct answer is section.
Ali from Ireland - Oct 21, 2013:
Answer should be d) , i.e. <section> and not <span> as indicated. Possible answers to this question are
<section> or <aside>
Mary-Q8/78,Q13/83
QUESTION 896
You are developing an HTML5 page that includes several paragraph elements.
You have the following requirements:
Add a drop shadow that is one inch below the text in the paragraph
Set the radius of the drop shadow to five pixels
You need to style the paragraphs to meet the requirements. Which CSS style should you use?
A. text-shadow: 0pt 72pt 5pt;
B. text-shadow: 5px 1in 0px;
C. text-shadow: 0em 72pt 5px;
D. text-shadow: 100px 0px 5px;
E. text-shadow: 5em 72pt 0px;
Correct Answer: C
Explanation/Reference:
text-shadow: h-shadow v-shadow blur color;
Note: The text-shadow property attaches one or more shadows to text. The property is a comma-separated list
of shadows, each specified by 2 or 3 length values and an optional color. Omitted lengths are 0.
h-shadow Required. The position of the horizontal shadow. Negative values are allowed
v-shadow Required. The position of the vertical shadow. Negative values are allowed
blur Optional. The blur distance
color Optional. The color of the shadow. Look at CSS Color Values for a complete list of possible color
values
1inch = 72pt ~= 96px
http://www.w3schools.com/cssref/css3_pr_text-shadow.asp
http://reference.sitepoint.com/css/text-shadow
http://www.w3.org/TR/css3-text/#text-shadow
<!DOCTYPE html>
<html>
<head>
<style>
h1 { text-shadow:0em 72pt 5px; }
</style>
</head>
<body>
<h1>Text-shadow effect</h1>
</body>
</html>
--------------------------------------------------------------------------------------------------------------
Mary&Sam: Answer B
Mary: It seems like none of the above is correct! The correct answer should be:
text-shadow: 0 72pt 5px;
Mary-Q4/74,Q130/31. Annie-Q21
QUESTION 897
You are developing a customer web form that includes the following HTML.
<input id="txtValue"/>
You need to change the HTML markup so that customers can enter only a valid three-letter country code.
Which HTML should you use?
A. <input id="txtValue" type="country"/>
B. <input id="txtValue" type="text" required="xxx"/>
C. <input id="txtVa!ue" type="text" pattern="[A-Za-z]{3}"/>
D. <input id="txtValuen type="code" pattern"="country"/>
Correct Answer: C
Explanation/Reference:
Mary-Q9/79
QUESTION 898
You develop an HTML5 webpage. You have the following HTML markup: (Line numbers are for reference
only.)
The webpage also contains the following CSS markup:
You need to determine how the webpage will appear when the CSS styles are applied. Select two.
A. The first row of the table will have a red background.
B. The second row of the table will have a red background.
C. The second cell in the first row of the table will have a blue background.
D. The second cell in the third row of the table will have a blue background.
E. The second cell in the third row of the table will not have blue background.
Correct Answer: AD
Explanation/Reference:
The :nth-child(n) selector matches every element that is the nth child, regardless of type, of its parent.
The :nth-of-type(n) selector matches every element that is the nth child, of a particular type, of its parent.
n can be a number, a keyword, or a formula.
http://www.w3schools.com/cssref/sel_nth-child.asp
http://www.w3schools.com/cssref/sel_nth-of-type.asp
<!DOCTYPE html>
<html>
<head>
<style>
table
{
border: 1px solid black;
font-family: arial;
}
tr:nth-child(odd)
{
background-color: red;
}
tr td:nth-of-type(even)
{
background-color: blue;
}
</style>
</head>
<body>
<table>
<tr>
<th>Fruit</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<tr>
<td>Apples</th>
<td>48</th>
<td>$0.29</th>
</tr>
<tr>
<td>Bananas</th>
<td>72</th>
<td>$0.19</th>
</tr>
<tr>
<td>Watermelon</th>
<td>14</th>
<td>$3.99</th>
</tr>
</table>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------
Mary&Sam: Answer A&E
H5 from Italy - Oct 20, 2013:
The right answers should be:
- A The first row of the table will have a red background
- D The second cell in the third row of the table will have a blue background.
EL from Norway - Nov 01, 2013:
The answers are A, C & D.
podlodkin from Latvia - Nov 01, 2013:
The answers are A & D. You can copy this text in html file & check:
<style>
table {border:1px solid black; }
tr:nth-child(odd) {background-color:red;}
tr td:nth-of-type(even) {background-color:blue;}
</style>
<table>
<tr><th>s</th><th>s</th><th>s</th></tr>
<tr><td>aaa</td><td>aaa</td><td>aaa</td></tr>
<tr><td>aaa</td><td>aaa</td><td>aaa</td></tr>
<tr><td>aaa</td><td>aaa</td><td>aaa</td></tr>
</table>
Frank from Netherlands - Nov 05, 2013:
A&D are correct
Rourke from Croatia - Nov 05, 2013:
Looks like
A. The first row of the table will have a red background. (TRUE)
B. The second row of the table will have a red background. (FALSE)
C. The second cell in the first row of the table will have a blue background. (TRUE)
D. The second cell in the third row of the table will have a blue background. (TRUE)
E. The second cell in the third row of the table will have not have blue background. (FALSE)
Check out: http://jsbin.com/iREBaGe/1
Hansbla from Netherlands - Nov 06, 2013:
You're wrong about C. That's false as your own example shows
Rourke from Croatia - Nov 06, 2013:
That's right. Thx. Stupid man mistake. :)
Atiq Ur Rehman from Pakistan - Nov 20, 2013:
The Correct ans is not AE. The Correct ans is either AC or AD (Both are AC and AD are True)
A- The first row of the table will have a red background.
C- The second cell in the first row of the table will have a blue background.
D- The second cell in the third row of the table will have a blue background.
Mary-Q18/88
QUESTION 899
You are reviewing the CSS markup for an HTML5 page that displays a news article. The CSS markup for the
page is as follows:
The HTML markup for the page is as follows:
For each statement in the table, select Yes if the code segments above causes the page to behave as
described. Select No if it does not. Make only one selection in each row.
Hot Area:
Correct Answer:
Explanation/Reference:
<!DOCTYPE html>
<html>
<head>
<style>
h4 {
color: powderblue;
}
.headline {
color:red;
}
article: {
color: black;
font-style: normal;
}
aside h4 {
font-style: italic !important;
color: yellow;
}
article h4 {
font-style: normal;
color: sienna;
}
</style>
</head>
<body>
<div>
<h4>International News</h4>
<article>
<h4 class="headline">New Developments!</h4>
<aside>
<h4>Impact On Markets</h4>
</aside>
</article>
</div>
</body>
</html>
Mary-Q19/89
QUESTION 900
You implement an application by using HTML5 and JavaScript. You create a webpage that contains the
following HTML:
The application must place a border on only the first UL element that is contained in the DIV element. You need
to update the webpage. What should you do?
Correct Answer: B
Explanation/Reference:
(D) can't work because 'container' is id, not class
(B) works as required:
.css() - Get the value of a style property for the first element in the set of matched elements or set one or
more CSS properties for every matched element.
http://api.jquery.com/css/
<!DOCTYPE html>
<html>
<head>
<style>
.container > ul {
border: 1px solid black;
}
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="container">
<ul>
<li>First Child Item
<ul>
<li>Child ListItem</li>
</ul>
</li>
<li>Second Child Item</li>
<li>Third Child Item</li>
<li>Fourth Child Item</li>
</ul>
<p>Some interesting information that we need to display.</p>
<p>More information that is important for this page.</p>
</div>
<script type="text/javascript">
$("div#container > ul").css("border", "1px solid black");
</script>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------
Mary: Answer D (.container)
Ali from Ireland - Oct 22, 2013:
Answer is b) not D). i.e. it should be $('div#container >ul').css("border","1px solid black "); if you copy it into Edit
fiddle or JSBin
volland from Bulgaria - Nov 09, 2013:
Correct answer is B check it here: http://jsfiddle.net/volland/TprSS/
the marked answer is not working. Marking both ul's
Mary-Q22/92
QUESTION 901
You are implementing an application by using HTML5 and JavaScript. A web page contains the following HTML
table.
The application must:
Identify all rows in the table body that have a class attribute of selected
Exclude the last selected row in the table
You need to implement the web page according to the requirements.
Which CSS selector should you use?
A. tr:not(tr:last-child).selected < #dataTable
B. #dataTable > tr.selected:not(tr:last-child)
C. #dataTable tbody tr.selected:not(:last-child)
D. #dataTable tr.selected:not(tr:last-child)
Correct Answer: C
Explanation/Reference:
The :last-child selector matches every element that is the last child of its parent.
Tip: p:last-child is equal to p:nth-last-child(1).
http://www.w3schools.com/cssref/sel_last-child.asp
http://www.w3schools.com/cssref/sel_nth-last-child.asp
http://www.w3schools.com/cssref/sel_not.asp
<!doctype html>
<html lang="en">
<head>
<style>
tr { background-color: magenta; }
tr.selected { background-color: green; }
tbody tr { background-color: gray; }
tbody tr.selected { background-color: yellow; }
#dataTable tbody tr.selected:not(:last-child) {
background-color: red; }
</style>
</head>
<body>
<table id="dataTable">
<tbody>
<tr><td>...</td></tr>
<tr class="selected"><td>...</td></tr>
<tr><td>...</td></tr>
<tr class="selected"><td>...</td></tr>
<tr><td>...</td></tr>
<tr class="selected"><td>...</td></tr>
</tbody>
<tfoot>
<tr class="selected"><td>...</td></tr>
<tr class="selected"><td>...</td></tr>
<tr class="selected"><td>...</td></tr>
</tfoot>
</table>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
--------------
Mary/Sam: Option C - with (tr:last-child)
mahen from Norway - Nov 02, 2013:
I am trying but not getting correct answer.
Rourke from Croatia - Nov 05, 2013:
I couldn't find solution with implementation. Tried in Chrome and IE10. Nevertheless I'd go with last answer.
Check out implementation: http://jsbin.com/iZOSURE/1
debez from Poland - Nov 12, 2013:
There is no correct answer in this dump.
The working css is: #dataTable tbody tr.selected:not(:last-child)
So it is similar to option C, but without "tr" in not() selector.
Mary-Q24/94
QUESTION 902
You are developing a customer web form that includes following HTML.
<input id= "textAccountType"/>
You need to develop the form so that customers can enter only a valid account type consisting of two English
alphabet characters.
Which code segment should you use?
Correct Answer: B
Explanation/Reference:
.val() works on input elements (or any element with a value attribute?) and .text() will not work on input
elements. .val() gets the value of the input element - regardless of type. .text() gets the innerText (not
HTML) of all the matched elements:
.text()
The result is a string that contains the combined text contents of all matched elements. This method works
on both HTML and XML documents. Cannot be used on input elements. For input field text use the val attribute.
.val()
Get the content of the value attribute of the first matched element
http://stackoverflow.com/questions/807867/difference-between-val-and-text
http://www.w3schools.com/jsref/jsref_obj_regexp.asp
Mary-Q26/96
QUESTION 903
You are developing an application that uses a JavaScript library. The library contains the following functions.
The application uses the following code. (Line numbers are included for reference only.)
The library may throw many types of exceptions. The exceptions are grouped by category.
You need to catch and identify the exceptions by group. Which code segment should you insert at line 05?
Correct Answer: B
Explanation/Reference:
The typeof operator returns type information as a string. There are six possible values that typeof returns:
"number," "string," "boolean," "object," "function," and "undefined."
The instanceof operator returns true if object is an instance of class. It returns false if object is not an instance
of class, or if object is null.
http://msdn.microsoft.com/en-us/library/ie/259s7zc1%28v=vs.94%29.aspx
http://msdn.microsoft.com/en-us/library/ie/zh0zb36z%28v=vs.94%29.aspx
Mary-Q27/97
QUESTION 904
You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript variable defined: var languages = [];
You need to add statements to an existing JavaScript function to sort the list items.
Which four actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
The sort() method sorts the items of an array. The sort order can be either alphabetic or numeric, and either
ascending or descending.
Default sort order is alphabetic and ascending.
Note: When numbers are sorted alphabetically, "40" comes before "5".
To perform a numeric sort, you must pass a function as an argument when calling the sort method.
var points = [40,100,1,5,25,10];
points.sort(function(a,b){return a-b});
jQuery.makeArray() converts an array-like object into a true JavaScript array.
// Returns a NodeList
var elems = document.getElementsByTagName("div");
// Convert the NodeList to an Array
var arr = $.makeArray(elems);
// Use an Array method on list of dom elements
.appendTo() inserts every element in the set of matched elements to the end of the target.
<h2>Greetings</h2>
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
</div>
We can create content and insert it into several elements at once:
$("<p>Test</p>").appendTo(".inner");
Each inner <div> element gets this new content:
<h2>Greetings</h2>
<div class="container">
<div class="inner">
Hello
<p>Test</p>
</div>
<div class="inner">
Goodbye
<p>Test</p>
</div>
</div>
We can also select an element on the page and insert it into another:
$("h2").appendTo( $(".container") );
If an element selected this way is inserted into a single location elsewhere in the DOM, it will be moved into the
target (not cloned) and a new set consisting of the inserted element is returned:
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
<h2>Greetings</h2>
</div>
If there is more than one target element, however, cloned copies of the inserted element will be created for
each target after the first, and that new set (the original element plus clones) is returned.
http://www.w3schools.com/jsref/jsref_sort.asp
http://api.jquery.com/jQuery.makeArray/
http://api.jquery.com/appendTo/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>css demo</title>
<script type="text/javascript">
function sortItems() {
var languages = [];
var items = document.getElementsByTagName("li");
for (var i = 0, l = items.length; i < l; i++)
languages.push(items[i].innerHTML);
languages.sort();
for (var i = 0, l = items.length; i < l; i++)
items[i].innerHTML = languages[i];
}
</script>
</head>
<body>
<ul id="languages">
<li>HTML</li>
<li>JavaScript</li>
<li>Classic ASP</li>
<li>ASP.Net</li>
</ul>
<button onclick="sortItems()">Sort</button>
</body>
</html>
Mary-Q28/98
QUESTION 905
You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment: var jsonFruit = { "apples" : "12", "bananas" : "8",
"watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
.appendTo() inserts every element in the set of matched elements to the end of the target.
<h2>Greetings</h2>
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
</div>
We can create content and insert it into several elements at once:
$("<p>Test</p>").appendTo(".inner");
Each inner <div> element gets this new content:
<h2>Greetings</h2>
<div class="container">
<div class="inner">
Hello
<p>Test</p>
</div>
<div class="inner">
Goodbye
<p>Test</p>
</div>
</div>
We can also select an element on the page and insert it into another:
$("h2").appendTo($(".container"));
If an element selected this way is inserted into a single location elsewhere in the DOM, it will be moved into the
target (not cloned) and a new set consisting of the inserted element is returned:
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
<h2>Greetings</h2>
</div>
If there is more than one target element, however, cloned copies of the inserted element will be created for
each target after the first, and that new set (the original element plus clones) is returned.
.after( content [, content ]) inserts content, specified by the parameter, after each element in the set of
matched elements.
Content can be created and then inserted after several elements at once:
$(".inner").after("<p>Test</p>");
Each inner <div> element gets this new content:
<div class="container">
<h2>Greetings</h2>
<div class="inner">Hello</div>
<p>Test</p>
<div class="inner">Goodbye</div>
<p>Test</p>
</div>
jQuery.each(collection, callback(indexInArray, valueOfElement)) - a generic iterator function, which can be
used to iterate over any collection, whether it is an object or an array. In the case of an array, the callback is
passed an array index and a corresponding array value each time. (The value can also be accessed through
the this keyword, but Javascript will always wrap the this value as an Object even if it is a simple string or
number value.) The method returns its first argument, the object that was iterated.
$.each([ 52, 97 ], function( index, value ) {
alert( index + ": " + value );
});
This produces two messages:
0: 52
1: 97
If an object is used as the collection, the callback is passed a key-value pair each time:
var obj = { "flammable": "inflammable", "duh": "no duh" };
$.each(obj, function(key, value) {
alert( key + ": " + value );
});
Once again, this produces two messages:
flammable: inflammable
duh: no duh
jQuery.getJSON(url [, data] [, success(data, textStatus, jqXHR)]) loads JSON-encoded data from the
server using a GET HTTP request.
$.getJSON("demo_ajax_json.js", function(result){
$.each(result, function(i, field){
$("div").append(i + ": " + field + "<br />");
});
});
jQuery.parseJSON(json) takes a well-formed JSON string and returns the resulting JavaScript object.
var obj = jQuery.parseJSON( '{ "name": "John" }' );
alert( obj.name === "John" );
http://api.jquery.com/appendTo/
http://api.jquery.com/after/
http://api.jquery.com/jQuery.each/
http://api.jquery.com/jQuery.getJSON/
http://www.w3schools.com/jquery/ajax_getjson.asp
http://api.jquery.com/jQuery.parseJSON/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>css demo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
function addFruits() {
var jsonFruit = { "apples" : "12", "bananas" : "8", "watermelon" : "3" }
$.each(jsonFruit, function(key, val) {
$("<tr><td>" + key + "</td><td>" + val + "</td></tr>")
.appendTo('#fruitTable');
});
}
</script>
</head>
<body>
<table id="fruitTable">
<tr>
<th>Fruit</th>
<th>Inventory</th>
</tr>
</table>
<button onclick="addFruits()">Add Fruits</button>
</body>
</html>
Mary-Q29/99
QUESTION 906
You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
Create an object that represents an image that will be displayed.
Set the image properties from the values that are returned by the web service.
Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation? (Develop the solution by
selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
jQuery.getJSON(url [, data] [, success(data, textStatus, jqXHR)]) loads JSON-encoded data from the
server using a GET HTTP request.
$.getJSON("demo_ajax_json.js", function(result){
$.each(result, function(i, field){
$("div").append(i + ": " + field + "<br />");
});
});
Use ready() to make a function available after the document is loaded:
$(document).ready(function(){
$("button").click(function(){
$("p").slideToggle();
});
});
http://www.w3schools.com/jquery/ajax_getjson.asp
http://www.w3schools.com/jquery/event_ready.asp
http://unschooled.org/2012/03/understanding-javascript-this/
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>css demo</title>
<script type="text/javascript" src="Scripts/jquery-2.0.3.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#submit').click(function() {
var result = {
"FileName": "http://www.w3schools.com/images/w3logotest2.png",
"Description": "w3schools logo"
};
var personImage = new PersonImage(result);
$("#happy").html(personImage.img);
});
});
function PersonImage(image)
{
var img = document.createElement('img');
img.alt = image.Description;
img.src = image.FileName;
this.img = img;
}
</script>
</head>
<body>
<button id="submit">Get Image</button>
<div id="happy"></div>
</body>
</html>
---------------------------------------------------------------------------------
--------
Mary&Sam: Answer
Mary-Q30/100
QUESTION 907
You develop an HTML messaging application that allows users to send messages. The messages can have an
optional file attachment that is identified by a filename. You use the following function to send a message:
You need to send a message with a file attachment. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
http://www.w3schools.com/json/json_syntax.asp
http://javascript.info/tutorial/arguments
Mary-Q31/101
QUESTION 908
You develop an HTML application that calls a web service to retrieve JSON data. The web service contains one
method named GetFullName that returns an Object named data. The data object contains two properties
named GivenName and Surname.
You need to load data from the web service to the webpage. How should you complete the relevant code? (To
answer, drag the appropriate code segment or code segments to the correct location or locations in the answer
area. Use only code segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
AJAX is a technique for creating fast and dynamic web pages.
AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server
behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole
page.
http://www.w3schools.com/ajax/ajax_intro.asp
Mary-Q32/102
QUESTION 909
You develop an HTML5 application that allows images to be dragged and dropped within a webpage. The
webpage contains a DIV element and four IMG elements as defined in the code segment below:
You need to enable drag and drop for the application. How should you complete the relevant code? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
Make an Element Draggable
First of all: To make an element draggable, set the draggable attribute to true:
<img draggable="true">
What to Drag - ondragstart and setData()
Then, specify what should happen when the element is dragged.
In the example above, the ondragstart attribute calls a function, drag(event), that specifies what data to be
dragged.
The dataTransfer.setData() method sets the data type and the value of the dragged data:
function drag(ev)
{
ev.dataTransfer.setData("Text", ev.target.id);
}
In this case, the data type is "Text" and the value is the id of the draggable element ("drag1").
Where to Drop - ondragover
The ondragover event specifies where the dragged data can be dropped.
By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default
handling of the element.
This is done by calling the event.preventDefault() method for the ondragover event:
event.preventDefault()
Do the Drop - ondrop
When the dragged data is dropped, a drop event occurs.
In the example above, the ondrop attribute calls a function, drop(event):
function drop(ev)
{
ev.preventDefault();
var data = ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
Code explained:
Call preventDefault() to prevent the browser default handling of the data (default is open as link on drop)
Get the dragged data with the dataTransfer.getData("Text") method. This method will return any data that
was set to the same type in the setData() method
The dragged data is the id of the dragged element ("drag1")
Append the dragged element into the drop element
http://www.w3schools.com/html/html5_draganddrop.asp
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
#div1 {width:350px;height:70px;padding:10px;border:1px solid #00aaaa;}
</style>
<script>
function allowDrop(ev)
{
ev.preventDefault();
}
function drag(ev)
{
ev.dataTransfer.setData("Text", ev.target.id);
}
function drop(ev)
{
ev.preventDefault();
var data=ev.dataTransfer.getData("Text");
ev.target.appendChild(document.getElementById(data));
}
</script>
</head>
<body>
<p>Drag the W3Schools image into the rectangle:</p>
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
<br>
<img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)"
width="336" height="69">
</body>
</html>
Mary-Q34/104
QUESTION 910
You are creating a function named getText().
The function must retrieve information from text files that are stored on a web server. You need to develop the
function to meet the requirement.
Which code segment or segments should you use? (To answer, drag the appropriate command from the list of
commands to the correct location or locations in the work area. Each code segment may be used once, more
than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
The XMLHttpRequest object is used to exchange data with a server behind the scenes.
The following code fragment parses an XML document into an XML DOM object. To send a request to a
server, we use the open() and send() methods of the XMLHttpRequest object:
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "books.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
open(method, url, async) - Specifies the type of request, the URL, and if the request should be handled
asynchronously or not.
method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
send(string) - Sends the request off to the server.
string: Only used for POST requests
GET is simpler and faster than POST, and can be used in most cases. However, always use POST requests
when:
A cached file is not an option (update a file or database on the server)
Sending a large amount of data to the server (POST has no size limitations)
Sending user input (which can contain unknown characters), POST is more robust and secure than GET
To avoid caching, add a unique ID to the URL:
xmlhttp.open("GET","demo_get.asp?t=" + Math.random(),true);
The readyState property returns the (loading) status of the current document.
Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
getAllResponseHeaders returns header information
getResponseHeader method returns the specified response header.
http://www.w3schools.com/xml/xml_http.asp
http://www.w3schools.com/ajax/ajax_xmlhttprequest_send.asp
http://www.w3schools.com/jsref/prop_doc_readystate.asp
http://www.w3schools.com/dom/dom_http.asp
http://msdn.microsoft.com/en-us/library/ie/ms536442%28v=vs.85%29.aspx
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<form>
<input type="button" value="Submit" onclick="getText()" />
<div id="results"></div>
</form>
<script>
function getText() {
var req = new XMLHttpRequest();
req.onreadystatechange=function() {
if (req.readyState==4 && req.status==200)
{
document.getElementById("results").innerHTML = req.responseText;
}
}
req.open("GET","http://www.w3schools.com/dom/xmlhttp_info.txt",true);
req.send();
}
</script>
</body>
</html>
Mary-Q35/105
QUESTION 911
You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows.
The first row spans the entire width of the page and is labeled #Top.
The second row contains three columns.
The first column is labeled #Left; the second column is labeled #Main; and the right column is labeled
#Right.
The #Left and #Right columns are a fixed width.
The #Main column occupies the remaining available space.
The third and final row spans the entire width of the page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout. How should you complete the relevant styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
Applies to: parent flex container element
display: flex | inline-flex - defines a flex container; inline or block depending on the given value. Thus, it
enables a flex context for all its direct children.
flex-direction: row | row-reverse | column | column-reverse - establishes the main-axis, thus defining the
direction flex items are placed in the flex container.
flex-wrap: nowrap | wrap | wrap-reverse - defines whether the flex container is single-line or multi-line, and
the direction of the cross-axis, which determines the direction new lines are stacked in.
flex-flow: <'flex-direction'> || <'flex-wrap'> - a shorthand `flex-direction` and `flex-wrap` properties, which
together define the flex container's main and cross axes. Default is `row nowrap`;
justify-content: flex-start | flex-end | center | space-between | space-around - defines the alignment along
the main axis. It helps distribute extra free space leftover when either all the flex items on a line are inflexible, or
are flexible but have reached their maximum size. It also exerts some control over the alignment of items when
they overflow the line.
align-items: flex-start | flex-end | center | baseline | stretch - defines the default behaviour for how flex
items are laid out along the cross axis on the current line. Think of it as the justify-content version for the cross-
axis (perpendicular to the main-axis).
align-content: flex-start | flex-end | center | space-between | space-around | stretch - aligns a flex
container's lines within when there is extra space in the cross-axis, similar to how justify-content aligns
individual items within the main-axis.
Applies to: child element / flex item
order: <integer> - by default, flex items are layed out in the source order. However, the order property controls
the order in which they appear in their container.
flex-grow: <number> (default 0) - defines the ability for a flex item to grow if necessary. It accepts a unitless
value that serves as a proportion. It dictates what amount of the available space inside the flex container the
item should take up. If all items have flex-grow set to 1, every child will set to an equal size inside the container.
If you were to give one of the children a value of 2, that child would take up twice as much space as the others.
flex-shrink: <number> (default 1) - defines the ability for a flex item to shrink if necessary.
flex-basis: <length> | auto (default auto) - defines the default size of an element before the remaining space
is distributed.
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ] - shorthand for flex-grow, flex-shrink and flex-
basis. The second and third parameters (flex-shrink, flex-basis) are optional. Default is 0 1 auto.
align-self: auto | flex-start | flex-end | center | baseline | stretch - allows the default alignment or the one
specified by align-items to be overridden for individual flex items.
The box-flex-group property is used to assign flexible elements to flex groups. Is not supported in any of the
major browsers.
To enable flexbox layout, you must first create a flexbox container. Do this by setting the display property of an
element to either "-ms-flexbox" (for a block-level flexbox container) or "-ms-inline-flexbox" (for an inline flexbox
container). For instance, the following code example creates a block-level flexbox container within the element
that has an ID of "myFlexbox":
<style type="text/css">
#myFlexbox {
display: -ms-flexbox;
background: gray;
border: blue;
}
</style>
http://css-tricks.com/snippets/css/a-guide-to-flexbox/
http://msdn.microsoft.com/en-us/library/ie/hh673531%28v=vs.85%29.aspx
<!DOCTYPE html>
<html>
<head>
<style>
div {border: 1px solid;}
#top {width: 100%; height: 200px;}
#content {
display: -ms-flexbox;
flex-direction: row;
width: 100%;
}
#content #left {width: 200px; height: 300px;}
#content #right {width: 200px; height: 300px;}
#content #main {flex-grow: 1}
#bottom {width: 100%; height: 200px;}
</style>
</head>
<body>
<div id="top"></div>
<div id="content">
<div id="left"></div>
<div id="main"></div>
<div id="right"></div>
</div>
<div id="bottom"></div>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
------------
flex-flow and flex-direction can both be used.
Mary-Q37/107
QUESTION 912
You develop an HTML application that calls a Simple Object Access Protocol (SOAP) web service to retrieve
data.
You need to load data from the web service.
What should you do? (To answer, drag the appropriate code segment or code segments to the correct location
or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
jQuery.ajax( url [, settings ]) - Perform an asynchronous HTTP (Ajax) request.
settings - a set of key/value pairs that configure the Ajax request. All settings are optional.
async (default: true)
beforeSend - a pre-request callback function
cache (default: true, false for dataType 'script' and 'jsonp')
complete - a function to be called when the request finishes
contents - an object of string/regular-expression pairs that determine how jQuery will parse the response,
given its content type
contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8'). When sending data to the
server, use this content type.
context - this object will be made the context of all Ajax-related callbacks.
converters (default: {"* text": window.String, "text html": true, "text json": jQuery.parseJSON, "text xml":
jQuery.parseXML}) - an object containing dataType-to-dataType converters.
crossDomain (default: false for same-domain requests, true for cross-domain requests) - if you wish to force
a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true.
data - data to be sent to the server. It is converted to a query string, if not already a string.
dataFilter - a function to be used to handle the raw response data of XMLHttpRequest
dataType (default: Intelligent Guess (xml, json, script, or html)) - the type of data that you're expecting back
from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response.
error - a function to be called if the request fails.
global (default: true) - whether to trigger global Ajax event handlers for this request.
headers (default: {}) - an object of additional header key/value pairs to send along with requests using the
XMLHttpRequest transport.
ifModified (default: false) - allow the request to be successful only if the response has changed since the last
request.
isLocal (default: depends on current location protocol) - allow the current environment to be recognized as
"local," (e.g. the filesystem), even if jQuery does not recognize it as such by default.
jsonp - override the callback function name in a jsonp request.
jsonpCallback - specify the callback function name for a JSONP request. This value will be used instead of
the random name automatically generated by jQuery.
mimeType - a mime type to override the XHR mime type
password - a password to be used with XMLHttpRequest in response to an HTTP access authentication
request.
processData (default: true) - by default, data passed in to the data option as an object (technically, anything
other than a string) will be processed and transformed into a query string, fitting to the default content-type
"application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data,
set this option to false.
scriptCharset - only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or
"script" dataType and "GET" type).
statusCode (default: {}) - an object of numeric HTTP codes and functions to be called when the response
has the corresponding code
success - a function to be called if the request succeeds. The function gets passed three arguments: The
data returned from the server, formatted according to the dataType parameter; a string describing the
status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.
timeout - set a timeout (in milliseconds) for the request
traditional - set this to true if you wish to use the traditional style of param serialization
type (default: 'GET') - the type of request to make ("POST" or "GET"), default is "GET".
url (default: The current page) - a string containing the URL to which the request is sent.
username - a username to be used with XMLHttpRequest in response to an HTTP access authentication
request.
xhr (default: ActiveXObject when available (IE), the XMLHttpRequest otherwise) - callback for creating the
XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise.
xhrFields - an object of fieldName-fieldValue pairs to set on the native XHR object.
http://api.jquery.com/jQuery.ajax/
--------------------------------------------------------------------------------------------------------------------------------------------------
------------------
Mary: Answer
but as stated in the article:
contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8')
When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded;
charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always
sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is
always UTF-8; specifying another charset will not force the browser to change the encoding.
Mary-Q38/108
QUESTION 913
You are developing a web page. The webpage must display a container. The container must display three
colored rectangles near the top of the container.
The colored rectangles are, in order, green, red, and yellow. The rectangles are aligned horizontally and evenly
spaced across the width of the container.
The layout of the page must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant styles? (To answer,
select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
display: flex | inline-flex - defines a flex container; inline or block depending on the given value. Thus, it
enables a flex context for all its direct children.
flex-direction: row | row-reverse | column | column-reverse - establishes the main-axis, thus defining the
direction flex items are placed in the flex container.
-ms-flex-pack: start | end | center | justify - specifies how excess space is distributed (along the axis defined
by the -ms-flex-direction property) between child elements of the object.
-ms-flex-align: start | end | stretch | baseline - specifies the alignment (perpendicular to the layout axis
defined by the -ms-flex-direction property) of child elements of the object.
Caution: Internet Explorer 11 no longer supports the Microsoft vendor prefix ("-ms-") version of the flexbox
properties. You should instead use the non-prefixed names, which is preferred for better standards compliance
and future compatibility.
http://msdn.microsoft.com/en-us/library/ie/hh673531%28v=vs.85%29.aspx
http://css-tricks.com/snippets/css/a-guide-to-flexbox/
http://www.css-wiki.com/css-eigenschaft/flex-align
<!DOCTYPE html>
<html>
<head>
<style>
#flexContainer {
width: 300px;
height: 80px;
border: solid 1px #949494;
padding: 20px;
background-color: #aaaaaa;
display: -ms-flexbox;
-ms-flex-direction: row;
-ms-flex-align: start;
-ms-flex-pack: justify;
}
#item1 {
width: 80px;
height: 50px;
background: green;
}
#item2 {
width: 80px;
height: 50px;
background: red;
}
#item3 {
width: 80px;
height: 50px;
background: yellow;
}
</style>
</head>
<body>
<div id="flexContainer">
<div id="item1">1</div>
<div id="item2">2</div>
<div id="item3">3</div>
</div>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
cch from New Zealand - Oct 19, 2013:
Should Q40's answer:
-ms-flex-align: start
-ms-flex-pack: justify (but it's not available in the options)
Mary-Q40/110
QUESTION 914
You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater than 500.
Display the message Approved! If the PaymentAmount variable is less than 300.
Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater
than 300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note: it's not clear what the answer should be if amount ist exactly 300 or 500.
--------------------------------------------------------------------------------------------------------------------
Use the if statement to execute some code only if a specified condition is true.
Use the if....else statement to execute some code if a condition is true and another code if the condition is not
true.
if (condition)
{
code to be executed if condition is true
}
else
{
code to be executed if condition is not true
}
Use the if....else if...else statement to select one of several blocks of code to be executed.
if (condition1)
{
code to be executed if condition1 is true
}
else if (condition2)
{
code to be executed if condition2 is true
}
else
{
code to be executed if neither condition1 nor condition2 is true
}
http://www.w3schools.com/js/js_if_else.asp
Mary-Q41/111
QUESTION 915
You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page. The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page. How should you create the JavaScript
code? (Develop the solution by selecting the required code segments and arranging them in the correct order.
You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
The XMLHttpRequest object is used to exchange data with a server behind the scenes.
The following code fragment parses an XML document into an XML DOM object. To send a request to a
server, we use the open() and send() methods of the XMLHttpRequest object:
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "books.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
open(method, url, async) - Specifies the type of request, the URL, and if the request should be handled
asynchronously or not.
method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
send(string) - Sends the request off to the server.
string: Only used for POST requests
All modern browsers (IE7+, Firefox, Chrome, Safari, and Opera) have a built-in XMLHttpRequest object.
Syntax for creating an XMLHttpRequest object:
xmlhttp = new XMLHttpRequest();
Old versions of Internet Explorer (IE5 and IE6) use an ActiveX Object:
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
http://www.w3schools.com/xml/xml_http.asp
http://www.w3schools.com/xml/xml_dom.asp
<!DOCTYPE html>
<html>
<head>
<script>
function readXMLFile() {
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera,
Safari
xmlhttp = new XMLHttpRequest();
}
else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","note.xml",false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
document.getElementById("to").innerHTML =
xmlDoc.getElementsByTagName("to")[0].childNodes[0].nodeValue;
document.getElementById("from").innerHTML =
xmlDoc.getElementsByTagName("from")[0].childNodes[0].nodeValue;
document.getElementById("message").innerHTML =
xmlDoc.getElementsByTagName("body")[0].childNodes[0].nodeValue;
}
</script>
</head>
<body onload="readXMLFile()">
<h1>W3Schools Internal Note</h1>
<div>
<b>To:</b> <span id="to"></span><br>
<b>From:</b> <span id="from"></span><br>
<b>Message:</b> <span id="message"></span>
</div>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
-----
Mary-Comment: last big block is not needed?
Mary: Answer
dms from Brazil - Oct 15, 2013:
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","message.xml",false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXml
Mary-Q42/112
QUESTION 916
You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
The onfocus event occurs when an element gets focus. Onfocus is most often used with <input>, <select>,
and <a>.
Tip: The onfocus event is the opposite of the onblur event.
The onblur event occurs when an object loses focus. Onblur is most often used with form validation code (e.g.
when the user leaves a form field).
Tip: The onblur event is the opposite of the onfocus event.
http://www.w3schools.com/jsref/event_onfocus.asp
http://www.w3schools.com/jsref/event_onblur.asp
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function check1(currentTextBox) {
if (currentTextBox.value === null || currentTextBox.value === '')
currentTextBox.style.background = '#fffacd';
else
currentTextBox.style.background = '#ffffff';
}
function check2() {
var obj = document.getElementsByTagName('input');
for (var i = 0; i < (obj.length - 1); i++) {
obj[i].style.background = '#fffacd';
}
}
</script>
</head>
<body>
<input type="text" id="text1" onfocus="check1(this)" onblur="check1(this)" />
<input type="text" id="text2" onfocus="check1(this)" onblur="check1(this)" />
<input type="button" value="text" onclick="check2()" />
</body>
</html>
Mary-Q43/113
QUESTION 917
You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
The onerror event fires whenever an JavaScript error occurs (depending on your browser configuration, you
may see an error dialog pop up). The onerror event is attached to the window object, a rather unusual place to
take refuge in, but for good reason. It is attached this way so it can monitor all JavaScript errors on a page,
even those in the <head> section of the page.
http://www.javascriptkit.com/javatutors/error.shtml
Answers:
1. 23
2. Infinity
3. Unhandled exception
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
onerror = unhandled;
function unhandled() {
alert('There has been an unhandled exception');
}
function add() {
alert($("#int1").val() + $("#int2").val());
}
function divide() {
if (isNaN($("#int1").val()) || isNaN($("#int2").val())) {
throw('One or more values are non-numeric');
}
alert($("#int1").val() / $("#int2").val());
}
</script>
</head>
<body>
Integer 1: <input type="text" id="int1" /><br />
Integer 2: <input type="text" id="int2" /><br />
<input type="button" name="add" value="Add" onclick="add();" />
<input type="button" name="divide" value="Divide" onclick="divide();" />
</body>
</html>
-----------------------------------------------------------------------------------------------------------------------------------------------
equiman from Colombia - Nov 03, 2013:
Is bartered. Say that correct answer is No, No, Yes.
But correct asnwer is Yes, Yes, No
JackHuaberbauer from Germany - Nov 07, 2013:
Is indeed correctly answered with No, No, Yes. The reasons:
- val() returns string, so "2" + "3" gives "23"
- In Javascript a division by zero throws no error, but returns the value "infinity"
- To throw an error does not mean it is handled, there is no catch.
Check here: http://jsbin.com/aqepam/1/edit?html,output
Frits from Netherlands - Nov 20, 2013:
Q44, shouldn't the answer be true, true, false?
Mary-Q44/114
QUESTION 918
You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name. For each statement in the table, select
Yes if the code segment above causes the variable to evaluate as described. Select No if it does not. Make only
one selection in each row.
Hot Area:
Correct Answer:
Explanation/Reference:
A getter is a method that gets the value of a specific property. A setter is a method that sets the value of a
specific property. You can define getters and setters on any predefined core object or user-defined object that
supports the addition of new properties. The syntax for defining getters and setters uses the object literal
syntax.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/
Working_with_Objects#Defining_getters_and_setters
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function onStart() {
var customer = function() {
var name = "Contoso";
return {
getName: function() {
return name;
},
setName: function(newName) {
name = newName;
}
};
}();
alert(customer.name);
}
</script>
</head>
<body>
<button onclick="onStart()">Start</button>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------
H5 from Italy - Oct 22, 2013:
To submit a form javascript script must return true.
Mary-Q51/121
QUESTION 919
You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
Display a message if users select the first option element, and then submit the form.
Do not display an alert message if users select any other option element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The value attribute specifies the value of an <input> element.
The value attribute is used differently for different input types:
For "button", "reset", and "submit" - it defines the text on the button
For "text", "password", and "hidden" - it defines the initial (default) value of the input field
For "checkbox", "radio", "image" - it defines the value associated with the input (this is also the value that is
sent on submit)
Note: The value attribute is required with <input type="checkbox"> and <input type="radio">.
The focus() method is used to give focus to an element.
The clear property sets or returns the position of the element relative to floating objects.
Object.style.clear="none|left|right|both|inherit"
The return value of an event handler determines whether or not the default browser behaviour should take
place as well. In the case of clicking on links, this would be following the link, but the difference is most
noticeable in form submit handlers, where you can cancel a form submission if the user has made a mistake
entering the information.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function makeSelection(element, message) {
if (element.value === "Please Choose") {
alert(message);
element.focus();
return false;
} else {
return true;
}
}
</script>
</head>
<body>
<label for='city'>City:</label>
<select id='city'>
<option>Please Choose</option>
<option>Moscow</option>
<option>London</option>
<option>Paris</option>
</select>
<input type='button' id='submit' value='Submit'
onClick="makeSelection(document.getElementById('city'), 'Please Select a
City')"/>
</body>
</html>
http://www.w3schools.com/tags/att_input_value.asp
http://www.w3schools.com/jsref/met_html_focus.asp
http://www.w3schools.com/jsref/prop_style_clear.asp
http://stackoverflow.com/questions/128923/whats-the-effect-of-adding-return-false-to-an-onclick-event
---------------------------------------------------------------------------------------------------------------------------
BioK from Ireland - Nov 05, 2013:
Is wrong, should be
if (element.text === "Please Choose") {
instead of
if (element.value=== "Please Choose") {
fancy from Portugal - Nov 06, 2013:
Is correct, there is no "text" attribute for the option tag. You should use "value" as suggested.
BioK from Ireland - Nov 06, 2013:
The element.text is a valid property if we're talking about an <option> element. Please check this out
http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_option_text
BioK from Ireland - Nov 06, 2013:
@fancy, I've just tried writing and executing it, and you were right.
if (element.value=== "Please Choose") {
is the right answer. My mistake. Thanks
Mary-Q52/122
QUESTION 920
You develop a webpage. The layout of the webpage must resemble the following image:
You need to ensure that the page renders properly. How should you complete the relevant CSS styles? (To
answer, select the appropriate option from each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The float property specifies whether or not a box (an element) should float.
Note: Absolutely positioned elements ignores the float property!
The CSS float property is a very important property for layout. It allows you to position your web page designs
exactly as you want them to display - but in order to use it you have to understand how it works.
This tells the browser that everything with the class of "right" should be floated to the right. You would assign it
like this:
<img src="picture.jpg" class="right" />
You can't float every element on a web page. You can only float block-level elements. These are the elements
that take up a block of space on the page, like images (IMG), paragraphs (P), divisions (DIV), and lists (UL).
Other elements that affect text, but don't create a box on the page are called inline elements and can't be
floated. These are elements like span (SPAN), line breaks (BR), strong emphasis (STRONG), or italics (I).
The z-index property specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order.
Note: z-index only works on positioned elements (position:absolute, position:relative, or position:fixed).
The position property specifies the type of positioning method used for an element (static, relative, absolute or
fixed).
static - default. Elements render in order, as they appear in the document flow
absolute - the element is positioned relative to its first positioned (not static) ancestor element
fixed - the element is positioned relative to the browser window
relative - the element is positioned relative to its normal position, so "left:20" adds 20 pixels to the element's
LEFT position
inherit - the value of the position property is inherited from the parent element
http://webdesign.about.com/od/advancedcss/a/aa010107.htm
http://www.w3schools.com/cssref/pr_class_float.asp
http://www.w3schools.com/cssref/pr_pos_z-index.asp
http://www.w3schools.com/cssref/pr_class_position.asp
<!DOCTYPE html>
<html>
<head>
<style>
p {
width: 220px;
height: 250px;
border: 1px solid;
padding: 10px;
}
#span1 {
position: relative;
color: red;
}
#span2 {
position: absolute;
float: right;
top: 130px;
left: -100px;
height: 130px;
width: 130px;
color: green;
}
</style>
</head>
<body>
<p>Start of main contents.
<span id="span1">Start of span1 contents. <span id="span2">Span2 contents.</
span> End of span1 contents.</span>
End of main body contents.
</p>
</body>
</html>
-------------------------------------------------------------------------------------------------------------------------------------
Rourke from Croatia - Nov 05, 2013:
Closest answers, although not the same as the picture in question, are relative, relative.
Check out: ttp://jsbin.com/IVojeFeZ/1/
Mary-Q54/124
QUESTION 921
A company has an XML file named products.xml on a web server. The file contains a list of the products that
the company sells.
You need to display the contents of the products.xml file in a DIV element named Output.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The readyState property returns the (loading) status of the current document.
Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
status
100: Continue. This means that the server has received the request headers, and that the client should
proceed to send the request body (in the case of a request for which a body needs to be sent; for example,
a POST request). If the request body is large, sending it to a server when a request has already been
rejected based upon inappropriate headers is inefficient. To have a server check if the request could be
accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its
initial request and check if a 100 Continue status code is received in response before continuing (or receive
417 Expectation Failed and not continue).
200: Standard response for successful HTTP requests. The actual response will depend on the request
method used. In a GET request, the response will contain an entity corresponding to the requested
resource. In a POST request the response will contain an entity describing or containing the result of the
action.
300: Indicates multiple options for the resource that the client may follow. It, for instance, could be used to
present different format options for video, list files with different extensions, or word sense disambiguation.
400 Bad Request. The request cannot be fulfilled due to bad syntax.
http://www.w3schools.com/jsref/prop_doc_readystate.asp
http://www.w3schools.com/ajax/ajax_xmlhttprequest_onreadystatechange.asp
http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Mary-Q55/125
QUESTION 922
You are developing an application that analyzes population data for major cities in the United States.
The application retrieves population statistics for a city by using a web service.
You need to request data from the web service by using jQuery.
Which code segment should you use?
Correct Answer: D
Explanation/Reference:
jQuery.ajax( url [, settings ]) - Perform an asynchronous HTTP (Ajax) request.
settings - a set of key/value pairs that configure the Ajax request. All settings are optional.
async (default: true)
beforeSend - a pre-request callback function
cache (default: true, false for dataType 'script' and 'jsonp')
complete - a function to be called when the request finishes
contents - an object of string/regular-expression pairs that determine how jQuery will parse the response,
given its content type
contentType (default: 'application/x-www-form-urlencoded; charset=UTF-8'). When sending data to the
server, use this content type.
context - this object will be made the context of all Ajax-related callbacks.
converters (default: {"* text": window.String, "text html": true, "text json": jQuery.parseJSON, "text xml":
jQuery.parseXML}) - an object containing dataType-to-dataType converters.
crossDomain (default: false for same-domain requests, true for cross-domain requests) - if you wish to force
a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true.
data - data to be sent to the server. It is converted to a query string, if not already a string.
dataFilter - a function to be used to handle the raw response data of XMLHttpRequest
dataType (default: Intelligent Guess (xml, json, script, or html)) - the type of data that you're expecting back
from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response.
error - a function to be called if the request fails.
global (default: true) - whether to trigger global Ajax event handlers for this request.
headers (default: {}) - an object of additional header key/value pairs to send along with requests using the
XMLHttpRequest transport.
ifModified (default: false) - allow the request to be successful only if the response has changed since the last
request.
isLocal (default: depends on current location protocol) - allow the current environment to be recognized as
"local," (e.g. the filesystem), even if jQuery does not recognize it as such by default.
jsonp - override the callback function name in a jsonp request.
jsonpCallback - specify the callback function name for a JSONP request. This value will be used instead of
the random name automatically generated by jQuery.
mimeType - a mime type to override the XHR mime type
password - a password to be used with XMLHttpRequest in response to an HTTP access authentication
request.
processData (default: true) - by default, data passed in to the data option as an object (technically, anything
other than a string) will be processed and transformed into a query string, fitting to the default content-type
"application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data,
set this option to false.
scriptCharset - only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or
"script" dataType and "GET" type).
statusCode (default: {}) - an object of numeric HTTP codes and functions to be called when the response
has the corresponding code
success - a function to be called if the request succeeds. The function gets passed three arguments: The
data returned from the server, formatted according to the dataType parameter; a string describing the
status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object.
timeout - set a timeout (in milliseconds) for the request
traditional - set this to true if you wish to use the traditional style of param serialization
type (default: 'GET') - the type of request to make ("POST" or "GET"), default is "GET".
url (default: The current page) - a string containing the URL to which the request is sent.
username - a username to be used with XMLHttpRequest in response to an HTTP access authentication
request.
xhr (default: ActiveXObject when available (IE), the XMLHttpRequest otherwise) - callback for creating the
XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise.
xhrFields - an object of fieldName-fieldValue pairs to set on the native XHR object.
http://api.jquery.com/jQuery.ajax/
http://stackoverflow.com/questions/16099172/jquery-call-remote-web-service
Mary-Q56/126
QUESTION 923
You are developing a shared library to format information.
The library contains a method named _private. The _private method must never be called directly from outside
of the shared library.
You need to implement an API for the shared library.
How should you complete the relevant code? (Develop the solution by selecting the required code segments
and arranging them in the correct order. You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
A local variable can have the same name as a global variable, but it is entirely separate; changing the value of
one variable has no effect on the other. Only the local version has meaning inside the function in which it is
declared.
JavaScript processes all variable declarations before executing any code, whether the declaration is inside a
conditional block or other construct. Once JavaScript has found all the variables, it executes the code in the
function. If a variable is implicitly declared inside a function - that is, if it appears on the left side of an
assignment expression but has not been declared with var - it is created as a global variable.
An inner (nested) function stores references to the local variables that are present in the same scope as the
function itself, even after the function returns. This set of references is called a closure. In the following
example, the second call to the inner function outputs the same message ("Hello Bill") as the first call, because
the input parameter for the outer function, name, is a local variable that is stored in the closure for the inner
function.
The prototype property allows you to add properties and methods to an object.
http://www.w3schools.com/jsref/jsref_prototype_math.asp
http://www.w3schools.com/js/js_variables.asp
http://msdn.microsoft.com/en-us/library/ie/bzt2dkta%28v=vs.94%29.aspx
-----------------------------------------------------------------------------------------------------------
Mary: Answer
Fosna from Croatia - Oct 31, 2013:
What's the solution? Proposed solution throws
ReferenceError: Formatter is not defined. Check at: http://jsbin.com/ovuWeTu/2/edit
george from Canada - Nov 08, 2013:
Answer:
function getFormatter(){
var _private = fuction(data){
return custome(data);
};
this.parseValue = function(input){
return _private(input);
};
}
Mary-Q61/131
QUESTION 924
You develop a webpage by using HTML5. You create the following markup:
<input type="url" name="website" required="required" />
You need to ensure that the value that the user enters contains a secure URL.
What should you do?
A. Add the following attribute to the input tag: value="https://"
B. Add the following attribute to the input tag: pattern="https://.+"
C. Add the following attribute to the input tag: value="ssl"
D. Add the following attribute to the input tag: itemtype="https"
Correct Answer: B
Explanation/Reference:
The pattern attribute specifies a regular expression that the <input> element's value is checked against.
Note: The pattern attribute works with the following input types: text, search, url, tel, email, and password.
http://www.w3schools.com/tags/att_input_pattern.asp
Mary-Q63/133
QUESTION 925
You review a webpage that contains the following markup:
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each row.
Hot Area:
Correct Answer:
Explanation/Reference:
-ms-grid-columns property gets or sets one or more values that specify the width of each grid column within
the object.
-ms-grid-columns: [ auto | width | min-content | max-content | minmax(min, max) ]
+ | none
-ms-grid-rows property gets or sets one or more values that specify the height of each grid row within the
object.
-ms-grid-rows: [ auto | height | min-content | max-content | minmax(min, max) ] +
| none
auto - The width of a column is computed based on the widest child element in that column. This keyword is
equivalent to minmax(min-content, max-content).
width - The width of each column specified as one of the following values:
A length consisting of an integer number, followed by an absolute units designator ("cm", "mm", "in", "pt", or
"pc") or a relative units designator ("em", "ex", or "px").
A percentage of the object width.
A proportion of the remaining horizontal space (that is, the object width, less the combined widths of other
tracks), consisting of an integer number followed by a fractional designator ("fr"). For example, if "200px 1fr
2fr" is specified, the first column is allocated 200 pixels, and the second and third columns are allocated 1/3
and 2/3 of the remaining width, respectively.
min-content - The minimum width of any child elements is used as the width of the column.
max-content - The maximum width of any child elements is used as the width of the column.
minmax(min, max) - The width of the row is between min and max, as available space allows. The min and
max parameters can be any other value of the -ms-grid-columns property, except for auto.
none - Initial value. The object has no specified columns. Implicit, auto-sized columns will still be created
based on the grid position(s) of the child element(s).
This property also supports a repeating syntax. If there are a large number of columns that are the same or
exhibit a recurring pattern, a repeat syntax can be applied to define the columns in a more compact form.
-ms-grid-columns: 10px 250px 10px 250px 10px 250px 10px 250px 10px;
is equivalent to
-ms-grid-columns: 10px (250px 10px)[4];
-ms-grid-row property gets or sets a value that specifies in which row of the grid to place the object.
-ms-grid-row: <integer>
The row numbering system is a 1-based index, with 1 being the default. That is, row numbering does not begin
with zero.
-ms-grid-column property gets or sets a value that specifies in which column of the grid to place the object.
-ms-grid-column: <integer>
The column numbering system is a 1-based index, with 1 being the default. That is, column numbering does
not begin with zero.
-ms-grid-row-span property gets or sets a value that specifies the number of rows of the grid that the object
spans.
-ms-grid-column-span property gets or sets a value that specifies the number of columns of the grid that the
object spans.
A flexible length or <flex> is a dimension with the fr unit, which represents a fraction of the free space in the
grid container.
The distribution of free space occurs after all non-flexible sizing functions have reached their maximum. The
total size of such rows or columns is subtracted from the available space, yielding the free space, which is then
divided among the flex-sized rows and columns in proportion to their flex factor.
Flexible lengths in a track list work similarly to flexible lengths with a zero base size in [CSS3-FLEXBOX].
Each column or row's share of the free space can be computed as the column or row's <flex> * <free space> /
<sum of all flex factors>. For the purpose of this calculation, a flexible length in the min position of a minmax()
function is treated as 0 (an inflexible length).
The float property specifies whether or not a box (an element) should float.
img { float:right; }
http://msdn.microsoft.com/en-us/library/windows/apps/hh466340.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh466350.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh466346.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh466352.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/hh466342.aspx
http://www.w3.org/TR/css3-grid-layout/#fraction-values-fr
http://www.w3schools.com/cssref/pr_class_float.asp
Mary-Q68/138, Q77/147
QUESTION 926
You are creating an HTML5 application that allows users to play video on a page by using the VIDEO element.
You need to enable the user to start, stop, and pause the video.
Which line of code should you add to the page?
A. <video id="myVideo" height="320" width="400" src="myVideo.vtt"
contextmenu="pauseplay"> </video>
B. <video id="myVideo" heigh"="320" width="400" src="myVideo.vtt" controls> </
video>
C. <video id="myVideo" height="320" width="400" src="myVideo.vtt" autoplay> </
video>
D. <video id="myVideo" height="320" width="400" src="myVideo.vtt"
contextmenu="StartStop"> </video>
Correct Answer: B
Explanation/Reference:
The <video> tag specifies video, such as a movie clip or other video streams.
Currently, there are 3 supported video formats for the <video> element: MP4, WebM, and Ogg.
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
The controls attribute is a boolean attribute. When present, it specifies that video controls should be displayed.
Video controls should include:
Play
Pause
Seeking
Volume
Fullscreen toggle
Captions/Subtitles (when available)
Track (when available)
http://www.w3schools.com/tags/tag_video.asp
http://www.w3schools.com/tags/att_video_controls.asp
Mary-Q69/139
QUESTION 927
You develop an HTML5 webpage that contains the following HTML markup:
You have the following requirements:
Retrieve the content for any <option> elements when the value of the selected attribute equals selected.
Add the content to a comma separated string.
You need to retrieve the required data.
Which two code segments should you add to the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: CD
Explanation/Reference:
The multiple attribute is a boolean attribute. When present, it specifies that multiple options can be selected at
once.
Because of the different ways of doing this, and because you have to inform the user that multiple selection is
available, it is more user-friendly to use checkboxes instead.
http://www.w3schools.com/tags/att_select_multiple.asp
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script>
function onSubmit1() {
var selectedValues = "";
$("select option:selected").each(function() {
selectedValues += $(this).text() + ' , ';
});
alert("Selected Values: " + selectedValues);
}
function onSubmit2() {
var selectedValues = "";
$("#loanTypes option:selected").each(function() {
selectedValues += $(this).text() + ' , ';
});
alert("Selected Values: " + selectedValues);
}
</script>
</head>
<body>
<label for="loanTypes">Loan Types</label>
<select name="loanTypes" id="loanTypes" multiple="multiple">
<option>Secured</option>
<option selected="selected">Unsecured</option>
<option>Demand</option>
<option selected="selected">Subsidized</option>
</select>
<button onclick="onSubmit1()">Submit1</button>
<button onclick="onSubmit2()">Submit2</button>
</body>
</html>
---------------------------------------------------------------------------------------------------------------------------------
Mary&Sam: Answer B&D
Ed from Canada - Oct 22, 2013:
NewQuestions, Q71 is wrong. The answers in the dump are B & D. The correct answer should be C & D
podlodkin from Latvia - Nov 01, 2013:
C&D
Mary-Q71/141
QUESTION 928
You are creating a function by using JavaScript. You have the following requirements:
The function must display loan amounts to the user within the following HTML element:
<div id="display"></div>
The loan amount of 2100 must display in the HTML element. All declared variables and functions must be
scoped to the myApp variable.
You need to implement the function. How should you complete the relevant code? (To answer, drag the
appropriate code segments to the correct location or locations in the answer area. Use only code segments that
apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
The main difference is that apply lets you invoke the function with arguments as an array; call requires the
parameters be listed explicitly.
theFunction.apply(valueForThis, arrayOfArgs)
theFunction.call(valueForThis, arg1, arg2, ...)
http://msdn.microsoft.com/en-us/library/ie/4zc42wh1%28v=vs.94%29.aspx
http://msdn.microsoft.com/en-us/library/ie/h2ak8h2y%28v=vs.94%29.aspx
http://stackoverflow.com/questions/1986896/what-is-the-difference-between-call-and-apply
Mary-Q72/142
QUESTION 929
You implement a callback function by using JavaScript. You need to process the returned XML data.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
The call method is used to call a method on behalf of another object. It allows you to change the this object of a
function from the original context to the new object specified by thisObj.
If thisObj is not supplied, the global object is used as thisObj.
call([thisObj[, arg1[, arg2[, [, argN]]]]])
XMLHttpRequest Object Properties
onreadystatechange Stores a function (or the name of a function) to be called automatically each time the
readyState property changes
readyState Holds the status of the XMLHttpRequest. Changes from 0 to 4:
0: request not initialized
1: server connection established
2: request received
3: processing request
4: request finished and response is ready
responseText Returns the response data as a string
responseXML Returns the response data as XML data
status Returns the status-number (e.g. "404" for "Not Found" or "200" for "OK")
statusText Returns the status-text (e.g. "Not Found" or "OK")
http://msdn.microsoft.com/en-us/library/ie/h2ak8h2y%28v=vs.94%29.aspx
http://www.w3schools.com/dom/dom_http.asp
Mary-Q74/144
QUESTION 930
You develop an HTML5 application. You give users a numeric access code that can be used only one time.
Users must enter the numeric access code in the login form of the application.
The numeric characters must be hidden by a masking character.
You need to implement the form element for users to enter the code.
Which HTML element should you use?
A. <input type="password" required autocomplete="off">
B. <input type="input" autocomplete="off" required />
C. <input type="password" style="visibility:hidden;" required />
D. <input type="button" value="password" required />
Correct Answer: A
Explanation/Reference:
<input type="password"> defines a password field. The characters in a password field are masked (shown as
asterisks or circles).
The autocomplete attribute specifies whether or not an input field should have autocomplete enabled.
Autocomplete allows the browser to predict the value. When a user starts to type in a field, the browser should
display options to fill in the field, based on earlier typed values.
<input autocomplete="on | off">
http://www.w3schools.com/html/html_forms.asp
http://www.w3schools.com/tags/att_input_autocomplete.asp
Mary-Q75/145
QUESTION 931
You are developing a web page that includes the following HTML.
<span id="myTextSpan" class="redText">Hello There!</span>
The font color of text inside the span must be red. You need to develop the web page to meet the requirement.
Which two CSS segments will achieve the goal? (Each correct answer presents a complete solution. Choose
two.)
Correct Answer: AC
Explanation/Reference:
Mary-Q80/150
QUESTION 932
You develop an HTML5 webpage. You have the following HTML markup:
You need to change the background color for all of the elements whose name attribute ends with the word
name.
Which code segment should you add to the webpage?
A. $ ('#name').css({ 'background-color' : '#E0ECF8' });
B. $ ('input[name |="name";]').css({ 'background-color' : '#E0ECF8' });
C. $('input[name$="name"]').css({ 'background-color' : '#E0ECF8' });
D. $ ('*name').css({ 'background-color' : '#E0ECF8' }) ;
Correct Answer: C
Explanation/Reference:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
function onColor() {
$('input[name$="name"]').css({ 'background-color' : '#E0ECF8' })
}
</script>
</head>
<body>
<label for="personname">Given and Surname:</label>
<input type="text" name="personname" /><br />
<label for="businessname">Business Name:</label>
<input type="text" name="businessname" /><br />
<label for="emailaddress">Email Address:</label>
<input type="text" name="emailaddress" /><br />
<button onclick="onColor()">Color</button>
</body>
</html>
Mary-Q83/153
QUESTION 933
You are creating a custom object as described by the following code.
You need to implement the calcArea method. Which code should you use?
Correct Answer: D
Explanation/Reference:
http://www.digital-web.com/articles/scope_in_javascript/
Mary-Q88/158
QUESTION 934
You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location. Each
selector may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<style>
input:disabled {
background-color: #e0e0e0;
}
</style>
</head>
<body>
<input name="ITSupport" type="checkbox" id="IT" value="choc"
onclick="enable();" /><label for="IT">IT Support</label>
<input type="email" placeholder="IT@Contoso.com" id="eMail"
disabled " /><label for="eMail">Your eMail</label>
<script type="text/javascript">
function enable(e) {
if (document.getElementById('IT').checked) {
document.getElementById('eMail').disabled = false;
} else {
document.getElementById('eMail').disabled = true;
}
}
</script>
</body>
</html>
Mary-Q89/159
QUESTION 935
You are developing an HTML5 web form to collect feedback information from site visitors.
The web form must display an INPUT element that meets the following requirements:
Allow numeric values between 1 and 10.
Default to the value of 5.
Display as a slider control on the page.
You need to add the INPUT element to the form. Which HTML element should you add?
A. Rating (Between 1 and 10): <input type="number" name="rating" min ="1" max-"10">
B. Rating (Between 1 and 10): <input type="number" name="rating" min="1" max="10"
default="5">
C. Rating (Between 1 and 10): <input type="range" name="rating" min="0" max="10"
default"="5">
D. Rating (Between 1 and 10): <input type="range" name="rating" min="1" max="10"
value="5">
Correct Answer: D
Explanation/Reference:
The range type is used for input fields that should contain a value from a range of numbers.
You can also set restrictions on what numbers are accepted.
Define a control for entering a number whose exact value is not important (like a slider control):
<input type="range" name="points" min="1" max="10">
Use the following attributes to specify restrictions:
max - specifies the maximum value allowed
min - specifies the minimum value allowed
step - specifies the legal number intervals
value - Specifies the default value
http://www.w3schools.com/html/html5_form_input_types.asp
Mary-Q90/160
QUESTION 936
You develop an HTML5 application. The application uses an image that is returned from an HTTP POST
request.
You develop the following code: (Line numbers are included for reference only.)
You need to display the loaded image in the application. Which code segment should you insert at line 04?
Correct Answer: B
Explanation/Reference:
The XMLHttpRequest object is used to exchange data with a server behind the scenes.
The following code fragment parses an XML document into an XML DOM object. To send a request to a
server, we use the open() and send() methods of the XMLHttpRequest object:
xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET", "books.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
open(method, url, async) - Specifies the type of request, the URL, and if the request should be handled
asynchronously or not.
method: the type of request: GET or POST
url: the location of the file on the server
async: true (asynchronous) or false (synchronous)
send(string) - Sends the request off to the server.
string: Only used for POST requests
GET is simpler and faster than POST, and can be used in most cases. However, always use POST requests
when:
A cached file is not an option (update a file or database on the server)
Sending a large amount of data to the server (POST has no size limitations)
Sending user input (which can contain unknown characters), POST is more robust and secure than GET
To get the response from a server, use the response, responseText or responseXML property of the
XMLHttpRequest object.
response get the response data
responseText get the response data as a string
responseXML get the response data as XML data
responseType property describes the data type of the response associated with the request. One of the
following values:
arraybuffer - the response is an array buffer.
blob - the response is binary data.
document - the response is a document.
ms-stream - the response is part of a streaming download. This value is supported only for download
requests.
text - the response is text.
createObjectURL method creates a URL for the specified object.
var retval = URL.createObjectURL(object, oOptions);
http://www.w3schools.com/xml/xml_http.asp
http://www.w3schools.com/ajax/ajax_xmlhttprequest_response.asp
http://msdn.microsoft.com/en-us/library/windows/apps/hh871381.aspx
http://msdn.microsoft.com/en-us/library/ie/hh872881%28v=vs.85%29.aspx
http://msdn.microsoft.com/library/windows/apps/hh453196
Mary-Q91/161
QUESTION 937
You develop an HTML5 webpage that contains the following HTML markup:
<input id="loanTermTextBox" type="text" />
Users must enter a valid integer value into the text box. You need to validate the data type that is received from
the input element.
Which two code segments should you include on the webpage? (Each correct answer presents a complete
solution. Choose two.)
E.
Correct Answer: AB
Explanation/Reference:
The parseInt() function parses a string and returns an integer.
parseInt(string, radix)
The radix parameter is used to specify which numeral system to be used, for example, a radix of 16
(hexadecimal) indicates that the number in the string should be parsed from a hexadecimal number to a
decimal number.
If the radix parameter is omitted, JavaScript assumes the following:
If the string begins with "0x", the radix is 16 (hexadecimal)
If the string begins with "0", the radix is 8 (octal). This feature is deprecated
If the string begins with any other value, the radix is 10 (decimal)
Notes:
Only the first number in the string is returned!
Leading and trailing spaces are allowed.
If the first character cannot be converted to a number, parseInt() returns NaN.
Older browsers will use the octal radix (8) as default when the string begins with "0". As of ECMAScript 5,
the default is the decimal radix (10).
Older browsers will result parseInt("010") as 8, because older versions of ECMAScript, (older than
ECMAScript 5, uses the octal radix (8) as default when the string begins with "0". In ECMAScript 5, the
default is the decimal radix (10).
The parseFloat() function parses a string and returns a floating point number.
This function determines if the first character in the specified string is a number. If it is, it parses the string until
it reaches the end of the number, and returns the number as a number, not as a string.
Notes:
Only the first number in the string is returned!
Leading and trailing spaces are allowed.
If the first character cannot be converted to a number, parseFloat() returns NaN.
The isNaN() function determines whether a value is an illegal number (Not-a-Number).
This function returns true if the value is NaN, and false if not.
JSON.parse function converts a JavaScript Object Notation (JSON) string into an object.
var jsontext = '{"firstname":"Jesper","surname":"Aaberg","phone":["555-
0100","555-0120"]}';
var contact = JSON.parse(jsontext);
document.write(contact.surname + ", " + contact.firstname);
http://www.w3schools.com/jsref/jsref_parseint.asp
http://www.w3schools.com/jsref/jsref_parsefloat.asp
http://www.w3schools.com/jsref/jsref_isnan.asp
http://msdn.microsoft.com/en-us/library/ie/cc836466%28v=vs.94%29.aspx
Mary-Q92/162
QUESTION 938
You develop an HTML5 application for a company. Employees must enter a personal identification number
(PIN) in an INPUT element named SecurityCode to access their employee records.
The SecurityCode element must meet the following requirements:
Allow up to 6 digits.
Do not display numbers as they are entered.
Display the text Enter PIN Code before the user enters any data.
You need to implement the SecurityCode element.
Which HTML markup should you add to the application?
E.
Correct Answer: D
Explanation/Reference:
Input type password define a password field (characters are masked).
The maxlength attribute specifies the maximum number of characters allowed in the <input> element.
<input maxlength="number">
The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a
sample value or a short description of the expected format).
The short hint is displayed in the input field before the user enters a value.
<input placeholder="text">
Note: The placeholder attribute works with the following input types: text, search, url, tel, email, and password.
The pattern attribute specifies a regular expression that the <input> element's value is checked against.
<input pattern="regexp">
Note: The pattern attribute works with the following input types: text, search, url, tel, email, and password.
http://www.w3schools.com/tags/att_input_type.asp
http://www.w3schools.com/tags/att_input_maxlength.asp
http://www.w3schools.com/tags/att_input_placeholder.asp
http://www.w3schools.com/tags/att_input_pattern.asp
Mary-Q93/163
QUESTION 939
You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
mousemove | onmousemove event fires when the user moves the mouse over the object.
attachEvent Method object.attachEvent("onmousemove", handler)
addEventListener Method object.addEventListener("mousemove", handler, useCapture)
The clientX and clientY properties are exposed by the event object.
mouseover | onmouseover event fires when the user moves the mouse pointer into the object.
attachEvent Method object.attachEvent("onmouseover", handler)
addEventListener Method object.addEventListener("mouseover", handler, useCapture)
The event occurs when the user moves the mouse pointer into the object, and it does not repeat unless the
user moves the mouse pointer out of the object and then back into it.
The innerHTML property sets or returns the inner HTML of an element.
http://msdn.microsoft.com/en-us/library/ie/ms536947%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/ie/ms536949%28v=vs.85%29.aspx
http://www.w3schools.com/jsref/prop_html_innerhtml.asp
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="MapContents"></div>
<img src="http://www.w3schools.com/jsref/smiley.gif" alt="US Map" id="UsMap"/>
<script>
var contents = document.getElementById("MapContents");
var image = document.getElementById("UsMap");
image.addEventListener('mousemove', function(e) {
contents.innerHTML = "x: " + e.clientX + "<br />y: " + e.clientY;
});
</script>
</body>
</html>
Mary-Q94/164
QUESTION 940
You are creating a custom CSS3 style.
You have the following requirements to complete the style:
box1 has a red outline.
box1 contains box2, and box2 must remain inside box1
box2 must have a green to black gradient.
box2 must be surrounded by white space.
The style resembles the following diagram:
You need to add the CSS3 code to the styles. How should you complete the relevant code? (To answer, select
the appropriate code segment in each drop-down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
CSS3 gradients let you display smooth transitions between two or more specified colors.
Earlier, you had to use images for these effects. However, by using CSS3 gradients you can reduce download
time and bandwidth usage. In addition, elements with gradients look better when zoomed, because the gradient
is generated by the browser.
CSS3 defines two types of gradients:
Linear Gradients (goes down/up/left/right/diagonally)
Radial Gradients (defined by their center)
background: linear-gradient(direction, color-stop1, color-stop2, ...);
background: linear-gradient(angle, color-stop1, color-stop2);
background: radial-gradient(center, shape size, start-color, ..., last-color);
http://www.w3schools.com/css/css3_gradients.asp
<!DOCTYPE html>
<html>
<head>
<style>
.one
{
margin: 5em;
border: 1px #F00 solid;
}
.two
{
height:6em;
width:4em;
position: relative;
background: linear-gradient(to bottom, green, black);
margin: 10px 10px 10px 10px;
}
</style>
</head>
<body>
<div class="one">
<div class="two"/>
</div>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
----
Nilzor from Norway - Oct 28, 2013:
Error in the question. Having #box2 with absolute positioning does not produce the visual result as promised.
Proof: http://codepen.io/Nilzor/pen/tKxcC
abdelgabar from United States - Nov 11, 2013:
For the last option, shouldn't we use padding? because we want box2 inside of box1. The dump says margin.
Please if you know which is correct let me know.
Mary-Q95/165
QUESTION 941
You develop an application to host user-generated HTML and JavaScript content.
A common error handler in your application must process all unhandled errors.
You need to implement global error handling for the application. Which code segment should you use?
Correct Answer: A
Explanation/Reference:
error | onerror event fires when an error occurs during object loading.
Note that some/many error events do not trigger window.onerror, you have to listen for them specifically.
window.onerror = funcRef;
funcRef is a reference to a function. When the function returns true, this prevents the firing of the default event
handler. Function parameters:
Error message (string)
Url where error was raised (string)
Line number where error was raised (number)
http://msdn.microsoft.com/en-us/library/ie/cc197053%28v=vs.85%29.aspx
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onerror
Mary-Q96/166
QUESTION 942
You develop an HTML5 webpage. You have the following HTML markup:
You need to call the click event for the addOneltem button a determined number of times when the user clicks
the addBoxOfltems button.
Which code segment should you add to the webpage?
Correct Answer: D
Explanation/Reference:
The click event occurs when an element is clicked.
The click() method triggers the click event, or attaches a function to run when a click event occurs.
$("p").click(function(){
alert("The paragraph was clicked.");
});
The trigger() method triggers the specified event and the default behavior of an event (like form submission)
for the selected elements.
This method is similar to the triggerHandler() method, except that triggerHandler() does not trigger the default
behavior of the event.
The on() method attaches one or more event handlers for the selected elements and child elements.
Tip: To remove event handlers, use the off() method.
Tip: To attach an event that only runs once and then removes itself, use the one() method.
http://www.w3schools.com/jquery/event_click.asp
http://www.w3schools.com/jquery/event_trigger.asp
http://www.w3schools.com/jquery/event_on.asp
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
</head>
<body>
Total Products: <span id="products">0</span><br />
Total Boxes: <span id="boxes">0</span><br />
<input type="button" id="addOneItem" value="Add one item to the order" />
<input type="button" id="addBoxOfItems" value="Add a box to the order" />
<script>
var itemsPerBox = 3;
$('#addBoxOfItems').click(function(event){
for (var i = 0; i < itemsPerBox; i++) {
$('#addOneItem').trigger('click');
}
var value = parseInt($("#boxes")[0].innerHTML, 10);
$("#boxes")[0].innerHTML = value + 1;
});
$('#addOneItem').on("click", function(){
var value = parseInt($("#products")[0].innerHTML, 10);
$("#products")[0].innerHTML = value + 1;
});
</script>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------
podlodkin from Latvia - Nov 01, 2013:
D is correct - http://api.jquery.com/trigger/. B is not correct (string as parameters) - http://api.jquery.com/click/.
All agree?
Mary-Q98/168
QUESTION 943
You are validating user input by using built-in JavaScript functions.
The application must:
Store the value that is entered in a variable named inputValue
Use the built-in isNaN(tnputValue) function to evaluate the data type
You need to validate the return value of the isNaN(inputValue) function.
Which values will be returned? (To answer, configure the appropriate options in the dialog box in the answer
area.)
Hot Area:
Correct Answer:
Explanation/Reference:
hzl from Belgium - Oct 15, 2013:
isNaN(3*8); returns false
isNaN('5'); returns false
isNaN(-13); returns false
isNaN(24.3); returns false
H5 from Italy - Oct 17, 2013:
If u create a simple page with a textbox and a button with a js validation function that made the check you've
got:
isNaN(-13) = FALSE
isNaN(24.3) = FALSE
isNaN(3*8) = TRUE
isNaN('5') = TRUE
as reported from the answer.
H5 from Italy - Oct 20, 2013:
I'm totally agree with you, but here is my very simple code:
function validate() {
var userInput = document.getElementById("Country").value;
if (isNaN(userInput))
alert("TRUE: " + userInput + " is not a Number");
else
alert("FALSE: " + userInput + " is a Number");
}
<input id="Country" type="text" />
<input type="button" value="submit" onclick="validate()" />
if you'll insert '5' or 3*8 in textbox and then click submit you've got TRUE, FALSE with -13 and 24.3.
Sanju from Norway - Oct 20, 2013:
Yes Indeed. I tried your sample and it seems what you have mentioned is correct. When 3*8 is directly given to
alert box then it returns false. But when it is stored in a variable and later when that variable is sent to alert it
returns true.
And as per the requirement it seems the provided solution is correct.
As I finished my exam I don't really recollect what I had chosen. But if I had chosen all false then I believe it is
not correct then. I might have missed some or all marks in this question then.
equiman from Colombia - Nov 03, 2013:
The dump says that the last one is true. but all answers are false.
userInput = '5'
isNaN(userInput) resultin Chrome or in IE (10) is false, because they parse the inputValue automatically before
the value is evaluated with isNaN function.
Frank from Netherlands - Nov 05, 2013:
Q99 - False, False, False, False (you can try in chrome console)
maria from Norway - Nov 05, 2013:
Please dont confuse because if u test it directly in alert(isNan(3*8)) then u will get false but if u make one input
box and submit button .make one function and then call it then u will get correct answer , False,False,
True,True
Rourke from Croatia - Nov 05, 2013:
Q99 is tricky. You can't replicate scenario described in that question in web console.
Check out: http://jsbin.com/ayiyOyU/2/edit. Result is written in console.
Mary-Q99/169
QUESTION 944
You are developing an HTML5 web form to collect feedback information from site visitors.
The web form must display an INPUT element that meets the following requirements:
Allow numeric values between 1 and 10.
Default to the value of 5.
Display as a slider control on the page.
You need to add the INPUT element to the form.
Which HTML element should you add?
A. Rating (Between 1 and 10): <input type="number" name="rating" min ="1" max-"10">
B. Rating (Between 1 and 10): <input type="number" name="rating" min="1" max="10" default="5">
C. Rating (Between 1 and 10): <input type="range" name="rating" min="0" max="10" default"="5">
D. Rating (Between 1 and 10): <input type="range" name="rating" min="10" max="10" value="5">
Correct Answer: B
QUESTION 945
You are developing a JavaScript library.
You have the following requirements:
Custom exceptions must include an error message and custom error number.
These exceptions must be thrown when data validation errors occur.
Developers must call the library to easily catch the exception and identify the problem.
You develop the following code. (Line numbers are included for reference only.)
You need to complete the code to meet the requirements.
Which line of code should you insert at line 09?
A. throw new Validatior.Exception (123, "Day of week must be les3 than 7");
B. return new ValidationException(123, "Day of week must be less than 7");
C. throw ValidationException(123, "Day of week must be less than 7");
D. catch ValidationException(123, "Day of week: must be less than 7");
Correct Answer: A
QUESTION 946
You are developing a web application that retrieves data from a web service. The data being retrieved is a
custom binary datatype named bint. The data can also be represented in XML.
Two existing methods named parseXml() and parseBint() are defined on the page.
The application must:
Retrieve and parse data from the web service using binary format if possible
Retrieve and parse the data from the web service using XML when binary format is not possible
You need to develop the application to meet the requirements.
What should you do? (To answer, select the appropriate options from the drop-down lists in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 947
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and search for tickets.
You have the following requirements:
Users must be able to save information in the application about their favorite destination airport.
The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which lines of code should you use? (To answer, select the appropriate options from the drop- down lists in the
answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 948
An HTML page has a CANVAS element.
You need to draw a red rectangle on the CANVAS element dynamically. The rectangle should resemble the
following graphic.
How should you build the code segment? (To answer, drag the appropriate line of code to the correct location.
Each line of code may be used once, more than once, or not at all. You may need to drag the split bar between
panes or scroll to view content.)
Select and Place:
Correct Answer:
Explanation/Reference:
Reference:
http://www.w3schools.com/html/html5_canvas.asp
QUESTION 949
You are creating a function by using JavaScript. The function accepts an object as the parameter and returns a
string that identifies the data type of the object.
You have the following requirements:
The function must return "Number" if the object is a number.
The function must return "String" if the object is a string.
The function must return "Unknown" if the object is neither a number nor a string.
You need to implement the function to meet the requirements.
How should you build the code segment? (To answer, select the appropriate options from the drop-down lists in
the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 950
You are developing a website that has many web pages with hyperlinks to other sites.
You need to ensure that if a hyperlink contains an image, the linked web page opens in a new window.
Which jQuery code segment or segments should you use? (To answer, drag the appropriate line of code to the
correct location. Each line of code may be used once, more than once, or not at all. You may need to drag the
split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 951
You are developing an application for an online retailer. The company ships only to certain countries.
The application must:
Store a list of country codes in an array
Validate the country code of the shipping address against the countries array Include a Boolean value in the
array that indicates whether or not you can ship to the country
Display a list of countries that can be shipped to if the user inputs a code for a country that the retailer
cannot ship to
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or
segments from the list of code segments to the correct location or locations in the work area. Each code
segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 952
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets.
You have the following requirements:
Users must be able to save information in the application about their favorite destination airport.
The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements.
Which line or lines of code should you use? (To answer, drag the appropriate command or commands from the
list of commands to the correct location or locations in the work area. Each line of code may be used once,
more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 953
You develop an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript variable defined:
var languages = [];
You need to add statements to an existing JavaScript function to sort the list items.
Which four actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* getElementsByTagName
The getElementsByTagName() method accesses all elements with the specified tagname.
* Example:
// Get the list items and setup an array for sorting
var lis = ul.getElementsByTagName("LI");
var vals = [];
// Populate the array
for(var i = 0, l = lis.length; i < l; i++)
vals.push(lis[i].innerHTML);
// Sort it
vals.sort();
// Sometimes you gotta DESC
if(sortDescending)
vals.reverse();
// Change the list on the page
for(var i = 0, l = lis.length; i < l; i++)
lis[i].innerHTML = vals[i];
}
QUESTION 954
You create an HTML5 webpage. You have the following HTML markup:
You also have the following JavaScript code segment:
var jsonFruit = { "apples" : "12", "bananas" : "8", "watermelon" : "3" }
You need to add additional rows to the fruitTable element by processing the jsonFruit values in the order listed.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 955
You have the following code:
The web service returns a JSON object that contains two properties named Description and FileName.
The PersonImage object must meet the following requirements:
Create an object that represents an image that will be displayed. Set the image properties from the values that
are returned by the web service.
Expose the image as a property of the PersonImage object.
You need to insert code at line 13 to complete the implementation of the PersonImage object.
Which three actions should you perform in sequence to complete the implementation? (Develop the solution by
selecting the required code segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* Image Object
The Image object represents an embedded image.
For each <img> tag in an HTML document, an Image object is created.
Notice that images are not technically inserted into an HTML page, images are linked to HTML
pages. The <img> tag creates a holding space for the referenced image.
* Image Object Properties include
alt, Sets or returns the value of the alt attribute of an image
src, Sets or returns the value of the src attribute of an image
QUESTION 956
You develop an HTML messaging application that allows users to send messages. The messages can have an
optional file attachment that is identified by a filename.
You use the following function to send a message:
You need to send a message with a file attachment.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 957
You develop an HTML application that calls a web service to retrieve JSON data. The web service contains one
method named GetFullName that returns an Object named data. The data
object contains two properties named GivenName and Surname.
You need to load data from the web service to the webpage.
How should you complete the relevant code? (To answer, drag the appropriate code segment or code
segments to the correct location or locations in the answer area. Use only code segments
that apply.)
Select and Place:
Correct Answer:
QUESTION 958
A company asks you to create a function that displays loan amounts to their customers.
You must create the function by using JavaScript to meet the following requirements:
Display three different loan amounts to each customer.
Display loan amounts in order starting with the greatest amount and ending with the least amount.
You need to implement the function.
How should you complete the relevant code? (To answer, drag the appropriate command or commands to the
correct location or locations in the answer area. Use only commands that apply.)
Select and Place:
Correct Answer:
QUESTION 959
You are developing an application for a retail store. The application will be used on mobile devices to provide
real-time directions to the store.
You have the following requirements:
The application must find out a user's location.
As the user moves, the application must update the screen with the new location.
As the user moves, the application must display the user's speed.
You need to develop the application to meet the requirements.
Which code segment or segments should you use? (To answer, drag the appropriate code segment or
segments to the correct location in the work area. Each code segment may be used once, more than once, or
not at all. You may need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 960
You develop a webpage. You create the following HTML markup:
The layout of the webpage must contain three rows. The first row spans the entire width of the page and is
labeled #Top. The second row contains three columns. The first column is labeled #Left; the second column is
labeled #Main; and the right column is labeled #Right. The #Left and #Right columns are a fixed width. The
#Main column occupies the remaining available space. The third and final row spans the entire width of the
page and is labeled #Bottom.
The layout of the webpage must resemble the following image:
You need to create the CSS styles to implement the layout.
How should you complete the relevant styles? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 961
You are developing a web page.
The webpage must display a container. The container must display three colored rectangles near the top of the
container. The colored rectangles are, in order, green, red, and yellow. The rectangles are aligned horizontally
and evenly spaced across the width of the container.
The layout of the page must resemble the following image:
You need to ensure that the page renders properly.
How should you complete the relevant styles? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 962
You create the following JavaScript code:
You must complete the ShowCanWeAfford() function:
Display the message Denied! If the PaymentAmount variable is greater than 500.
Display the message Approved! If the PaymentAmount variable is less than 300.
Display the message Approved with caution! If the PaymentAmount variable is less than 500 and greater
than 300.
You need to add statements to the ShowCanWeAfford() JavaScript function to meet the requirements.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 963
You have a webpage that includes the following markup:
An XML file named message.xml resides on a web server. The structure of the file is as follows:
You are developing a code-based solution to parse the contents of the XML file and display the information on
the page.
The solution must work on both modern and older browsers.
You need to display the information from the XML file onto the page.
How should you create the JavaScript code? (Develop the solution by selecting the required code segments
and arranging them in the correct order. You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
Parse an XML Document
Example. The following code fragment parses an XML document into an XML DOM object:
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","books.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
QUESTION 964
You review a web form that contains the following markup and code:
You need to ascertain how the webpage responds when it loads and how it reacts to user actions.
For each statement in the table, select Yes if the code segment above causes the page to behave as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 965
You test a webpage that contains the following JavaScript code:
The webpage also contains the following markup:
You need to ascertain how the webpage responds when the user enters characters and then clicks the add and
divide buttons.
For each statement in the table, select Yes if the action causes the webpage to behave as described. Select No
if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 966
You troubleshoot a webpage that includes the following code segment:
You need to evaluate the value of the variable named customer.name.
For each statement in the table, select Yes if the code segment above causes the variable to evaluate as
described. Select No if it does not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 967
You develop an HTML5 webpage that contains the following markup and code:
You have the following requirements:
Display a message if users select the first OPTION element, and then submit the form.
Do not display an alert message if users select any other OPTION element, and then submit the form.
You need to implement the madeSelection() function.
How should you complete the relevant code? (To answer, select the appropriate code segment from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 968
You develop a webpage that consumes a web service. The web service provides currency exchange rates.
Visitors enter the currency type on the webpage and press the Submit button.
The web service returns the current exchange rate.
You need to ensure that the webpage always displays the most current information.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 969
You are developing a shared library to format information. The library contains a method named _private.
The _private method must never be called directly from outside of the shared library.
You need to implement an API for the shared library.
How should you complete the relevant code? (Develop the solution by selecting the required code segments
and arranging them in the correct order. You may not need all of the code segments.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* Here there is a basic example:
// our constructor
function Person(name, age){
this.name = name;
this.age = age;
};
// prototype assignment
Person.prototype = (function(){
// we have a scope for private stuff
// created once and not for every instance
function toString(){
return this.name + " is " + this.age;
};
// create the prototype and return them
return {
// never forget the constructor ...
constructor:Person,
// "magic" toString method
toString:function(){
// call private toString method
return toString.call(this);
}
};
})();
* Example:
You can simulate private methods like this:
function Restaurant() {
}
Restaurant.prototype = (function() {
var private_stuff = function() {
// Private code here
};
return {
constructor:Restaurant,
use_restroom:function() {
private_stuff();
}
};
})();
var r = new Restaurant();
// This will work:
r.use_restroom();
// This will cause an error:
r.private_stuff();
QUESTION 970
You develop an interactive scalable vector graphics (SVG) application. You write the following HTML markup
that makes a rectangle rotate:
You need to control the speed of the rotating rectangle.
How should you complete the relevant code? (To answer, select the appropriate option from each drop-down
list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
Note:
* What is SVG?
SVG stands for Scalable Vector Graphics
SVG is used to define vector-based graphics for the Web
SVG defines the graphics in XML format
SVG graphics do NOT lose any quality if they are zoomed or resized
Every element and every attribute in SVG files can be animated
SVG is a W3C recommendation
* Example:
<script>
/* CONSTANTS */
var initialTheta = 0; // The initial rotation angle, in degrees.
var thetaDelta = 0.3; // The amount to rotate the square every "delay" milliseconds, in degrees.
var delay = 10; // The delay between animation stills, in milliseconds. Affects animation
smoothness.
var angularLimit = 90; // The maximum number of degrees to rotate the square.
/*
Note that it will take the square (angularLimit/thetaDelta)*delay milliseconds to rotate an
angularLimit
number of degrees. For example, (90/0.3)*10 = 3000 ms (or 3 seconds) to rotate the square
90 degrees.
*/
/* GLOBALS */
var theSquare; // Will contain a reference to the square element, as well as other things.
var timer; // Contains the setInterval() object, used to stop the animation.
function init()
/*
Assumes that this function is called after the page loads.
*/
{
theSquare = document.getElementById("mySquare"); // Set this custom property after the
page loads.
theSquare.currentTheta = initialTheta; // The initial rotation angle to use when the animation
starts, stored in
timer = setInterval(doAnim, delay); // Call the doAnim() function every "delay" milliseconds
until "timer" is cleared.
}
function doAnim()
/*
This function is called by setInterval() every "delay" milliseconds.
*/
{
if (theSquare.currentTheta > angularLimit)
{
clearInterval(timer); // The square has rotated enough, instruct the browser to stop calling
the doAnim() function.
return; // No point in continuing; stop now.
}
theSquare.setAttribute("transform", "rotate(" + theSquare.currentTheta + ")"); // Rotate the
square by a small amount.
theSquare.currentTheta += thetaDelta; // Increase the angle that the square will be rotated to,
by a small amount.
}
</script>
</head>
QUESTION 971
You create a webpage that includes the following HTML markup: (Line numbers are included for reference
only.)
You need to ensure that a form cannot be submitted unless the INPUT element contains the word OK.
Which five actions should you perform in sequence? (To answer, move the appropriate actions from the list of
actions to the answer area and arrange them in the correct order.)
Select and Place:
Correct Answer:
QUESTION 972
You are implementing a web worker by using JavaScript and HTML5. The web worker processes a long-
running loop and returns the result to a webpage.
The web worker is defined on the webpage as follows:
You have the following requirements:
Evaluate the message value in the web worker.
Process the loop based on the iterations value that is passed from the webpage.
Return a value back to the webpage from the web worker.
You need to implement the web worker.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* The event object for a message event supports the following additional properties:
the data property contains the message,
the origin property retrieves the scheme, hostname and port of the document that invoked the
postMessage method,
the source property refers to the window object that contains the document that invoked the
postMessage method,
the lastEventId property returns the identifier of the last message.
QUESTION 973
How does the page render? For each statement in the table, select Yes if the behavior is described. Select No
if it is not. Make only one selection in each column.
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 974
You create a custom style by using CSS3.
A box with rounded corners must appear around text. The box must match the following illustration:
You need to add the CSS3 markup to your style.
How should you complete the relevant CSS styles? (To answer, select the appropriate option from each drop-
down list in the answer area.)
Hot Area:
Correct Answer:
Explanation/Reference:
QUESTION 975
You create an HTML5 application that includes JavaScript. The application performs several AJAX requests.
One AJAX request retrieves order information from a web service and then sends the information back to a
webpage within the application.
You must create a custom event. You have the following requirements:
The webpage must contain an HTML element named ordersListing that will receive the custom event
notification.
The event name must be ordersReceived.
The event must pass a custom value named orderCount.
The event must run a JavaScript method named showOrdersReceivedCount after the orders Listing HTML
element receives the event.
Do not allow other DOM elements to receive the event.
Allow the event to be cancelled.
Send the event into the event system.
You need to implement the custom event to notify specific DOM elements of the AJAX response.
Which three actions should you perform in sequence? (Develop the solution by selecting the required code
segments and arranging them in the correct order.)
Select and Place:
Correct Answer:
Explanation/Reference:
Note:
* From Scenario: Do not allow other DOM elements to receive the event.
So: bubbles: false
* From scenario: Allow the event to be cancelled.
So: cancellable: true
* From scenario:
The webpage must contain an HTML element named ordersListing that will receive the custom event
notification.
* Events which are designated as bubbling will initially proceed with the same event flow as non- bubbling
events. The event is dispatched to its target EventTarget and any event listeners found there are triggered.
Bubbling events will then trigger any additional event listeners found by following the EventTarget's parent chain
upward, checking for any event listeners registered on each successive EventTarget. This upward propagation
will continue up to and including the Document. EventListeners registered as capturers will not be triggered
during this phase. The chain of EventTargets from the event target to the top of the tree is determined before
the initial dispatch of the event. If modifications occur to the tree during event processing, event flow will
proceed based on the initial state of the tree.
* Ajax (an acronym for Asynchronous JavaScript and XML) is a group of interrelated web development
techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can
send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the
display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the
name, the use of XML is not required (JSON is often used instead), and the requests do not need to be
asynchronous.
QUESTION 976
You are developing a web page that includes the following HTML.
You need to ensure that the email element is enabled only if the user selects the IT Support check box.
Which CSS selectors should you use? (To answer, drag the appropriate selector to the correct location. Each
selector may be used once, more than once, or not at all. You may need to drag the split bar between panes or
scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 977
You develop an HTML5 webpage. You have the following HTML markup:
You need to update the content of the DIV element when the mouse hovers over an image and when the
mouse coordinates change.
How should you complete the relevant code? (To answer, drag the appropriate code segment to the correct
location or locations in the answer area. Use only code segments that apply.)
Select and Place:
Correct Answer:
QUESTION 978
You are developing an HTML5 web application that will display encyclopedia entries.
Each encyclopedia entry has an associated image that is referred to in the entry.
You need to display the image by using the correct semantic markup.
What should you do? (To answer, drag the appropriate HTML tag to the correct element. Each tag may be
used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view
content.)
Select and Place:
Correct Answer:
QUESTION 979
You are developing a form that captures a user's email address by using HTML5 and jQuery.
The form must capture the form elements as a string.
You need to implement this functionality.
How should you develop the form? (To answer, drag the appropriate code segment to the correct target or
targets in the answer area. Each code segment may be used once, more than once, or not at all. You may
need to drag the split bar between panes or scroll to view content.)
Select and Place:
Correct Answer:
QUESTION 980
You are developing a web page by using HTML5. You have the following requirements:
. An H1 element must be placed at the top left corner of the page.
. The size and location of the HI element must not change if additional elements are added to the page.
You need to position the Hi element on the page. Which CSS3 style should you use?
A. Option A
B. Option B
C. Option C
D. Option D
Correct Answer: A
QUESTION 981
You are developing an application that reads information from a file.
The application must:
. Execute a block of code if there is an error accessing the file
. Execute a second block of code whether or not there is an error accessing the file
You need to ensure that the error handling requirements are met. Which three statements should you
implement in sequence? (To answer, move the appropriate statements from the list of actions to the answer
area and arrange them in the correct order.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 982
You are developing an airline reservation website by using HTML5 and JavaScript. A page on the site allows
users to enter departure and destination airport information and to search for tickets. You have the following
requirements:
. Users must be able to save information in the application about their favorite destination airport.
. The airport information must be displayed in the destination text box whenever the user returns to the page.
You need to develop the site to meet the requirements. Which line or lines of code should you use? (To
answer, drag the appropriate command or commands from the list of commands to the correct location or
locations in the work area. Each line of code may be used once, more than once, or not at all. You may need to
drag the split bar between panes or scroll to view content.)
A.
Correct Answer: A
Explanation/Reference:
QUESTION 983
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 984
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A
QUESTION 985
You are developing a web form that includes the following code.
When a user selects the check box, an input text box must be added to the page dynamically.
You need to ensure that the text box is added.
Which function should you use?
Correct Answer: B
QUESTION 986
You are developing a web page. You create a grid layout by using the following CSS segment.
You have the following requirements:
. You must place content in the first column of the second row.
. The content must span two columns.
You need to ensure that the style of the grid meets the requirements.
Which CSS segment should you use?
Correct Answer: A