And Verified Answers A+
1. what is a linker?: software that links external modules and libraries included within the code.
It puts appropriate memory addresses in place so that the program can call and return from a library function.
2. describe static linking.: module/library code is copied directly into finished machine code.
increases the size of the file.
3. describe dynamic linking.: compiled versions of the required libraries are stored on the host computer
the operating system links the required code from the library as the program is running.
4. what is a loader?: the loader is the part of the operating system that loads the executable program file
(machine code) into memory, ready to be run.
5. a game uses a 2D graphics library. Explain why a linker would need to be
used after compilation.: the user running the program will not necessarily have the library installed on
their machine, therefore the relevant code needs to be included within the final executable code.
It is the job of the linker to compare this code.
6. A software development team is writing a word game. The team is using RAD.
The software team uses a pre-built library to create a Graphic User Interface.
Give two advantages to the software team of using a library.: - saves time/money as it
is prewritten
- pre-tested (likely to work)
- draws on expertise of other programmers
- can have been written in a ditterent language
7. Explain the process of compilation including how code from the library be-
comes part of the finished program, justifying why each stage is necessary.
[9]: Source code is input into a computer program . The first stage is lexical analysis in which:
-white spaces and comments are removed.
- variable and statements are tokenized .
- The tokens are stored in a symbol table.
the code is then passed on to the syntax analysis :
-The code is checked to ensure it follows the rules of its language
- when it breaks the rules of the language , errors are generated
-If no rules are broken, it is passed on to the code generation
, The object code is created and translated into machine code to be executed.
The code is then optimized by removing redundant code and unreadable code.
The main program source code will have contained lines importing the library code.