NOTIFICATION: These examples are provided for educational purposes. The use of this code and/or information is under your own responsibility and risk. The information and/or code is given ‘as is’. I do not take responsibilities of how they are used.

If any of these answers is incorrect or you wish a different explanation, please let me know by commenting.

  1. What is “Binding Time”?
    Binding time is the time in which two things associate (also known as binding) or the time in which any implementation decision is made.
  2. What is the distinction between decisions that are bound statically to those bound dynamically?
    Anything that is bound before run-time are considered bound statically while anything that is bound after run-time are bound dynamically.
  3. What is the distinction between the lifetime of a name-to-object and the visibility of a name-to-object?
    The lifetime of a name-to-object is the time between the creating and the destruction of the name-to-object. This is also known as binding’s lifetime.
    The visibility of a name-to-object is decided by the scope used on the programming language. This means that depending of how the scope works (dynamically or statically), we can access to the name-to-object.
  4. How is determined when an object is allocated on the stack, on the heap, or allocated statically?
    1. An object is allocated and deallocated in the stack (last-in, first out order memory) when the objects are in conjunction with a subroutine calls and returns.
    2. When an object is needed to be allocated and deallocated at arbitrary times, or when the size is decided at run-time, the heap will be used for the object allocation/deallocation.
    3. An object is allocated statically when the object is given an absolute address that is retained thought the whole program’s execution.
  5. What is the information and/or objects that are store in a stack frame?
    1. Global variables
    2. Program instructions
    3. Local variables
    4. Constants (including numeric and string valued constants)
    5. Run-time tables
    6. Frames (also known as activation records) with are composed of:
      Arguments, return values, local variables, temporaries, and bookkeeping.
  6. What is a frame pointer and what it is used for?
    A frame pointer is a register that is used for pointing to a location in which the frame of the current subroutine is located.
    When a code require to access to a local variable within the current frame or an argument, the frame pointer is used.
  7. Is a calling sequence a subroutine?
    Yes. The calling sequence  whole purpose is to maintain the stack. This subroutine will be executed before and after the caller call for the prologue and epilogue of the subroutine itself.
  8. What is the prologue and epilogue?
    The prologue is the code executed at the beginning.
    The epilogue is the code executed at the end.
  9. When does an internal fragmentation occurs?
    An internal fragmentation occurs when a block larger than the object to be hold is allocated by the storage-management algorithm. This mean an extra space is unused.
  10. When does an external fragmentation occurs?
    An external fragmentation occurs when an active object have blocks assigned to it scattered though the heap in such a way that there exist unused space composed of multiple blocks. This could create a problem since there could not be a block that would be large enough to satisfy a request for another object in the future.
  11. What is garbage collection?
    The basic concept of garbage collection is a run-time library with the purpose of identifying and reclaim space which is unused or have unreachable objects.
  12. What is static scoping?
    We call static scoping when the binding between names and objects is determined at compile-time when we analyse the program’s text without having in consideration the flow of the program.
  13. What is dynamic scoping?
    We call dynamic scoping when the bindings depend on the flow of the program at run-time.
  14. In programming languages such as Ada, what called elaboration?
    In programming languages such as Ada, when a process by which declarations have become active when the control first enters a scope is called an elaboration. In short, we call elaboration when there is a creation of bindings.
  15. What do we call a referencing environment?
    We refer to a set of active bindings (determined by static or dynamic scope rules) as current referencing environment.  This means that referencing environment are dependent of binding rules.
  16. What is a declaration?
    A declaration is when a name (variable) is introduced and it indicates its scope but may omit certain implementation details. An example in C:

    extern int integer_variable;
  17. What is a definition?
    A definition is a name (variable) which describe an object with enough details for which the compiler can determine its implementation. An example in C:

    int integer_variable = 10;
  18. What is the distinction between the declaration and a definition that is so important?
    A name (variable) is required to be declared before it can be used. This means that by just defining a name, it does not mean that we can use it. We must declared first. A definition do not provide enough information to the compiler to know how much memory must be allocated and/or the scope that would be given to the name.
  19. What is information hiding and why is it important?
    The main idea of information hiding is to make some portion of an algorithm invisible. By making an interface, we reduce the “cognitive load” on a programmer. Reducing the “cognitive load” means that the programmer have less to worry about and can focus on the rest.
    Information hiding also reduce the risk of name conflict and provide safeguards on the integrity of data abstractions.
  20. What are aliases and why they are considered a problem in language design and/or implementation?
    Names that are referencing to a same object are called Aliases. A problem that may occur is when inside a subroutine, two names are pointing to a same location of memory created locally in the subroutine. If this subroutine goes out of scope, then any of these names may be pointing to a location of memory that does not exist anymore for that subroutine. Example in C:

    void f(int *pointer_to_variable){
      int integer_variable = 10;
      ...
      pointer_to_variable = &integer_variable;
      ...
    }
    
    int main(int argc, char* argv[]){
      ...
      int *integer_pointer;
      ...
      f(integer_pointer);
      ...
      printf('value: %d', *integer_pointer);
      ...
      return 0;
    }

    This means that we may print anything else, since integer_variable would goes out of scope when returning from the funtion f.
    So, integer_pointer would be pointing to an address in memory where any other value than 10 would be store.

© 2010, Alejandro G. Carlstein Ramos Mejia. All rights reserved.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

*

Click to Insert Smiley

SmileBig SmileGrinLaughFrownBig FrownCryNeutralWinkKissRazzChicCoolAngryReally AngryConfusedQuestionThinkingPainShockYesNoLOLSillyBeautyLashesCuteShyBlushKissedIn LoveDroolGiggleSnickerHeh!SmirkWiltWeepIDKStruggleSide FrownDazedHypnotizedSweatEek!Roll EyesSarcasmDisdainSmugMoney MouthFoot in MouthShut MouthQuietShameBeat UpMeanEvil GrinGrit TeethShoutPissed OffReally PissedMad RazzDrunken RazzSickYawnSleepyDanceClapJumpHandshakeHigh FiveHug LeftHug RightKiss BlowKissingByeGo AwayCall MeOn the PhoneSecretMeetingWavingStopTime OutTalk to the HandLoserLyingDOH!Fingers CrossedWaitingSuspenseTremblePrayWorshipStarvingEatVictoryCurseAlienAngelClownCowboyCyclopsDevilDoctorFemale FighterMale FighterMohawkMusicNerdPartyPirateSkywalkerSnowmanSoldierVampireZombie KillerGhostSkeletonBunnyCatCat 2ChickChickenChicken 2CowCow 2DogDog 2DuckGoatHippoKoalaLionMonkeyMonkey 2MousePandaPigPig 2SheepSheep 2ReindeerSnailTigerTurtleBeerDrinkLiquorCoffeeCakePizzaWatermelonBowlPlateCanFemaleMaleHeartBroken HeartRoseDead RosePeaceYin YangUS FlagMoonStarSunCloudyRainThunderUmbrellaRainbowMusic NoteAirplaneCarIslandAnnouncebrbMailCellPhoneCameraFilmTVClockLampSearchCoinsComputerConsolePresentSoccerCloverPumpkinBombHammerKnifeHandcuffsPillPoopCigarette