Microsoft 70-480 Exam Practice Questions (P. 4)
- Full Access (270 questions)
- Six months of Premium Access
- Access to one million comments
- Seamless ChatGPT Integration
- Ability to download PDF files
- Anki Flashcard files for revision
- No Captcha & No AdSense
- Advanced Exam Configuration
Question #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?

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?

- AOption A
- BOption B
- COption C
- DOption D
Correct Answer:
D
* Object.prototype.constructor
Returns a reference to the Object function that created the instance's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name. The value is only read-only for primitive values such as 1, true and "test".
* The constructor property is created together with the function as a single property of func.prototype.
Reference: Object.prototype.constructor
D
* Object.prototype.constructor
Returns a reference to the Object function that created the instance's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name. The value is only read-only for primitive values such as 1, true and "test".
* The constructor property is created together with the function as a single property of func.prototype.
Reference: Object.prototype.constructor
send
light_mode
delete
Question #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?


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?

- AOption A
- BOption B
- COption C
- DOption D
Correct Answer:
B
We create a now div element with the textbox.
We then use appendChild() method appends this node as the last child the input node divname.
Reference: HTML DOM appendChild() Method
B
We create a now div element with the textbox.
We then use appendChild() method appends this node as the last child the input node divname.
Reference: HTML DOM appendChild() Method
send
light_mode
delete
Question #18
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.)
<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.)
- Adocument.getElementById("logo") .style.position = "relative";
- Bdocument.getElementByld("logo").Style.top = "5px";
- Cdocument.getElementById("logo").style.top = "-5px";
- Ddocument.getElementById("logo").style.position = "absolute";
Correct Answer:
AB
* 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;
}
Reference: CSS position Property; CSS top Property
http://www.w3schools.com/cssref/pr_class_position.asp
http://www.w3schools.com/cssref/pr_pos_top.asp
AB
* 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;
}
Reference: CSS position Property; CSS top Property
http://www.w3schools.com/cssref/pr_class_position.asp
http://www.w3schools.com/cssref/pr_pos_top.asp
send
light_mode
delete
Question #19
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?
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?
- Adocument.getElementById("validate").style.display = "inline";
- Bdocument.getElementById("validate").style.margin = "0";
- Cdocument.getElementById("validate").style.padding = "0";
- Ddocument.getElementSyId("validate").style.display = "block";
Correct Answer:
A
* display: value;
value: inline
Default value. Displays an element as an inline element (like <span>)
* Example
Display <p> elements as inline elements:
p.inline {
display: inline;
}
Reference: CSS display Property -
http://www.w3schools.com/cssref/pr_class_display.asp
A
* display: value;
value: inline
Default value. Displays an element as an inline element (like <span>)
* Example
Display <p> elements as inline elements:
p.inline {
display: inline;
}
Reference: CSS display Property -
http://www.w3schools.com/cssref/pr_class_display.asp
send
light_mode
delete
Question #20
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:

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:
* addEventListener
The addEventListener() method attaches an event handler to the specified element.
In context of a worker, both self and this refer to the global scope. The worker can either add an event listener for the message event, or it can define the onmessage handler to listen for any messages sent by the parent thread.
* postmessage
Pass a message to the worker.
* close()
Terminating Workers -
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();
Reference: HTML DOM addEventListener() Method; The Basics of Web Workers

* addEventListener
The addEventListener() method attaches an event handler to the specified element.
In context of a worker, both self and this refer to the global scope. The worker can either add an event listener for the message event, or it can define the onmessage handler to listen for any messages sent by the parent thread.
* postmessage
Pass a message to the worker.
* close()
Terminating Workers -
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();
Reference: HTML DOM addEventListener() Method; The Basics of Web Workers
send
light_mode
delete
All Pages