Preview

Unit 4 Homework

Satisfactory Essays
Open Document
Open Document
401 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Unit 4 Homework
Short Answers
1. How do modules help you to reuse code in a program? Performs the task once then reuses it each time you need to perform the task.
2. Name and describe the two parts that a module definition had in most languages. Header and Body
3. When the module is executing, what happens when the end of the module is reached? Computer jumps back to the part of the program that called the module
4. What is a local variable? What statements are able to access a local variable? A variable that is declared inside a module. Only statements inside the module can access the variable.
5. In most languages, where does a local variable’s scope begin and end? A local variable’s scope usually begins at the variable’s declaration and Ends at the end of the module in which the variable is declared.
6. What is the difference between passing an argument by value and passing it by reference? By Value means that only a copy of the argument’s value is passed into the parameter variable. Passing by Reference means that the argument is passed into a special type of parameter.
7. Why do global variables make a program difficult to debug? You’ll have to track down every statement that accesses it to determine where the bad value is coming from.
Algorithm
1
1. Module timesTen()
2. Call doubleNumber ()
3. End Module
4.
5. Module doubleNumber(Integer value)
6. Declare Integer result
7. Set result = value * 10
8. Display result
9. End Module

5
1. Module getNumber (Integer Ref value)
2. Set value = 0
3. End Module
6
Not Sure what is going to happen because I wrote that whole program and nothing happen. The Value is passed into the parameter value on this program module though.
7
Same with this one actually wrote it to see and nothing happen. The argument is passed into a special type of parameter on this program module.
Programming Exercise
1
1. Module KiloConverter ( Integer value)
2. Declare Integer miles
3.

You May Also Find These Documents Helpful

  • Satisfactory Essays

    It gets the information of number of tasks and the softwares required and puts it into a HashMap softwareTaskMap. In case, the number of tasks is more than the available resources that can perform the task, the system gets ready for a multiple execution.…

    • 464 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    Nt1310 Unit 4

    • 3614 Words
    • 15 Pages

    If the following program (myprog) is run from the command line as myprog 1 2 3, What would be the output?…

    • 3614 Words
    • 15 Pages
    Better Essays
  • Good Essays

    Unit 59 Assignment 3

    • 645 Words
    • 3 Pages

    The process of how the subroutine works within an operating environment is as follows. While the main part of the program is running, there will be a call command sent to the CPU to tell it to stop wherever the program is at, store the W, Z and status along with where in the main program the CPU is at in the stack. Then the main program is cleared from memory and the subroutine is loaded for the CPU to start processing the code. Once the subroutine has finished, the subroutine code is deleted from memory and the CPU will load up the main program back on and will retrieve from stack the stored information (W, Z and status) which will allow the CPU know exactly where it needs to start from.…

    • 645 Words
    • 3 Pages
    Good Essays
  • Good Essays

    OK, let's execute our script and see results - whether values will be captured or not:…

    • 1858 Words
    • 8 Pages
    Good Essays
  • Better Essays

    Unit Project 4

    • 1226 Words
    • 5 Pages

    Pancreas – reduced secretions, damage to acini, blacked ducts due to mucus accumulation, eventual destruction of the pancreas.…

    • 1226 Words
    • 5 Pages
    Better Essays
  • Powerful Essays

    Nt1310 Unit 1

    • 4209 Words
    • 17 Pages

    If two steps are indented at the same level, the uppermost statement is executed first. ans)All of the above…

    • 4209 Words
    • 17 Pages
    Powerful Essays
  • Powerful Essays

    Unit 4 Assignment 2

    • 717 Words
    • 3 Pages

    The purpose of this policy is to define standards for connecting to Richman investment’s network from any host. These standards are designed to minimize the potential exposure to Richman investments from damages which may result from unauthorized use of Richman investments resources. Damages include the loss of sensitive or company confidential data, intellectual property, damage to public image, damage to critical Richman investments internal systems, etc.…

    • 717 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    User-friendly is a term used in the software development to describe programs that are easy to use.…

    • 848 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    UNIT 2 HOMEWORK 2012

    • 908 Words
    • 4 Pages

    16. What were the colonies expected to do according to mercantilist doctrine? (Ch. 3, pgs. 72-73)…

    • 908 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    In a procedural program, modules interact by reading and writing state that is stored in shared data structures.…

    • 793 Words
    • 4 Pages
    Good Essays
  • Better Essays

    6) When you pass by value you pass a copy. When you pass by reference, you can modify the contents.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    This Is a Paper

    • 469 Words
    • 2 Pages

    Provide a set of values that will test the normal operation of this program segment. Defend your choices.…

    • 469 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    All data-input and data-display operations (cin and cout) should be done in the function main() test program.…

    • 477 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Sa3Dany

    • 270 Words
    • 2 Pages

    Trace the following code showing the changes in the value of each variable as the instructions are executed and the output displayed on the screen. Use '-' to show the width of the output field. (To get full grade you have to show all tracing steps)…

    • 270 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    2. a) What is the difference (in terms of address) between relocatable object module and absolute program? (1m) - Relocatable object module…

    • 935 Words
    • 4 Pages
    Good Essays