Question

A program may be written in a language that is compiled to ‘native’ binary (to the...

A program may be written in a language that is compiled to ‘native’ binary (to the instruction opcodes the actual CPU knows how to do), or it may be interpreted (translated to native binary statement by statement as the program runs.) Suppose part of a program initializes a 500,000 element array to all 0 (i.e., each of 500,000 elements is set to 0). A compiled version performs this action in 0.001 seconds; an interpreted version takes 0.416 seconds. Why is the compiled version so much faster?

Please show explanation and/or work as necessary. Thank you!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Why is compiled version so much faster?

Answer:

Compiler generates the object file before being saved an executable file.
it can be directly executed after linking.
Interpreter program is saved in the same format that you write.
while running the code its executes line by line.

That's why compiled version takes very short time in comparison to interpreted version.

Add a comment
Know the answer?
Add Answer to:
A program may be written in a language that is compiled to ‘native’ binary (to the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please write this computer platform questions ( OS and Network) Suppose you have a hard disk...

    Please write this computer platform questions ( OS and Network) Suppose you have a hard disk with 2400 tracks per surface, each track divided into 120 sectors, eight platters and a block size of 512 bytes (i.e., ½ kilobyte), what is the total raw capacity of the disk drive? A program may be written in a language that is compiled to ‘native’ binary (to the instruction opcodes the actual CPU knows how to do), or it may be interpreted (translated...

  • A C program has been compiled into the Atmel AVR assembly language. The following instruction, which...

    A C program has been compiled into the Atmel AVR assembly language. The following instruction, which is located at address 0x002A, is executed: i.) What is the binary value contained in the instruction register (IR) when the instruction is executed? ii.) What is the hexadecimal value of the program counter (PC) when the instruction is executed? iii.) If register r1 = 0x40 and register r2 = 0x02 prior to executing the instruction, what are the contents of r1 and r2...

  • Make a sorted integer array a[i]=i, i=0,...,n-1. Let bs(a,n,x) be a binary search program that returns...

    Make a sorted integer array a[i]=i, i=0,...,n-1. Let bs(a,n,x) be a binary search program that returns the index i of array a[0..n-1] where a[i]=x. Obviously, the result is bs(a,n,x)=x, and the binary search function can be tested using the loop for(j=0; j<K; j++) for(i=0; i<n; i++) if(bs(a,n,i) != i) cout << “\nERROR”; Select the largest n your software can support and then K so that this loop with an iterative version of bs runs 3 seconds or more. Then measure...

  • (20 pts) To understand the value of recursion in a programming language: implement the binary search...

    (20 pts) To understand the value of recursion in a programming language: implement the binary search algorithm first as a recursive function and again using a conditional loop. Your program should create an array of characters holding the letters ‘A’ – ‘Z’ and find the index in the array where the letter ‘K’ is stored. You may use any programming language that supports recursion. (5pts) Define syntax and semantics and give an example. (5pts) Why is it important for a...

  • Language C++ Instructions Develop a CPP program to test is an array conforms heap ordered binary...

    Language C++ Instructions Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives an error if the last item entered violates the heap condition. Use will enter at most 7 numbers. Example runs and comments (after //) are below. Your program does not print any comments. An output similar to Exp-3 and Exp-4 is expected. Exp-1: Enter a number: 65 Enter a number: 56 // this is...

  • *Java* Given the attached Question class and quiz text, write a driver program to input the...

    *Java* Given the attached Question class and quiz text, write a driver program to input the questions from the text file, print each quiz question, input the character for the answer, and, after all questions, report the results. Write a Quiz class for the driver, with a main method. There should be a Scanner field for the input file, a field for the array of Questions (initialized to 100 possible questions), and an int field for the actual number of...

  • These are my answere to the following questions: are they right? 1. B 2. T 3....

    These are my answere to the following questions: are they right? 1. B 2. T 3. T 4. T 5. F 6. T 7. A 8. D 9. E 10. B 11. B 12. A 13. A 14. D 15. C 16. D 17. T 18. C 19. T 20. T 21. T 22. A 23. T 24. D 25. B 26. A 27. A 28. A 29. T 30. C 31. D 32. A 33. T 34. F 35....

  • Edit a C program based on the surface code(which is after the question's instruction.) that will...

    Edit a C program based on the surface code(which is after the question's instruction.) that will implement a customer waiting list that might be used by a restaurant. Use the base code to finish the project. When people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. The program must use a linked list to implement the queue-like data structure....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT