You are developing an HTML5 page that has an element with an ID of logo. The page includes the following HTML.
Logo:
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.)
Answer : A, B
* style.position = 'relative';
The element is positioned relative to its normal position, so 'left:20' adds 20 pixels to the element's LEFT position.
* For relatively positioned elements, the top property sets the top edge of an element to a unit above/below its normal position.
Example: Example
Set the top edge of the image to 5px below the top edge of its normal position:
img {
position: relative;
top: 5px;
}
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?
Answer : C
* The event handler here normalizes event object (passed as a first argument) and invokes handleCellClick in a proper context (i.e. referring to an element that was attached event listener to). The element is the button elButton.
* addEventListener
Syntax: element.addEventListener(event, function, useCapture)
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?
Answer : C
JSON.stringify converts a JavaScript value to a JavaScript Object Notation (JSON) string.
NOTE: This question is a part of series of questions that presents the same scenario. Each question in the series contains unique solution that might meet the started goals. Some questions sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section. you will not be able to return to it. As a result, these questions will not appear in the review screen.
You have the following HTML5 and CSS3 markup within a webpage.
You need to set the background color of the Home link to yellow. The solution can affect the color of the other elements.
Solution: You use the following style:
Does this meet the goal?
Answer : A
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?
Answer : C
The string pattern '*name' matches all strings that ends with name.
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.)
Answer : B, C
* The Object.prototype property represents the Object prototype object.
* Object.prototype.constructor
Specifies the function that creates an object's prototype.
* Example:
Employee.prototype = new Person();
var Customer = function(name) {
this.name = name;
};
Customer.prototype = new Person();
var Mime = function(name) {
this.name = name;
this.canTalk = false;
};
Mime.prototype = new Person();
You are developing an application that consumes an external web service. The web service 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.
The application has two JavaScript variables named newStockRate and stockRate to store the latest and previous stock rates, respectively.
Users must be able to compare the old stock rate with the new stock rate.
You need to ensure that newStockRate and stockRate retain their values for comparison.
Which code segment should you use?
Answer : C