variables/constants

Cards (43)

  • What is essential for assisting future program updates?
    Writing clear code
  • What are programs sequences of?
    Instructions for a computer
  • What are units of information in computing called?
    Data
  • What different types can data be?
    Integers, characters and Boolean
  • In programs, what is data usually referred to as?
    Values
  • What is a variable?
    A named memory location
  • What does RAM stand for?
    Random Access Memory
  • What happens to the data stored in RAM when a computer is turned off?
    It is lost
  • What usually happens to the value held in a variable as a program runs?
    It changes
  • What is a variable's name known as?
    An identifier
  • What two things can a variable identifier contain?
    Letters and numbers
  • What must a variable identifier start with?
    A letter
  • Which special character can be used in variable identifiers?
    Underscore
  • Why should a variable name be meaningful?
    Represent the value it holds
  • Why do variables make it easy for a program to store values in memory?
    The computer keeps track of locations
  • What must the programmer remember when using variables?
    The name of the identifier
  • What is required of a variable in some programming languages before assigning a value to it?
    It must be declared
  • Why is declaring variables considered good practice?
    Ensures memory location is ready
  • What data type will the variable 'score' hold if it is declared as 'Dim score as integer'?
    Integer values
  • What is giving a variable a value known as?
    Assignment
  • What must happen to a variable before it can be used?
    It must be assigned
  • What does a constant enable to be assigned?
    A value assigned a name
  • What is the primary difference between a variable and a constant?
    Constants cannot be changed
  • Why are constants useful?
    Can be referred to repeatedly
  • For what types of values are constants typically used?
    Values unlikely to change
  • How are constants usually named to differentiate them from variables?
    In uppercase
  • What is the area of a program where a variable is accessible called?
    Its scope
  • Where can a global variable be accessed and changed?
    Throughout the whole program
  • Where are local variables typically confined?
    To a subprogram
  • Where is a local variable declared?
    Within the subprogram
  • What is a potential problem when using global variables with the same name as local variables?
    Updating the wrong version
  • What benefit does using local variables provide in programming?
    Easier debugging
  • Why should global variables be avoided as much as possible?
    Difficult debugging
  • How does Python handle global variables within a subprogram?
    Must be declared as global
  • What keyword would you use in Python to access the global variable 'ID' within a function?
    global ID = 75
  • Where is a global variable declared?
    Outside of a subprogram
  • What part of the computer stores data?
    Memory
  • What is RAM?
    Volatile, constantly written memory
  • What type of number is an integer?
    A whole number
  • What is assignment in programming?
    Giving a value to a variable