Top-Rated Free Essay
Preview

Using Global Variables

Satisfactory Essays
252 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Using Global Variables
Unit 4 Research Paper Assignment 1: Using Global Variables
1. Five advantages of using global variables
• It is accessible to all modules in a program
• You only have to declare it once outside the modules
• It is good to use it for constants you want to keep consistent
• It simplifies maintenance, avoids duplication of local constants
• It can make a program easier to read in reference to constants
Five disadvantages of using global variables
• It makes debugging difficult
• Any statement in a program can change the variable
• If modules use global variables it is dependent upon the module and if other modules are presented you have to redesign all over each time
• It makes a program hard to understand since it can be modified and have to be aware of all other parts of the program that access it
• Global variables are not willing direct into flowcharts
2. How can you declare global and local variables in flowcharts?
• Global variables are displayed in pseudo code but not in flowcharts directly o In order to declare global variables in a flowchart, you’d put that variable in the main part of the program (the main box where other functions will branch off from) for local variables, you’d put those variables in the box where each separate functions executed.
3. How can you declare global and local variables in pseudocode
• A local variable is a variable declared inside a construct, such as a class or function, whole a global variable is a variable declared outside of any construct.

You May Also Find These Documents Helpful

  • Satisfactory Essays

    6. What is the difference between passing an argument by value and passing it by reference?…

    • 765 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    CIS115 W2 Exercise

    • 757 Words
    • 10 Pages

    5) Use MS Visio to create a flowchart. Paste the flowchart here or attach it as a separate document. Use the same valid variable names you used in Step 1.…

    • 757 Words
    • 10 Pages
    Good Essays
  • Powerful Essays

    Lab 7 & 8

    • 1094 Words
    • 5 Pages

    Could Allow Remote Code Execution, two heap overflow, cross-site scripting (XSS) vulnerability that could allow elevation of privilege, enabling an attacker to execute arbitrary commands on the site in the context of the target user.…

    • 1094 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    bad data and common input files. It also allows them to create applications that can resolve exceptions.…

    • 442 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Devs010 Unit 3 Assignment

    • 261 Words
    • 2 Pages

    Lab practical will be used to carry out these tasks, students will be prompted to develop programs in JavaScript.…

    • 261 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    9.) A bug collector collects bugs every day for 7 days. Design a program that keeps a running total of the number of bugs collected during the 7 days. The loop should ask for the number of bugs collected each day, and when the loop is finished, the program should display the total number of bugs collected.…

    • 651 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    IT 210 appendix d

    • 264 Words
    • 2 Pages

    Match the activity or purpose on the left with the appropriate description on the right by typing in the corresponding letter under the Answer column.…

    • 264 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 4 Homework

    • 401 Words
    • 2 Pages

    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.…

    • 401 Words
    • 2 Pages
    Satisfactory Essays
  • Better Essays

    7) Global variables make debugging difficult because any statement in a program can change its value.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Powerful Essays

    graded assignments

    • 6001 Words
    • 35 Pages

    This document includes all of the assignment requirements for the graded assignments in this course. Your instructor will provide the details about when each assignment is due.…

    • 6001 Words
    • 35 Pages
    Powerful Essays
  • Good Essays

    making it possible for attackers to breach the security of your home. Think about installing…

    • 1030 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    References: Ecco, Tomoye. (2007). DAU - Defense Acquisition University. Phase 4: Implementation. Retrieved July 8, 2007, from https://acc.dau.mil/CommunityBrowser.aspx?id=31787…

    • 1512 Words
    • 7 Pages
    Powerful Essays
  • Satisfactory Essays

    Global variables are variables that are visible to every module in the program and its scope is the entire program so that all of the modules within the program can access a global variable. They can be declared in modules by simply setting up an assignment box and adding in the variables to the modules. In Pseudocode, you will simply write out the particular variable you want to declare and its value. Many programmers go against the idea of using global variables in modules but there are a few good sides to using global variables. For one, the global variables are very easy to find within modules and can be accessed throughout all of them. Global variables also make it easier to update…

    • 439 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    IOs Frameworks

    • 930 Words
    • 4 Pages

    The Foundation framework includes the root object class, classes representing basic data types such as strings and byte arrays, collection classes for storing other objects, classes representing system…

    • 930 Words
    • 4 Pages
    Good Essays
  • Good Essays

    A very good afternoon to the Chair Speaker,wise and honourable adjudicators, precise timekeeper, respected teachers, worthy opponents,my fellow teammates and most of all, members of the floor.…

    • 962 Words
    • 4 Pages
    Good Essays

Related Topics