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
melisa1 [442]
3 years ago
12

1 Explain the process of how the memory works with theprocessor​

Computers and Technology
2 answers:
butalik [34]3 years ago
5 0

Answer:

As every processor works on same stages i.e. fetch , decode , execute.

Most of the computers executes ONE instruction at a time. But speed is very fast .

So let's move to memory

The fastest memory is cache (registers)

Then RAM , then hard disk.

Before an instruction can be executed, program instructions and data must be placed into memory from an input device or a secondary storage device .

Then

1)The control unit fetches (gets) the instruction from memory.

2)The control unit decodes the instruction (decides what it means) and directs that the necessary data be moved from memory to the arithmetic/logic unit. These first two steps together are called instruction time, or I-time.

3)The arithmetic/logic unit executes the arithmetic or logical instruction. That is, the ALU is given control and performs the actual operation on the data.

4)Thc arithmetic/logic unit stores the result of this operation in memory or in a register. Steps 3 and 4 together are called execution time, or E-time.

Explanation:

NISA [10]3 years ago
3 0
As every processor works on same stages i.e. fetch , decode , execute. The fastest memory is cache (registers)

Then RAM , then hard disk.

Before an instruction can be executed, program instructions and data must be placed into memory from an input device or a secondary storage device .
You might be interested in
What is autofill in a excel spreadsheet?
Digiron [165]
Autofill is to automaticlly put the information in a spreadsheet
5 0
3 years ago
# q7 - create function readFileFirstLast() to meet the conditions below
MAVERICK [17]

Answer:

See explaination

Explanation:

def readFileFirstLast(filename):

# doc string

''' Function accept the filename and opens the fle

and reads all lines and strips new line character and

stores first and last in a string and return that string'''

#eception handle if file not found

try:

#opening the file

f = open(filename)

#reading the first line and striping the ne line

string = f.readline().strip()

#iterating until last line

for line in f:

pass

#concate the last line after strip the new line character to the string

string = string + " " + line.strip()

#return the string

return string

except:

#if file not found

return "File not found"

#taking the file name from user

filename = input("Enter a file name: ")

#printing the doc string in function

print("\ndoc_sting: \n"+ readFileFirstLast.__doc__+"\n")

#printing the returned string by calling the readFileFirstLast()

print("output string :")

print(readFileFirstLast(filename))

3 0
3 years ago
Tin học đã làm thay đổi công tác văn phòng ngày nay như thế nào?
vlabodo [156]
Công nghệ đã thay đổi cách mọi người sử dụng để giao tiếp ở nơi làm việc hiện đại
6 0
3 years ago
Complete the method, longestWord(), below that takes in an array of Strings and returns the longest String in the array. Note: y
beks73 [17]

Answer:

I am writing a JAVA program.

public class StringMethod {

public static String longestWord(String []words) { //method that takes an array  "word" of strings and returns the longest string in the array word

    int pos = 0; // contains index of the longest word of array words

    int longest = words[0].length(); //initially holds the length of the 1st element of words array

    for(int i=1; i< words.length; i++) { // iterates through each word of the array until the end of array

        if(words[i].length() > longest) { // if the length of word at i-th index of words[] is greater than the length of the word that is contained in longest variable

            pos = i; // assigns the index of the longest array element to pos

            longest = words[i].length();    } } //assigns the word in words[] array with the longest length to longest variable

   return words[pos]; } // returns the longest string in the array    

public static void main(String[] args) { //start of main() function body

String[] animals = {"cat", "horse", "elephant", "bird"}; //creates a String type array named animals which has 4 elements/words

   String longest_word= longestWord(animals); //calls longestWord method to find the longest string in the array animals and assign that longest string to longest_word.

  System.out.println(longest_word); }} //displays the longest word in output

Explanation:

Suppose we have the array of these elements: "cat", "horse", "elephant", "bird" These are four words in the array. Now lets see how the method longestWord() works:

int pos = 0; This variable is initialized to 0.

int longest = words[0].length();

longest holds the length of element at 0th index of words[] array. length() method is used to return the length of the first element words[0] array.

As the first element of array is "cat" so length of cat is 3. Hence longest = 3

for(int i=1; i< words.length; i++)

The loop has a variable i which is initialized to 1. The loop checks if the value of i is less than length of words[] array. The length of words array is 4 as there are 4 elements i.e. cat, horse, elephant and bird in this array. So the condition evaluates to true because i<words.length i.e. 1<4. The body of the loop will execute now. The body of loop contains an if condition if(words[i].length() > longest) which checks if the length of element of array at i-th index is greater than length of the element that is stored in longest variable. As i=1 so word[i] is word[1] which is the second element of words[] array. The second element is horse.

words[i].length()  means the length of i-th element of words[] array. So this means words[1].length() i.e. the length of element of words[] at 1st index. The length of horse is 5. So the statement if(words[i].length() > longest) is true because longest=3 and words[1].length() = 5 and 5>3. So the statements of if condition will execute now.

pos = i; this variable pos is used to hold the index position of the longest element in array. So pos = 1 as longest element computed so far is "horse".

longest = words[i].length(); This statement then assigns the length of horse to longest. So now the value of longest = 5

At second iteration i is now 2.  Loop condition evaluates to true because i<words.length i.e. 2<4. If condition is also true as i=2 so word[i] is word[2] which is elephant.

words[i].length() now means words[2].length() i.e. the length of element of words[] at 2nd index. The length of elephant is 8. So the statement if(words[i].length() > longest) is true because longest=5 and words[2].length() = 8 and 8>5. So the statements of if condition will execute now.

pos = i; now becomes pos = 2 as longest element computed so far is "elephant".

longest = words[i].length();  This statement then assigns the length of horse to longest. So now the value of longest = 8

At third iteration i is now 3.  The loop again checks if the value of i is less than length of words[] array.The condition evaluates to true because i<words.length i.e. 3<4. The body of the loop will execute now.  if(words[i].length() > longest) checks if the length of element of array at i-th index is greater than length of the element that is stored in longest variable. As i=3 so word[i] is word[3] which is the fourth element of words[] array. The fourth element is bird.

words[i].length() now means words[3].length() i.e. the length of element of words[] at 3rd index. The length of bird is 4. So the statement if(words[i].length() > longest) is false because longest=8 and words[2].length() = 4 and 4<8. So the statements of if condition will not execute now.

At fourth iteration i is now 4.  The loop again checks if the value of i is less than length of words[] array.The condition evaluates to false because i==words.length i.e. 4=4. So the loop breaks.

 return words[pos]; statement returns the index position of longest word in words[] array. pos = 2 So the array element at 2nd index is basically the third element of array words[] i.e. elephant. So the longest string in the array is elephant.

8 0
3 years ago
Why is it a good idea to view your HTML code in more than one web browser
Mandarinka [93]

Because some features may not be available on some browsers. By viewing it on different browsers, we can see if there's any incompatibilities and fix them.

5 0
4 years ago
Other questions:
  • 100 students were asked to fill out a form with three survey questions, as follows: H: Honor Roll C: Club membership (Robotics C
    7·1 answer
  • Assume that someone dictates you a sequence of numbers and you need to write it down. For brevity, he dictates it as follows: fi
    14·1 answer
  • What were the technological innovations that allowed for the rapid expansion of the railroads?
    6·1 answer
  • Which type of address is used at the transport layer to identify the receiving application?
    14·1 answer
  • Type two statements.
    11·1 answer
  • The Analytics tracking code can collect which of the following? (select all answers that apply) (1)-Language the browser is set
    15·1 answer
  • According to the video, which tasks do Police Patrol Officers perform? Select all that apply.
    15·2 answers
  • WILL MARK BRAIN LIST!
    9·2 answers
  • Is it true that if the user log out the computer will turn off automatically​
    9·2 answers
  • I have a .NET 6 basic website that I built using Entity Framework as the database for updating pages. I am ready to deploy the s
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!