We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

Homework: Coding Essay

Paper type: Essay Pages: 2 (388 words)

Views: 254

1. How do modules help you to reuse code in a program?
If a operation needs to be performed in several places, the same module can be called and re-used cutting down on unnecessary code.

2. Name and describe the two parts that a module definition has in most languages. The two parts are a header and a body

3. When a module is executing, what happens when the end of the module is reached? It jumps back to the part of the program that called it.

This is known as the return point

4. What is a local variable? What statements are able to access a local variable? A local variable is declared inside a module and cannot be accessed by statements that are outside the module.

5. In most languages, where does a local variable’s scope begin and end? Usually begins at the variables declaration and ends at the end of the module

6. What is the difference between passing an argument by value and passing it by reference? Passing an argument by value copies the data from the variable but does not change the original data.

Passing a variable by reference will overwrite the existing data at that reference point in memory.

7. Why do global variables make a program difficult ot debug? If there is a debug issue, you have to step through ALL modules looking for the module that is incorrectly accessing that variable. Most programs have many many modules. This makes global variables very time consuming to debug.

Algorithm Workbench Review Questions 1,5,6, and 7 from page 111

1. Design a module named timesTen. The module should accept an Integer argument. When this module is called, it should display the product of its argument multiplied by 10

1. Declare a variable called number and set the value of it 2. Call the module timesTen passing as an argument the variable number by reference 3. In the module named timesTen create a parameter named number that the argument will be passed into 4. Calculate and set the variable number * 10

5. Display the variable number

5. Design a module named getNumber, which uses a reference parameter variable to accept an Integer argument. The module should prompt the user to enter a number and then store the input in the reference parameter variable

Cite this page

Homework: Coding. (2016, Jun 15). Retrieved from https://studymoose.com/homework-coding-essay

How to Avoid Plagiarism
  • Use multiple resourses when assembling your essay
  • Use Plagiarism Checker to double check your essay
  • Get help from professional writers when not sure you can do it yourself
  • Do not copy and paste free to download essays
Get plagiarism free essay

Not Finding What You Need?

Search for essay samples now

Our customer support team is available Monday-Friday 9am-5pm EST. If you contact us after hours, we'll get back to you in 24 hours or less.

By clicking "Send Message", you agree to our terms of service and privacy policy. We'll occasionally send you account related and promo emails.
No results found for “ image
Try Our service
online

Hi, I am Sara from Studymoose

Hi there, would you like to get such a paper? How about receiving a customized one? Click to learn more https://goo.gl/CYf83b

online

Hi, I am Sara from Studymoose

Hi there, would you like to get such a paper? How about receiving a customized one? Click to learn more https://goo.gl/CYf83b

image

Your Answer is very helpful for Us
Thank you a lot!