Which of the following statements runs a function named newTimer every 3 seconds?

1)

Which of the following statements runs a function named newTimer every 3 seconds?

(1pts)

setTimeout(newTimer, 3);

setTimeout(newTimer, 3000);

setInterval(newTimer, 3);

setInterval(newTimer, 3000);

2)

Code example 7-1
1. var eventHandler = function(evt) {
2.     if (!evt) { evt = window.event; }
3.     if (evt.preventDefault) {
4.         evt.preventDefault();
5.     }
6.     else {
7.         evt.returnValue = false;
8.     }
9. };

(Refer to code example 7-1) Which line gets the event object for older versions of IE?

(1pts)

line 2

line 3

line 4

line 7

3)

Why might you want to preload images on a page that uses rollovers?

(1pts)

To prevent delays displaying the images when the swapped images are large.

To prevent delays displaying the images when the connection is slow.

To prevent delays when the page is being loaded.

All of the above.

A and B only.

4)

Code Example 7-3
The JavaScript::
1. var $ = function(id) {
2.      return document.getElementById(id);
3. };
4. var timer;
5. var counter = 10;
6. var updateCounter = function() {
7.      counter–;
8.      $(“counter”).firstChild.nodeValue = counter;
9.      if (counter <= 0)   {
10.         clearInterval(timer);
11.         document.getElementById(“counter”).innerHTML = “Blastoff!”;
12.     }
13. };
14. window.onload = function() {
15.     timer = setInterval ( updateCounter, 1000 );
16. };

The HTML:
<h3>Countdown: <span id=”counter”> 10 </span> </h2>

(Refer to Code Example 7-3) The timer in this code will update the counter

(1pts)

every 10 seconds

once, after a delay of 1000 milliseconds

immediately, when the page loads

every second for 10 times

5)

Code Example 7-2
JavaScript code for an Image Swap
1. var $ = function(id) {
2.     return document.getElementById(id);
3. };
4. window.onload = function() {
5.      var listNode = $(“image_list”);
6.      var captionNode = $(“caption”);
7.      var imageNode = $(“main_image”);
8.      var imageLinks = listNode.getElementsByTagName(“a”);
9.      var i, image, linkNode, link;
10.     for ( i = 0; i < imageLinks.length; i++ ) {
11.         linkNode = imageLinks[i];
12.         image = new Image();
13.         image.src = linkNode.getAttribute(“href”);
14.         linkNode.onclick = function(evt) {
15.             link = this;
16.             imageNode.src = link.getAttribute(“href”);
17.             captionNode.firstChild.nodeValue = link.getAttribute(“title”);
18.             if (!evt) { evt = window.event; }
19.             if (evt.preventDefault) { evt.preventDefault(); }
20.             else { evt.returnFalse = false; }
21.         };
22.     }
23.     imageLinks[0].focus();
24. };

(Refer to Code Example 7-2) What does the this keyword on line 15 refer to?

(1pts)

the image that’s currently being processed

the link that’s currently being processed

the link that the user clicked on

the array of link nodes

6)

The easiest way to create a timer that will repeat its function at intervals but will begin immediately is to

(1pts)

have the timer call an anonymous function

specify 0 milliseconds as the interval

call the function before you create the timer

create a one-time timer that runs when the page loads and then use an the interval timer after that

7)

Code Example 7-2
JavaScript code for an Image Swap
1. var $ = function(id) {
2.     return document.getElementById(id);
3. };
4. window.onload = function() {
5.      var listNode = $(“image_list”);
6.      var captionNode = $(“caption”);
7.      var imageNode = $(“main_image”);
8.      var imageLinks = listNode.getElementsByTagName(“a”);
9.      var i, image, linkNode, link;
10.     for ( i = 0; i < imageLinks.length; i++ ) {
11.         linkNode = imageLinks[i];
12.         image = new Image();
13.         image.src = linkNode.getAttribute(“href”);
14.         linkNode.onclick = function(evt) {
15.             link = this;
16.             imageNode.src = link.getAttribute(“href”);
17.             captionNode.firstChild.nodeValue = link.getAttribute(“title”);
18.             if (!evt) { evt = window.event; }
19.             if (evt.preventDefault) { evt.preventDefault(); }
20.             else { evt.returnFalse = false; }
21.         };
22.     }
23.     imageLinks[0].focus();
24. };

(Refer to Code Example 7-2) What would happen if lines 18 through 20 were omitted?

(1pts)

The code would only work in older versions of IE.

Clicking on a link would open a new browser window or tab and display the image specified by the href attribute of the link.

Nothing would happen when the user clicks on one of the links.

Clicking on a link would cause the caption, but not the larger image, associated with the link to be displayed.

8)

Code Example 7-3
The JavaScript::
1. var $ = function(id) {
2.      return document.getElementById(id);
3. };
4. var timer;
5. var counter = 10;
6. var updateCounter = function() {
7.      counter–;
8.      $(“counter”).firstChild.nodeValue = counter;
9.      if (counter <= 0)   {
10.         clearInterval(timer);
11.         document.getElementById(“counter”).innerHTML = “Blastoff!”;
12.     }
13. };
14. window.onload = function() {
15.     timer = setInterval ( updateCounter, 1000 );
16. };

The HTML:
<h3>Countdown: <span id=”counter”> 10 </span> </h2>

(Refer to Code Example 7-3) Which of the following statements about this code is true?

(1pts)

It creates a timer that displays a counter on the page that replaces the text “Countdown”.

It creates a timer that uses the setInterval() method to change the updateCounter value every 1000 milliseconds .

It creates a timer that counts down from 10 to 1 and displays “Blastoff!” in the span element when the counter variable reaches 0.

It will fail because a timer cannot count down.

9)

You need to provide cross-browser compatible code to cancel the default action of an event

(1pts)

so the event can be handled with a single event handler

to ensure that all browsers store the event object in the global window.event property

because older IE browsers weren’t completely DOM-compliant

to ensure that all browsers use the preventDefault() method

10)

The img elements for the thumbnails in the code that follows are coded within the <a> elements
<main>
<h1>Image Swap</h1>
<p>Click on an image to enlarge.</p>
<ul id=”image_list”>
<li><a href=”images/pic1.jpg” title=”dogs”>
<img src=”thumbnails/t1.jpg” alt=””></a></li>
<li><a href=”images/pic2.jpg” title=”cats”>
<img src=”thumbnails/t2.jpg” alt=””></a></li>
</ul>
<h2 id=”caption”>Animals</h2>
<p><img id=”main_image” src=”images/pic1.jpg” alt=””></p>

</main>

(1pts)

so the user can swap the main image by pressing Enter when a thumbnail has the focus

so the user can access the thumbnail links by pressing the Tab key

so the application is easy to use by the motor-impaired

all of the above

11)

Code Example 7-2
JavaScript code for an Image Swap
1. var $ = function(id) {
2.     return document.getElementById(id);
3. };
4. window.onload = function() {
5.      var listNode = $(“image_list”);
6.      var captionNode = $(“caption”);
7.      var imageNode = $(“main_image”);
8.      var imageLinks = listNode.getElementsByTagName(“a”);
9.      var i, image, linkNode, link;
10.     for ( i = 0; i < imageLinks.length; i++ ) {
11.         linkNode = imageLinks[i];
12.         image = new Image();
13.         image.src = linkNode.getAttribute(“href”);
14.         linkNode.onclick = function(evt) {
15.             link = this;
16.             imageNode.src = link.getAttribute(“href”);
17.             captionNode.firstChild.nodeValue = link.getAttribute(“title”);
18.             if (!evt) { evt = window.event; }
19.             if (evt.preventDefault) { evt.preventDefault(); }
20.             else { evt.returnFalse = false; }
21.         };
22.     }
23.     imageLinks[0].focus();
24. };

(Refer to Code Example 7-2) Which lines of code attach an event handler for the click event of each link?

(1pts)

line 8

lines 11 – 13

lines 14 – 17

line 14 – 21

12)

Which HTML element does NOT have a default action associated with the click event?

(1pts)

<input>

<button>

<img>

<a>

13)

Code example 7-1
1. var eventHandler = function(evt) {
2.     if (!evt) { evt = window.event; }
3.     if (evt.preventDefault) {
4.         evt.preventDefault();
5.     }
6.     else {
7.         evt.returnValue = false;
8.     }
9. };

(Refer to code example 7-1) This is cross-browser compatible code that cancels the default action for an event. What do lines 3 – 5 do?

(1pts)

They cancel the default action of the event for all modern browsers.

They check to see if an event has been triggered.

They cancel the default action of the event for older versions of IE.

They check to see if the page is DOM-compliant.

14)

Which of the following is NOT true about the event object that is created when an event occurs?

(1pts)

To cancel the default action of an event, you first need to create an event handler.

The event object contains information about the event that occurred.

The event object provides methods that let you control the behavior of the event.

The event object is always passed to function that handles the event.

15)

Which of the following statements runs a function named newTimer once after 3 seconds?

(1pts)

setTimeout(newTimer, 3);

setTimeout(newTimer, 3000);

setInterval(newTimer, 3);

setInterval(newTimer, 3000);

Expert Answer


1) setInterval(newTimer,3000);

setTimeout(function, milliseconds) executes a function, . . .

(Solved) : 16 Points Applying Floyd Algorithm Weighted Undirected Therefore Symmetrical Graph 5 Vert Q37220162 . . .

I. 16 points) In applying the Floyd Algorithm to a weighted undirected (therefore symmetrical) graph with 5 vertices, we have
Can you please explain what is going on? Thank you!

I. 16 points) In applying the Floyd Algorithm to a weighted undirected (therefore symmetrical) graph with 5 vertices, we have arrived at the following arrays D3) and P(3). 10 0 0 0 0 20 0 0 3 1 3 0 0 0 0 1 4 0 3 0 0 1 50 1 1 1 0 10 4 6 3 2 2 4 0 5 6 6 3 6 5 0 1 8 4 3 6 1 0 5 5 2 6 8 5 0 Compute the following values in the arrays D4) and P) C3) D[5113]-D13][5] minm(D P5113] P3]5 Assuming that P(5)- P), show how to find the shortest (minimum weight) path from v3 to v5- P 31151 CS) PC) 3 Show transcribed image text I. 16 points) In applying the Floyd Algorithm to a weighted undirected (therefore symmetrical) graph with 5 vertices, we have arrived at the following arrays D3) and P(3). 10 0 0 0 0 20 0 0 3 1 3 0 0 0 0 1 4 0 3 0 0 1 50 1 1 1 0 10 4 6 3 2 2 4 0 5 6 6 3 6 5 0 1 8 4 3 6 1 0 5 5 2 6 8 5 0 Compute the following values in the arrays D4) and P) C3) D[5113]-D13][5] minm(D P5113] P3]5 Assuming that P(5)- P), show how to find the shortest (minimum weight) path from v3 to v5- P 31151 CS) PC) 3

Expert Answer


Answer to I. 16 points) In applying the Floyd Algorithm to a weighted undirected (therefore symmetrical) graph with 5 vertices, we…

(Solved) : 10 Pts Convert 128125 Single Precision Floating Point Binary Representation Using Ieee 75 Q37267096 . . .

a. [10 pts] Convert 12.8125 into single precision floating point Binary representation using IEEE 754 standard. Write your an

a. [10 pts] Convert 12.8125 into single precision floating point Binary representation using IEEE 754 standard. Write your answer in both Binary and Hex formats. Show your work for partial credit. Show transcribed image text a. [10 pts] Convert 12.8125 into single precision floating point Binary representation using IEEE 754 standard. Write your answer in both Binary and Hex formats. Show your work for partial credit.

Expert Answer


Answer to a. [10 pts] Convert 12.8125 into single precision floating point Binary representation using IEEE 754 standard. Write yo…

(Solved) : Convert B Base 10 B 110101 Base 10 C 101010012base 10 D N Asl Tble Cver Aner O Answer Asc Q37240710 . . .

A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 0A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 01101000 01100001 01110100 01101001 E. While working on a computer the following phrase pops up. What is going on (hint use ASCII table)? 01010110 01101001 01110010 01110101 01110011 Show transcribed image text A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 01101000 01100001 01110100 01101001 E. While working on a computer the following phrase pops up. What is going on (hint use ASCII table)? 01010110 01101001 01110010 01110101 01110011

Expert Answer


Answer to A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 010…

(Solved) : Context Problem Development Software Controlling Industrial Press Sheets Metal Pressed Di Q37226436 . . .

software engineering
. The context of this problem is the development of software controlling an industrial press, where sheets of metal are pressDevelop a fault-tree to identify possible failures that can lead to the operator (or someone else) being caught in the press.. The context of this problem is the development of software controlling an industrial press, where sheets of metal are pressed into different shapes. An operator is responsible for inserting removing the press cycle, which consists of the press moving all the way down, and then up again. and sheets. The operator also starts the Since the press is highly safety-critical, different steps are taken to increase the safety of the operator. To make it impossible (or at least much more difficult) for the operator to start the press when still holding the sheet, there is a protective cover that must be in place in order for the press to operate, and the start button is placed some distance away from the press. The requirements on the press incl following concerns ude the 1. The press should never move if the protective cover is not closed. 2. If the protective cover is opened during the press cycle (i.e., when the press is moving), the cycle should be aborted, i.e., when it is closed again the press should return up also if it did not yet reach the bottom position. The system has the following sensors and actuators Sensor Description PC O PC C P U P M P B SB The protective cover is The The press reachest The press reaches middle position The Start button ive cover becomes closed sition s reaches bottom position ed Actuator Description PM Possible values Up, Down, Stop Press motor Develop a fault-tree to identify possible failures that can lead to the operator (or someone else) being caught in the press. Would you recommend additional requirements based on this analysis? Please list these. Show transcribed image text . The context of this problem is the development of software controlling an industrial press, where sheets of metal are pressed into different shapes. An operator is responsible for inserting removing the press cycle, which consists of the press moving all the way down, and then up again. and sheets. The operator also starts the Since the press is highly safety-critical, different steps are taken to increase the safety of the operator. To make it impossible (or at least much more difficult) for the operator to start the press when still holding the sheet, there is a protective cover that must be in place in order for the press to operate, and the start button is placed some distance away from the press. The requirements on the press incl following concerns ude the 1. The press should never move if the protective cover is not closed. 2. If the protective cover is opened during the press cycle (i.e., when the press is moving), the cycle should be aborted, i.e., when it is closed again the press should return up also if it did not yet reach the bottom position. The system has the following sensors and actuators Sensor Description PC O PC C P U P M P B SB The protective cover is The The press reachest The press reaches middle position The Start button ive cover becomes closed sition s reaches bottom position ed Actuator Description PM Possible values Up, Down, Stop Press motor
Develop a fault-tree to identify possible failures that can lead to the operator (or someone else) being caught in the press. Would you recommend additional requirements based on this analysis? Please list these.

Expert Answer


Answer to . The context of this problem is the development of software controlling an industrial press, where sheets of metal are …

(Solved) : Create Class Call Collegecourse Add Field Department Course Number Section Number Maximum Q37227063 . . .

. Create a class call CollegeCourse Add a field for department, course number, section number, maximum number of students (ca

. Create a class call CollegeCourse Add a field for department, course number, section number, maximum number of students (capacity) Add a constructor that accepts and sets these 4 properties. Set the value for department with all uppercase characters . . Add getDepartment, getSectionNum, getCanacity methods Override the toString method to represent the course in this format “CISC181-12” where “CTSC” is the department, 181 is the course number and 12 is the section number. Override the equals method to return true if the courses department, course number and section number are equal Modify your CollegeCourse to implement the Comparable Interface All classes that implement the Comparable interface must override the sempareTe method that is provided in all Object classes. See Textbook Example 15.11 for how to define the Define the camparele method by first comparing the department, then the course multiple properties. number and lastly the section number. Download ‘CollegeCourseTest.java’ and put it in your Test folder. Test your CollegeCourse class. Your class should pass all the tests without changing anything in the test file. Show transcribed image text . Create a class call CollegeCourse Add a field for department, course number, section number, maximum number of students (capacity) Add a constructor that accepts and sets these 4 properties. Set the value for department with all uppercase characters . . Add getDepartment, getSectionNum, getCanacity methods Override the toString method to represent the course in this format “CISC181-12” where “CTSC” is the department, 181 is the course number and 12 is the section number. Override the equals method to return true if the courses department, course number and section number are equal Modify your CollegeCourse to implement the Comparable Interface All classes that implement the Comparable interface must override the sempareTe method that is provided in all Object classes. See Textbook Example 15.11 for how to define the Define the camparele method by first comparing the department, then the course multiple properties. number and lastly the section number. Download ‘CollegeCourseTest.java’ and put it in your Test folder. Test your CollegeCourse class. Your class should pass all the tests without changing anything in the test file.

Expert Answer


Answer to . Create a class call CollegeCourse Add a field for department, course number, section number, maximum number of student…

(Solved) : Consider Single Cpu System Active Process Explain Happens Following Circumstances Includ Q37236894 . . .

I. Consider a single CPU system with an active process A.Explain what happens in the following circumstances including anyinterrupts, system calls, etc.. and how they are handled until aprocess is back to running again (4.5 points)

a) The user presses control-C causing an interrupt to theprocess

b) A process executes continuously until it exhausts itsscheduler allocated time slice

c) A process does a read operation from an open file

Expert Answer


Answer to I. Consider a single CPU system with an active process A. Explain what happens in the following circumstances including …

(Solved) : Consider Surface Defined Z 4×2 Y2 Draw Traces Slices K Planes Y B Sketch Surface K Plane Q37296096 . . .

* . Consider the surface defined by z-4x2 + Ỉy2. a. Draw traces (or slices) in the k planes and the y b. Sketch the surface.

* . Consider the surface defined by z-4×2 + Ỉy2. a. Draw traces (or slices) in the k planes and the y b. Sketch the surface. k planes. Show transcribed image text * . Consider the surface defined by z-4×2 + Ỉy2. a. Draw traces (or slices) in the k planes and the y b. Sketch the surface. k planes.

Expert Answer


Answer to * . Consider the surface defined by z-4×2 + Ỉy2. a. Draw traces (or slices) in the k planes and the y b. Sketch the su…

(Solved) : Convert B Base 10 B 110101 Base 10 C 101010012base 10 D N Asl Tble Cver Aner O Answer Asc Q37240061 . . .

A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 0A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 01101000 01100001 01110100 01101001 E. While working on a computer the following phrase pops up. What is going on (hint use ASCII table)? 01010110 01101001 01110010 01110101 01110011 Show transcribed image text A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 01010111 01101000 01100001 01110100 01101001 E. While working on a computer the following phrase pops up. What is going on (hint use ASCII table)? 01010110 01101001 01110010 01110101 01110011

Expert Answer


Answer to A. Convert A B to base 10 B. 110101,→ base 10 C. 101010012base 10 D n am ASl tble cver and aner o answer in ASCII. 010…

App

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Contact

info@coursedeep.com

+91 8634554387