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
15. What type of presentation includes information created in a different Office application?
blondinia [14]
 the answer to the question is a Embedded ( I just learned this like a month ago so im pretty sure it right :))
4 0
3 years ago
What tool is used to find and organize files on a mac
Margaret [11]

Answer:

the tool is literally called <u><em>The Finder.</em></u>

Explanation:

hope this helps

4 0
2 years ago
Two electronics technicians are measuring electrical quantities in circuits. Technician A says that copper, glass, porcelain, an
OleMash [197]

The correct answer is A. Only technician B is correct because I don't believe carbon is form of resistors.


8 0
3 years ago
Read 2 more answers
What is a device that connects to the system unit and is controlled by the processor in the computer called !
Airida [17]
Most computers have three types of ports: serial, parallel, and USB. A serial port is a type of interface that connects a device to the system unit by transmitting data only one bit at a time. Serial ports usually connect devices that do not require fast data transmission rates, such as a mouse, keyboard, or modem.
4 0
3 years ago
Given that String[] str has been initialized, to get a copy of str[0] with all characters converted to upper case, use the follo
Strike441 [17]

Answer: str[0].toUpperCase();

Explanation:

str[0] is pointing to the first character of the entire string and the code str[0].toUpperCase() will convert the characters to upper case if they are in lowercase and will remain unchanged if they are already in upper case.

7 0
2 years ago
Other questions:
  • It is either snoming or below freezing
    10·1 answer
  • Which ipv6 header field is known as the priority field?
    10·2 answers
  • A lamp outside a front door comes on automatically when it is dark, and when someone stands on the doormat outside the front doo
    7·1 answer
  • For the Address Block 195.200.0.0/16 a. If you have 320 Customers that need 128 addresses/customer - will there be enough addres
    14·1 answer
  • Search engines use indexes created by web _________ to provide fast searches.
    7·1 answer
  • Where do players resurrect if they have been destroyed in a game?
    13·1 answer
  • What is LINUX?
    6·2 answers
  • The I/O modules take care of data movement between main memory and a particular device interface.A. TrueB. False
    9·1 answer
  • Risk taker positive or negative​
    8·1 answer
  • Give an example of what Artificial Intelligence application most popular is used on a daily basis.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!