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
Daniel [21]
2 years ago
15

Half of the integers stored in the array data are positive, and half are negative. Determine the

Computers and Technology
1 answer:
jonny [76]2 years ago
7 0

Answer:

Check the explanation

Explanation:

Below is the approx assembly code for above `for loop` :-

1). mov ecx, 0

2). loop_start :

3).    cmp ecx, ARRAY_LENGTH

4).    jge loop_end

5).    mv temp_a, array[ecx]

6).    cmp temp_a, 0

7).    branch on nge

8).        mv array[ecx], temp_a*2

9).   add ecx, 1

10).   jmp loop_start

11). loop_end :

Assumptions :-

*ARRAY_LENGTH is register with value 1000000

*temp_a is a register

Frequency of statements :-

1) will be executed one time

3) will be executed 1000000 times

4) will be executed 1000000 times

5) will be executed 1000000 times

6) will be executed 1000000 times

7) `nge` will be executed 1000000 times, branch will be executed 500000 times

8) will be executed 500000 times

9) will be executed 1000000 times

10) will be executed 1000000 times

Cost of statements :-

1) 10 ns

3) 10ns + 10ns + 10ns [for two register accesses and one cmp]

4) 10ns [for jge ]

5) 10ns + 100ns + 10ns [10ns for register access `ecx`, 100ns for memory access `array[ecx]`, 10ns for mv]

6) 10ns + 10ns [10ns for register_access `temp_a`, 10ns for mv]

7) 10ns for nge, 10ns for branch

8) 30ns + 110ns + 10ns

10ns + 10ns + 10ns for temp_a*2 [10ns for moving 2 into a register, 10ns for multiplication],

110ns for array[ecx],

10ns for mv

9) 10ns for add, 10ns for `ecx` register access

10) 10ns for jmp

Total time taken = sum of (frequency x cost) of all the statements

1) 10*1

3) 30 * 1000000

4) 10 * 1000000

5) 120 * 1000000

6) 20 * 1000000

7) (10 * 500000) + (10 * 1000000)

8) 150 * 500000

9) 20 * 1000000

10) 10 * 1000000

Sum up all the above costs, you will get the answer.

It will equate to 0.175 seconds

You might be interested in
Technological advances have made cyberbullying
Tamiku [17]

Answer:

ok

Explanation:

6 0
3 years ago
Please help!! I need this asap! thank you so much!! <3
ValentinkaMS [17]
I think it’s the last one
6 0
2 years ago
Can you prove that the bleu areas are the same please?
Nookie1986 [14]

\huge\color{darkred}{ \tt{NO!!}}

8 0
2 years ago
Read 2 more answers
Which law requires employers to provide safe working environments for their employees? A. Civil Rights Act B. Fair Labor Standar
xeze [42]

the answer is c, occupational safety and health act

7 0
3 years ago
The design strategy that starts with a global view of the entire problem and breaks the problem down into smaller, more manageab
In-s [12.5K]

Answer:

Top down design

Explanation:

Top-down design is an approach that is used to break down the problem into the smaller subpart so that it can be manageable into more clear form.

C programming is the example of a top-down approach while C++ is the example of the bottom-up approach.

The advantages of the top-down design approach are:

1) easy to manage

2) easy to find the error

3) easy to debug

4 0
2 years ago
Other questions:
  • A computer is defined by 4 specific criteri. Select all 4.*
    7·1 answer
  • In file hashing, a file is read by a special algorithm that uses the value of the bits in the file to compute a single number ca
    13·1 answer
  • ListenListen with ReadSpeakerAn administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on
    9·1 answer
  • Select the guidelines you should follow when creating a resume
    12·2 answers
  • What formula would you enter to add the values in cells b4, b5, and b6?
    10·1 answer
  • A user is trying to delete a file located on an ntfs volume on his windows 8 computer but is unable to do so. Why is this.
    5·1 answer
  • Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
    9·1 answer
  • What is 3x10? PLZZZZZ
    11·1 answer
  • If a person communicates indirectly and attaches little value to
    6·1 answer
  • Define a function that will return the length of a list
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!