Ensurepass.com : Ensure you pass the IT Exams
2018 Aug Microsoft Official New Released 70-480
100% Free Download! 100% Pass Guaranteed!
Programming in HTML5 with JavaScript and CSS3
Question No: 121 HOTSPOT – (Topic 3)
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.)
Answer:
Explanation:
When readyState is 4 and status is 200, the response is ready:
Example xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 amp;amp; xmlhttp.status==200)
{
document.getElementById(quot;myDivquot;).innerHTML=xmlhttp.responseText;
}
}
Note:
* readyState == 4
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
* status==200 200: quot;OKquot;
404: Page not found
Question No: 122 HOTSPOT – (Topic 3)
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.
Answer:
Question No: 123 – (Topic 3)
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?
-
context.transform(90);
-
context.content.getRotation(90);
-
context.rotate(90);
-
context.content.rotate (90);
Answer: C
Explanation: The rotate() method rotates the current drawing.
Example
Rotate the rectangle 20 degrees:
JavaScript:
var c=document.getElementById(quot;myCanvasquot;); var ctx=c.getContext(quot;2dquot;); ctx.rotate(20*Math.PI/180); ctx.fillRect(50,20,100,50);
Reference: HTML canvas rotate() Method
Question No: 124 HOTSPOT – (Topic 3)
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.)
Answer:
Explanation:
-
-ms-flex-align
center: The flexbox item#39;s margin box is centered in the cross axis within the line.
-
-ms-flex-pack
The #39;flex-pack#39; property defines the flexibility of these packing spaces.
Question No: 125 HOTSPOT – (Topic 3)
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.)
Answer:
Explanation:
-
box-sizing
The box-sizing property is used to tell the browser what the sizing properties (width and height) should include.
Should they include the border-box or just the content-box which is the default value of the width and height properties.
-
border-radius
The border-radius property is a shorthand property for setting the four border-*-radius properties.
Example
Add rounded borders to a lt;divgt; element: div {
border: 2px solid; border-radius: 25px;
}
Question No: 126 DRAG DROP – (Topic 3)
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.)
Answer:
Explanation:
Box 1:
Box 2:
Box 3:
Box 4:
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 quot; is quot; this.age;
};
// create the prototype and return them return {
// never forget the constructor … constructor:Person,
// quot;magicquot; 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 No: 127 HOTSPOT – (Topic 3)
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.
Answer:
Question No: 128 HOTSPOT – (Topic 3)
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.)
Answer:
Explanation:
-
setData method (dataTransfer)
Specifies the data and its format for the current drag-and-drop operation.
-
getData method (dataTransfer)
Retrieves the specified formatted data from the current drag-and-drop operation.
Question No: 129 DRAG DROP – (Topic 3)
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.)
Answer:
Explanation:
* onreadystatechange
When a request to a server is sent, we want to perform some actions based on the response.
The onreadystatechange event is triggered every time the readyState changes. The readyState property holds the status of the XMLHttpRequest.
Example xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 amp;amp; xmlhttp.status==200)
{
document.getElementById(quot;myDivquot;).innerHTML=xmlhttp.responseText;
}
}
* Send a Request To a Server
To send a request to a server, we use the open() and send() methods of the XMLHttpRequest object:
xmlhttp.open(quot;GETquot;,quot;xmlhttp_info.txtquot;,true); xmlhttp.send();
Question No: 130 HOTSPOT – (Topic 3)
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.)
Answer:
Explanation:
-
position: relative
The element is positioned relative to its normal position, so quot;left:20quot; adds 20 pixels to the element#39;s LEFT position
-
position: absolute
The element is positioned relative to its first positioned (not static) ancestor element
100% Ensurepass Free Download!
–70-480 PDF
100% Ensurepass Free Guaranteed!
–70-480 DumpsEnsurePass ExamCollection Testking Lowest Price Guarantee Yes No No Up-to-Dated Yes No No Real Questions Yes No No Explanation Yes No No PDF VCE Yes No No Free VCE Simulator Yes No No Instant Download Yes No No