1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gogolik [260]
3 years ago
8

What is the value of the totalsString variable after the following code is executed? var totals = [141.95, 212.95, 411, 10.95];

totals[2] = 312.95; var totalsString = ""; for (var i = 0; i < totals.length; i++) { totalsString += totals[i] + "|"; }
Computers and Technology
1 answer:
Alex Ar [27]3 years ago
7 0
<h2>Answer:</h2>

141.95|212.95|312.95|10.95|

<h2>Explanation:</h2>

<em>Reformatting the code snippet and giving it line numbers;</em>

1.       var totals = [141.95, 212.95, 411, 10.95];

2.      totals[2] = 312.95;

3.      var totalsString = "";

4.      for (var i = 0; i < totals.length; i++) {

5.          totalsString += totals[i] + "|";

6.      }

Line 1 creates an array called totals with four elements.

     First element = totals[0] =141.95

     Second element = totals[1] = 212.95

     Third element = totals[2] = 411

     Fourth element = totals[3] = 10.95

Line 2 replaces the value of the third element <em>totals[2]</em> = 411 with 312.95.

     Therefore the array <em>totals = </em>[141.95, 212.95, 312.95, 10.95]

Line 3 creates an empty string called totalsString

Lines 4 - 6 create a for loop that cycles from i=0 to i<totals.length

       totals.length = 4 (which is the number of items in the array totals)

       This means that the loop cycles from i=0 to i<4

       During cycle 1 when i = 0, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[0] + "|"   //substitute the values

            totalsString = "" + 141.95 + "|"

            totalsString = 141.95|

       During cycle 2 when i = 1, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[1] + "|"   //substitute the values

            totalsString = "141.95|" + 212.95 + "|"

            totalsString = 141.95|212.95|

       During cycle 3 when i = 2, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[2] + "|"   //substitute the values

            totalsString = "141.95|212.95|" + 312.95 + "|"

            totalsString = 141.95|212.95|312.95|

       During cycle 4 when i = 3, the expression inside the for loop executes as follows;

            totalsString = totalsString + totals[3] + "|"   //substitute the values

            totalsString = "141.95|212.95|312.95|" + 10.95 + "|"

            totalsString = 141.95|212.95|312.95|10.95|

At the end of the execution, totalsString = 141.95|212.95|312.95|10.95|

You might be interested in
Assign a variable solveEquation with a function expression that has three parameters (x, y, and z) and returns the result of eva
Arada [10]

Answer:

def func1(x, y, z):

   return z*3*y - x

x= int(input("Enter x"))

y= int(input("Enter y"))

z= int(input("Enterz"))

solveEquation=func1(x, y, z)

print (solveEquation)

Explanation:

Please check the answer section.

6 0
2 years ago
Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an un
Paha777 [63]
<span>Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an unauthorized process to occur or by granting unauthorized access is known as: Malicious code
Malicious code is often created to steal some information from another user without they realizing it, such as address, credit card number, social security number, email password, etc.</span>
4 0
3 years ago
What is a correlation and how does it relate to inferential error?
riadik2000 [5.3K]
A correlation is a consistent relationship between two or more variables. It relates to our tendency to draw causation from mere correlation.
5 0
3 years ago
You have just performed a cpm analysis and have found that more than one path through the project network has zero slack values.
Alex787 [66]

Answer:

There are multiple critical paths

Explanation:

The critical path method (CPM), or critical path analysis (CPA), is an algorithm for scheduling a set of project activities. It is commonly used in conjunction with the program evaluation and review technique (PERT). A critical path is determined by identifying the longest stretch of dependent activities and measuring the time required to complete them from start to finish.

The essential technique for using CPM is to construct a model of the project that includes the following:

  •    A list of all activities required to complete the project (typically categorized within a work breakdown structure),
  •    The time (duration) that each activity will take to complete,
  •    The dependencies between the activities and,
  •    Logical end points such as milestones or deliverable items.      

Using these values, CPM calculates the longest path of planned activities to logical end points or to the end of the project, and the earliest and latest that each activity can start and finish without making the project longer. This process determines which activities are "critical" (i.e., on the longest path) and which have "total float" (i.e., can be delayed without making the project longer).

considering the above function of the cpm analysis because you have multiple path, there is tendency that more than path through the project network will have zero slack values.

5 0
2 years ago
List the three control problems associated with competingprocesses and briefly define each.
hjlf

Answer and explanation :

the three control problems associated with competing process are

  • MUTUAL EXCLUSION : We know that some resources are shareable and some are not shareable. which means only one process can access the resource at a time this type of resources are called critical resources this code can be access at only one process at a time. the other process if required to access should not be allowed
  • DEADLOCK: this hold the process without complete for example suppose there are two resources R1 and R2 and two process P1 and P2 and P1 use R1 and P2 use R2 but after some time when P1 needs R2 but R2 is not available as it is used by P2 so the all process will be on hold
  • STARVATION : when priorities are given to the process as high priorities and low priorities. And high priorities process always competing  then low priorities process have to wait for very long time this is called starvation
3 0
2 years ago
Other questions:
  • Select the correct answer.
    6·1 answer
  • When you make a pointer variable im C++, is star label a must?
    9·1 answer
  • ____ indicates the number of pixels that a computer uses to display the letters, numbers, graphics, and background on a screen.
    12·2 answers
  • Which of these is a subdirectory? <br> HTTPS <br> /FAQ <br> .org <br> WWW
    15·1 answer
  • Sales representatives want to capture custom feedback record details related to each Account. The sales reps want to accomplish
    12·1 answer
  • Fill in the blank: _________ is Google’s machine-learning artificial intelligence system that interprets people’s searches to fi
    9·1 answer
  • Is a pocket watch consider a computer
    15·1 answer
  • Identify similarities and differences of hibiscus leaves <br>​
    14·1 answer
  • How can a cell phone tower help people​
    11·2 answers
  • WILL MARK BRAINLIEST!!!!!!!!!!!
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!