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]
3 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]3 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
Which part of the cryosphere comes directly from the atmosphere?
marin [14]
The answer to this question is C.
4 0
3 years ago
Read 2 more answers
Abby has received a request for a data set of actual data for testing a new app that is being developed. She does not want the s
Andreas93 [3]

Q:

Abby has received a request for a data set of actual data for testing a new app that is being developed. She does not want the sensitive elements of the data to be exposed. What technology should she use?

A:

Masking

4 0
2 years ago
Using tracking code, google analytics can report on data from which systems?
soldier1979 [14.2K]
The correct answers are:
<span>E-commerce platformsMobile
Applications
Online point-of-sales systems
Source and explanation: https://goo.gl/guJKC9
</span>
6 0
3 years ago
10. Two technicians are discussing recycling specifications for refrigerant. Technician A says that refrigerant oil with 5,000 p
NARA [144]

Answer:

a

Explanation:

8 0
3 years ago
We use _____command to get data from the user? (python)
Genrish500 [490]

Answer:

INPUT

Explanation:

EXAMPLE PYTHON CODE

_______________________________________________________

INPUT CODE:

_______________________________________________________

foo = input('foo: ')#Have some text printed before the input field

bar = foo

print(bar)

_______________________________________________________

OUTPUT CODE:

_______________________________________________________

foo: Hello World!

Hello World!

>>> bar

'Hello World!'

>>>foo

'Hello World!'

5 0
3 years ago
Other questions:
  • Difference between implicit and explicit type casting
    7·2 answers
  • Which of the following best define grit
    13·1 answer
  • In order to do a binary search on an array Group of answer choices you must first do a sequential search to be sure the element
    5·1 answer
  • Write the definition of a class Clock. The class has no constructors and three instance variables. One is of type int called hou
    12·1 answer
  • When designing your navigation, your primary objective should be to include keywords for search engines.
    6·1 answer
  • What is virtualization?
    11·2 answers
  • What statement best describes entrepreneurship?
    7·2 answers
  • Write a Python program (rainfall.py) to collect data and calculate the average rainfall over a period of years. The program shou
    11·1 answer
  • Group of programs are software ​
    6·2 answers
  • Help me pls...
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!