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
The procedure by which a process's state is saved before being swapped out of the cpu, then us restored to the state when the pr
belka [17]

The procedure is known as<u> context switching</u>.

In the field of computers, context switching can be described as a procedure in which a process is stored so that it can be executed at a later point. Such a procedure allows multitasking operations easier. A simple CPU can be utilized for multiple processes.

After a task is done, it can be swapped out of the CPU and can be restored later. By using context switching, more space can be provided on a CPU as freeing from one process will make space for the other.

When switching a process, the status of the older running process is saved on the CPU as registers.

Context switch makes it feasible to share one CPU for multiple procedures hence reducing the concerns that arise from using additional processors.

To learn more about context switch, click here,

brainly.com/question/21685677

#SPJ4

3 0
2 years ago
How to learn python ?
laila [671]

Answer:

https://www.python.org/about/gettingstarted/

Explanation:

its a site i used

7 0
3 years ago
Only numbers should go in the columns for Payload Size and Packet Size. The sizes are in bytes. Don't forget to account for the
Anna11 [10]

Answer:

Non-Payload Bytes sent are 1476(total) - 393 (payload) = 1083 bytes

1083 (non-payload) out of 1476(total) is 73.37 %

Non-Hello bytes sent are 1476(total) - 53(hello payload) = 1425 bytes

1425(non-hello) out of 1476(total) is 96.54 %

7 0
3 years ago
The kitchen in any café is a noisy place. To make sure the orders which you have carefully written down on your notepad make it
Levart [38]

Answer:

file_name = 'orders.txt'

file_obj = open( file_name, 'r' )

lines = file_obj.read()

print(lines.upper(), end = '')

Explanation:

  • Define the name of the file .
  • Use the built-in open function to open the file in read mode .
  • Use the built-in read function to read the file and assign this to lines variable.
  • Finally display the lines by converting them to capital alphabets by using the built-in upper() function.
5 0
3 years ago
B. START: What new information, strategies, or techniques have you learned that will increase your technology skills? Explain wh
Komok [63]

It is important to star typeing rather than know how to have all the little secrets.

7 0
3 years ago
Other questions:
  • The likelihood of the occurrence of a vulnerability multiplied by the value of the information asset - the percentage of risk mi
    12·1 answer
  • A customer struggles with the small print of most smartphones. The customer still likes the idea of using a smartphone for phone
    9·2 answers
  • ​ If a class is reusable, that is to say that it can be used in several different applications, then it has been designed using
    5·1 answer
  • A(n ____ is a named group of formatting characteristics.
    7·1 answer
  • Working at a ski resort in the mountains has its own unique security issues. Kenny is the chief information officer for Sundance
    10·1 answer
  • A(n) ______ network is a system that attempts to imitate the behavior of the human brain. Group of answer choices advanced neura
    14·1 answer
  • Describe markings on a road that indicate that it is safe to pass.
    10·1 answer
  • Students who finish their homework after school are meeting a. intrapersonal and short-term goals b. normative and short-term go
    13·2 answers
  • Which of the following will print I'VE GOT THIS on the screen? (5 points)
    14·1 answer
  • Adding Page Numbers in the Footer
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!