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
What is the amount of money you still owe to their credit card company called?
Colt1911 [192]
It mean that you are in dept

6 0
4 years ago
Read 2 more answers
Use the Crop tool on an image to
kenny6666 [7]

This tool is often used to remove borders, or to eliminate unwanted areas to provide you with a more focused working area.

B. to remove unwanted areas to the image

6 0
4 years ago
Read 2 more answers
Reply emailing a student who is asking about audio materials​
Sergeeva-Olga [200]

Answer:

The student because you are replying to the student.

Explanation:

4 0
3 years ago
Read 2 more answers
Complete the sentence describing computer languages.
kari74 [83]

Answer:

A low level language uses zeros and ones.

Explanation:

7 0
4 years ago
What does the image depict:
aleksley [76]

Answer:

b

Explanation:

i guess

5 0
3 years ago
Read 2 more answers
Other questions:
  • What are advanced topics in programming
    15·1 answer
  • There are a number of classifications that can be applied to security controls.
    11·1 answer
  • What tool do you use to secure remote access by users who utilize the internet??
    7·1 answer
  • Find all three-digit numbers with non-zero first digit that are equal to the sum of the cubes of their digits.
    8·1 answer
  • The operating system provides a ____, which is the means with which you interact with the computer
    5·1 answer
  • If a large organization wants software that will benefit the entire organization—what's known as enterprise application software
    7·1 answer
  • A computer that supports LoJack technology must have two main components installed. It needs an Application Agent (residing in t
    13·1 answer
  • Focusing on a target market makes it harder to develop products and services that specific groups of customers want.
    10·1 answer
  • Complete the code to convert a float to a string. <br> answer=5.3 <br> strAnswer=__ (answer)
    12·2 answers
  • Each contestant auditioned her singing voice for the pageant. Participle: Word it Modifies:​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!