A Level · 1.2.2 and 1.2.3
Applications Generation and Software Development
Name
Class
Date
Mark / 36
Section A
Circle the letter of the correct answer. One mark each.
- 1What happens during lexical analysis?1
- ASource characters are grouped into tokens and the symbol table is built
- BMachine code is generated
- CCode is optimised
- DThe abstract syntax tree is built
- 2At which stage are syntax errors detected?1
- AOptimisation
- BCode generation
- CSyntax analysis
- DLexical analysis
- 3What is the main advantage of dynamic linking?1
- AThe program has no external dependencies
- BThe library cannot be changed
- CIt always runs faster
- DThe executable is smaller and a library update benefits every program using it
- 4What does a loader do?1
- ACombines object code with libraries
- BTranslates source to machine code
- CCopies an executable into memory and prepares it to run
- DOptimises the code
- 5Which methodology is most suitable when requirements are fixed and full documentation is legally required?1
- AAgile
- BWaterfall
- CExtreme programming
- DRapid application development
- 6What is a key requirement for agile development to work well?1
- ANo testing until the end
- BContinuous availability of the customer
- CA fully fixed specification at the start
- DA very large development team
- 7What distinguishes the spiral model?1
- AIt has only one pass
- BIt produces no documentation
- CIt never involves the customer
- DExplicit risk analysis in every cycle
- 8What is pair programming?1
- ATesting in pairs
- BTwo developers working at one machine, one writing and one reviewing
- CWriting two versions of every function
- DTwo teams building the same feature
- 9What is stored in the symbol table?1
- AIdentifiers and their attributes such as type and scope
- BThe error messages
- CThe optimisation settings
- DThe machine code produced
- 10Which is a disadvantage of using a compiler rather than an interpreter during development?1
- AThe resulting program runs slowly
- BThe source code must be distributed
- CErrors are reported all together after translating the whole program
- DIt cannot optimise
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1DescribeDescribe the stages of compilation.6
- 2ExplainExplain the difference between static and dynamic linking.4
- 3JustifyA company is developing a control system for a medical device. The requirements are fixed by regulation and full documentation must be produced. Recommend a development methodology and justify your choice.6
- 4ExplainExplain two advantages of using a library of pre-written subroutines.4
- 5CompareCompare the waterfall and agile approaches to software development.6
Mark scheme
Section A
Section B
1 Describe the stages of compilation. 6
One mark for each of the following, to a maximum of 6.
- Lexical analysis groups characters into tokens
- Whitespace and comments are removed and the symbol table is created
- Syntax analysis parses tokens against the grammar of the language
- An abstract syntax tree is produced and syntax errors are reported
- Code generation converts the tree into machine or object code
- Optimisation improves the code so it runs faster or uses less memory
Model answer. Compilation begins with lexical analysis, in which the source is read character by character and grouped into tokens representing keywords, identifiers, operators and constants. Whitespace and comments are discarded because they have no meaning to the compiler, and identifiers and constants are recorded in the symbol table along with attributes such as type and scope. Syntax analysis then parses the stream of tokens against the formal grammar of the language, building an abstract syntax tree that represents the structure of the program, and reporting a syntax error for anything that cannot be fitted to the grammar. Semantic checks such as type compatibility and the use of undeclared identifiers are also carried out at this point. Code generation then walks the abstract syntax tree and produces the equivalent machine code or object code. Finally the optimisation stage improves that code, for example by removing instructions whose results are never used, moving calculations that do not change out of loops, and allocating registers more efficiently, so that the finished program runs faster or occupies less memory.
2 Explain the difference between static and dynamic linking. 4
One mark for each of the following, to a maximum of 4.
- Static linking copies the library code into the executable at compile time
- The executable is larger but self contained
- Dynamic linking stores only a reference and loads the library at run time
- The executable is smaller and library updates apply automatically, but a missing library breaks it
Model answer. Static linking copies the machine code of every library subroutine the program uses directly into the executable file at compile time. The result is a larger file, and identical library code is duplicated across every program that uses it, but the executable is entirely self contained: it will run wherever it is placed and cannot be broken by a later change to the library. Dynamic linking instead stores only a reference to the library, which is located and loaded into memory when the program runs. Executables are therefore much smaller, one copy of the library serves every program on the system, and a security fix or improvement to that library benefits all of them without any of them being rebuilt. The trade off is a run time dependency: if the library is missing, or has been replaced by an incompatible version, the program will fail to start or behave unpredictably.
3 A company is developing a control system for a medical device. The requirements are fixed by regulation and full documentation must be produced. Recommend a development methodology and justify your choice. 6
One mark for each of the following, to a maximum of 6.
- Recommends the waterfall methodology
- The requirements are fixed and fully known in advance
- Waterfall completes each stage fully before the next begins
- It produces thorough documentation at every stage, which regulation demands
- Its inflexibility is not a problem because the requirements cannot change
- Notes that a methodology such as agile would produce insufficient documentation for approval
Model answer. The company should use the waterfall methodology. Its central weakness, inflexibility in the face of changing requirements, does not apply here because the requirements are fixed by regulation and cannot change during development, so the risk of an expensive late revision is minimal. Waterfall's sequential structure, completing analysis, design, implementation, testing and evaluation fully in turn, produces a formal signed off deliverable at the end of each stage, and this is precisely what a regulator needs: a complete audit trail demonstrating that every requirement was specified, designed for, implemented and tested. In a medical device context this documentation is not overhead, it is a legal necessity, and its absence would prevent approval regardless of how good the software actually was. An agile approach would be a poor fit here even though it is often preferable elsewhere. Agile deliberately produces lighter documentation and expects requirements to evolve through customer feedback, neither of which is appropriate when the specification is externally imposed and immutable. Its strength, responding rapidly to change, has no value in this project. The one adjustment worth making is to include rigorous verification within each waterfall stage rather than leaving all testing to the end, since defects found late in a safety critical system are extremely expensive to correct.
4 Explain two advantages of using a library of pre-written subroutines. 4
One mark for each of the following, to a maximum of 4.
- Development time is reduced because the code does not have to be written
- The developer can concentrate on the parts specific to their application
- Library code is widely used and tested, so it is more reliable
- Specialist areas such as cryptography are extremely difficult to implement correctly
Model answer. The first advantage is development speed. A library provides subroutines for common tasks such as sorting, mathematical functions, file compression or network communication, so the developer does not have to write, debug and document that functionality themselves and can concentrate on the parts of the system that are specific to their own application. The second advantage is reliability. Library code has typically been used by very large numbers of developers over a long period, so defects have been found and corrected in a way that newly written code cannot match. This matters most in specialist areas such as cryptography, where a subtly incorrect implementation may appear to work perfectly while being completely insecure, and where writing it yourself is almost always the wrong decision.
5 Compare the waterfall and agile approaches to software development. 6
One mark for each of the following, to a maximum of 6.
- Waterfall is sequential with each stage completed before the next
- Agile is iterative, delivering working software in short repeated cycles
- Waterfall produces extensive documentation at every stage
- Agile involves the customer continuously and adapts to changing requirements
- Waterfall handles change poorly and shows the client nothing working until late
- Agile can be harder to cost and schedule and produces lighter documentation
Model answer. Waterfall is a sequential methodology in which analysis, design, implementation, testing and evaluation are each completed and signed off before the next begins, producing a full set of documentation at every stage. Agile is iterative: the project is divided into short cycles, each of which delivers a working increment of the software, and the customer reviews that increment and influences what is built next. This produces two very different profiles. Waterfall gives strong control and a complete audit trail, which suits projects where the requirements are fixed and where regulators or contracts demand documented evidence, but it handles change extremely badly, because altering a requirement after design is complete means revisiting earlier stages at considerable cost, and the client sees nothing that actually runs until very late in the project. Agile handles change as a normal part of the process rather than an exception, and because working software is delivered early and frequently, misunderstandings about requirements surface within weeks rather than months. Its costs are that it demands continuous customer availability, which many organisations cannot provide, that the final cost and delivery date are much harder to predict at the outset, and that its lighter documentation can make the system more difficult to maintain years later when the original developers have moved on.