OCR H446 A Level Computer Science · 1.2 Software and Software Development

Stretch tasks Applications Generation and Software Development

Task 1

Quiz Challenge

A quiz game against four computer players, then short and long written answers.

  1. Quiz Blitz12 questions against the clock
  2. Quick Fire4 short answers
  3. Big Think2 long answers

About 20 minutes

Task 2

This or That

Pixel the cat asks 8 questions. Each has two answers: pick the right one.

  • Two answers to every question
  • A fish treat for every right answer
  • Streaks win Pixel shades, then a party hat

About 4 minutes

Task 3

Memory Match

Flip the cards two at a time to match each term card to its meaning card.

  • 12 cards: each term has a meaning
  • One peek at every card
  • Combo points for pairs found in a row

6 pairs, about 4 minutes

Task 4

Sort It

Sort each statement into the right box, like the tick box tables in the exam.

  • 12 cards to sort into 3 boxes
  • Drag a card, tap a box or press its number
  • Combo points for cards sorted in a row

12 cards, about 4 minutes

Task 5

Code Word

Guess the lesson's secret words. Every guess shows which letters are right.

  • A clue for every word
  • Tiles turn green, amber or grey after each guess
  • Fewer guesses win more points

3 words, about 4 minutes

Task 7

Bug Hunt

Two statements are true and one has a bug. Catch the bug before it gets away.

  • Three statements in every round
  • Tap the one with the mistake
  • Streaks win bonus points

5 rounds, about 4 minutes

Brain games

Train your brain on this lesson

Logic, memory and speed, built from this lesson's own key ideas. Win up to three diamonds in each game.

Logic

Odd One Out

Four tiles: three share a link and one does not. Spot the odd one out, then see what links the rest.

  • Three belong together, one does not
  • A hint shows the link, for fewer points
  • Quick answers and streaks win more

8 rounds, about 3 minutes

Memory

Memory Flash

Study the term cards, then they flip over. Find the card that goes with each clue, from memory.

  • Three levels: 3, 4 and 6 cards
  • Two tries to find each card
  • Streaks win bonus points

3 levels, about 4 minutes

Speed

Fact or Fib

Statements fly in one at a time. Is each one a fact or a fib? Decide fast.

  • Swipe, tap or use the arrow keys
  • Every fib comes with its fix
  • Streaks multiply your points

12 statements, about 3 minutes

The final challenge

City Run

Race a robot cat on inline skates through a neon cyber city, from Neon Station to the Hyper Tunnel. Every question is a row of neon gates across the tracks: skate through the one with the right answer, dodge the trains and barriers, and grab diamonds.

  • 20 questions from this lesson, in four parts of the city
  • Swipe, tap or use the arrow keys
  • Dodge trains and holograms, and jump crates and cones

20 questions, about 6 minutes

Bonus challenge

Neon Roll

Roll a glowing ball down an endless neon slope, past towers lit up with neon signs of Pixel the cat. Steer, jump the gaps and dodge the blocks. Questions from this lesson wait at gates along the way: every right answer keeps the ball rolling.

  • Questions from this lesson at every gate
  • Hold the arrow keys or a side of the slope to steer
  • 8 right answers win two diamonds, 15 win three

Endless, about 5 minutes

The games need JavaScript. Every question is below, with the answers at the end.

Read the lesson: Applications Generation and Software Development

Applications Generation and Software Development: the questions

Quiz Challenge, round 1: Quiz Blitz

  1. Put the stages of compilation in order.

    Number these 1 to 4.

    • Syntax analysis
    • Code generation
    • Optimisation
    • Lexical analysis
  2. What is built during lexical analysis?

    • The symbol table
    • The abstract syntax tree
    • The executable file
    • The library
  3. Which stage of compilation builds the abstract syntax tree?

    • Syntax analysis
    • Lexical analysis
    • Code generation
    • Optimisation
  4. Comments and whitespace are removed during lexical analysis.

    • True
    • False
  5. What does a linker do?

    • Translates assembly language into machine code
    • Checks code against the grammar of the language
    • Combines compiled object code with the library code it uses
    • Copies an executable into memory to run it
  6. Which TWO are advantages of dynamic linking?

    Tick 2.

    • The executable is self contained
    • Library changes can never break the program
    • Smaller executable files
    • A library update helps every program that uses it
    • The program never depends on another file
  7. Which methodology suits a safety critical project with fixed requirements?

    • Agile
    • Waterfall
    • Extreme programming
    • Rapid application development
  8. Agile methods produce no documentation at all.

    • True
    • False
  9. Which methodology puts an explicit risk analysis into every cycle?

  10. What is pair programming?

    • Two developers at one machine, one writing and one reviewing
    • Two programs sharing one library
    • Writing every module twice
    • Two teams building rival versions
  11. Why can optimisation make debugging harder?

    • It adds new syntax errors
    • It deletes the symbol table
    • The generated code no longer maps neatly onto the source
    • It removes every comment from the source
  12. Put these waterfall stages in order.

    Number these 1 to 4.

    • Design
    • Implementation
    • Testing
    • Analysis

Quiz Challenge, round 2: Quick Fire

  1. Explain the difference between a compiler and an interpreter. [2 marks]

  2. Describe what happens during syntax analysis. [2 marks]

  3. Explain why a team might choose static linking rather than dynamic linking. [2 marks]

  4. Explain why agile suits a project whose requirements are likely to change. [2 marks]

Quiz Challenge, round 3: Big Think

  1. Describe the four stages of compilation. [6 marks]

  2. A small company is building a phone app. The client is unsure what they want and will meet the team every week. Recommend a development methodology and justify your choice. [4 marks]

This or That: tick the right answer

  1. Which translator stops at the first error it meets?

    • A compiler
    • An interpreter
  2. Which stage removes comments from the source code?

    • Code generation
    • Lexical analysis
  3. Which copies an executable into memory ready to run?

    • The loader
    • The linker
  4. Which gives a smaller executable?

    • Dynamic linking
    • Static linking
  5. The client cannot be contacted after the first meeting. Which methodology copes better?

    • Waterfall
    • Agile
  6. Which methodology uses test driven development?

    • Waterfall
    • Extreme programming
  7. Which methodology suits a large, high risk project?

    • Spiral
    • Rapid application development
  8. Why do programmers use libraries?

    • Libraries make every program faster
    • The code is already written and tested

Memory Match: match each term to its meaning

TermMeaning
A Token1 The structure built by parsing the tokens
B Symbol table2 Joins object code with library code
C Abstract syntax tree3 Iterative model with risk analysis each cycle
D Linker4 Copies the executable into memory to run
E Loader5 Holds identifiers and their attributes
F Spiral6 A keyword, identifier or operator found by the lexer

Sort It: tick one box in each row

Which development methodology does each statement describe?

StatementWaterfallAgileSpiral
The customer is involved throughout
Each stage is finished before the next begins
Working software is delivered in short iterations
Risk is analysed explicitly in every cycle
Expensive, because every cycle includes a risk review
Excellent for large, high risk projects
Lighter documentation can make maintenance harder
Needs genuine risk assessment expertise
A late change of requirement is very costly
Suits fixed requirements in a safety critical system
The client sees nothing working until late
Copes well with changing requirements

Code Word: write the word that fits each clue

  1. A keyword, identifier or operator produced by lexical analysis. (5 letters)

  2. Combines compiled object code with the library code a program uses. (6 letters)

  3. A methodology that analyses risk in every cycle. (6 letters)

Link Up: find the three groups

These 12 tiles make 3 groups of 4. Write each group in the table, and what links its tiles.

  • Spiral
  • Extreme programming
  • Agile
  • Waterfall
  • Object code
  • Optimisation
  • Tokens
  • Syntax analysis
  • Code generation
  • Syntax tree
  • Symbol table
  • Lexical analysis

Bug Hunt: tick the statement that is wrong

In each set, two statements are true and one has a mistake in it.

    • Lexical analysis turns the source into tokens.
    • Optimisation is the first stage of compilation.
    • Syntax analysis builds an abstract syntax tree.
    • An interpreted program runs faster than the same program compiled.
    • A compiler reports its errors after translating the whole program.
    • An interpreter stops at the first error it meets.
    • Dynamic linking loads the library while the program runs.
    • Static linking copies library code into the executable.
    • Dynamic linking makes the executable larger than static linking.
    • The loader copies an executable into memory.
    • A library holds subroutines that are already tested.
    • The linker copies the finished program into memory to run it.
    • Spiral analyses risk in every cycle.
    • Waterfall completes each stage fully before the next stage begins.
    • Agile suits projects where the client cannot be contacted.

Brain game: Odd One Out

Three tiles in each set share a link. Tick the odd one out, then write what links the other three.

    • Waterfall
    • Optimisation
    • Code generation
    • Lexical analysis

    What links the other three?

    • Spiral
    • Object code
    • Tokens
    • Syntax tree

    What links the other three?

    • Spiral
    • Agile
    • Waterfall
    • Object code

    What links the other three?

    • Agile
    • Object code
    • Syntax tree
    • Symbol table

    What links the other three?

    • Spiral
    • Extreme programming
    • Agile
    • Tokens

    What links the other three?

    • Extreme programming
    • Optimisation
    • Code generation
    • Lexical analysis

    What links the other three?

Brain game: Memory Flash, on paper

Which term means this? Write your answer from memory.

  1. The structure built by parsing the tokens

  2. Joins object code with library code

  3. Iterative model with risk analysis each cycle

  4. Copies the executable into memory to run

  5. Holds identifiers and their attributes

  6. A keyword, identifier or operator found by the lexer

Brain game: Fact or Fib

Tick Fact if the statement is true and Fib if it is not.

  1. The loader copies an executable into memory.

    • Fact
    • Fib
  2. Agile methods produce no documentation at all.

    • Fact
    • Fib
  3. A library holds subroutines that are already tested.

    • Fact
    • Fib
  4. Spiral analyses risk in every cycle.

    • Fact
    • Fib
  5. Dynamic linking loads the library while the program runs.

    • Fact
    • Fib
  6. Optimisation is the first stage of compilation.

    • Fact
    • Fib
  7. An interpreted program runs faster than the same program compiled.

    • Fact
    • Fib
  8. Lexical analysis turns the source into tokens.

    • Fact
    • Fib
  9. Agile suits projects where the client cannot be contacted.

    • Fact
    • Fib
  10. Static linking copies library code into the executable.

    • Fact
    • Fib
  11. The linker copies the finished program into memory to run it.

    • Fact
    • Fib
  12. Dynamic linking makes the executable larger than static linking.

    • Fact
    • Fib

City Run

City Run is a race through a neon cyber city, played on screen. It asks 20 of the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.

Neon Roll

Neon Roll is a ball rolling down an endless neon slope, played on screen. Every right answer keeps it rolling. It asks the questions above, from the quiz, This or That, Memory Flash and Fact or Fib.

Answers

Round 1: Quiz Blitz

  1. Lexical analysis → Syntax analysis → Code generation → Optimisation Characters become tokens, the tokens are parsed into a tree, the tree becomes code, then the code is improved.
  2. The symbol table Identifiers and constants go into the symbol table as the source is turned into tokens.
  3. Syntax analysis The parser fits the tokens to the grammar of the language, building the tree or reporting syntax errors.
  4. True They carry no meaning for the compiler, so they are stripped out as the tokens are made.
  5. Combines compiled object code with the library code it uses The linker joins the pieces together. The loader is what puts the result into memory.
  6. Smaller executable files; A library update helps every program that uses it Dynamic linking keeps files small and shares updates. The cost is a run time dependency: a missing or changed library can break the program.
  7. Waterfall Fixed requirements and full documentation at every stage suit waterfall, which is why regulated industries still use it.
  8. False Agile produces less documentation, not none, which can make long term maintenance harder.
  9. spiral Each turn of the spiral sets objectives, analyses risk, develops and plans the next cycle.
  10. Two developers at one machine, one writing and one reviewing It is a practice of extreme programming that catches mistakes as the code is written.
  11. The generated code no longer maps neatly onto the source Instructions are moved, merged or removed, so stepping through the machine code no longer follows the lines you wrote.
  12. Analysis → Design → Implementation → Testing Each stage is completed before the next begins, and evaluation and maintenance follow.

Round 2: Quick Fire

    • A compiler translates the whole program before it runs, producing an executable
    • An interpreter translates and runs one statement at a time
    Model answer

    A compiler translates the whole program before it runs, producing an executable, while an interpreter translates and runs it one statement at a time every time it runs.

    • The tokens are parsed against the grammar of the language
    • An abstract syntax tree is built
    • Anything that does not fit is reported as an error
    • Semantic checks such as types and undeclared variables are made
    Model answer

    The tokens are parsed against the grammar of the language and an abstract syntax tree is built. Anything that does not fit the rules is reported as a syntax error.

    • The executable is self contained and depends on no other files
    • Later changes to the library cannot break it
    Model answer

    With static linking the library code is copied into the executable, so it is self contained and does not depend on other files. Later changes to the library cannot break it.

    • It works in short iterations, each delivering working software
    • The customer is involved throughout and gives feedback
    Model answer

    Agile works in short iterations, each delivering working software, and the customer is involved throughout and gives feedback, so changed requirements can be built into the next iteration.

Round 3: Big Think

    • Lexical analysis groups the characters into tokens
    • Whitespace and comments are removed
    • Identifiers go into the symbol table
    • Syntax analysis parses the tokens against the grammar
    • An abstract syntax tree is built and syntax errors are reported
    • Code generation turns the tree into object or machine code
    • Optimisation makes the code faster or smaller
    Model answer

    In lexical analysis the source is read character by character and grouped into tokens, whitespace and comments are removed, and identifiers are entered into the symbol table. In syntax analysis the tokens are parsed against the grammar of the language to build an abstract syntax tree, and anything that does not fit is reported as a syntax error. In code generation the tree is converted into object code or machine code. Finally, optimisation improves the code so it runs faster or uses less memory, for example by removing redundant instructions.

    • Recommends agile, or rapid application development
    • Short iterations deliver working versions the client can try
    • The requirements are likely to change, and the method adapts
    • The client meets weekly, so regular feedback is possible
    • Waterfall would not suit, as it fixes the requirements at the start
    Model answer

    Agile is the best choice. It works in short iterations, each producing a working version of the app that the client can try. Because the client is unsure what they want, the requirements are likely to change, and agile adapts to changes from one iteration to the next. The client meets the team weekly, so they can give regular feedback. Waterfall would not suit, because it needs the requirements fixed at the start.

This or That

  1. An interpreter An interpreter runs one statement at a time, so it stops where the error is. A compiler reports every error after trying the whole program.
  2. Lexical analysis Comments carry no meaning for the compiler, so they are stripped out while the tokens are made.
  3. The loader The linker combines the code. The loader puts the result into memory and prepares it to run.
  4. Dynamic linking Dynamic linking stores only a reference to the library, which is loaded at run time.
  5. Waterfall Agile needs the customer throughout. Waterfall fixes the requirements at the start, so it can carry on without them.
  6. Extreme programming In extreme programming the tests are written before the code, alongside pair programming and frequent small releases.
  7. Spiral Spiral analyses risk in every cycle. Rapid application development suits smaller, interface heavy projects.
  8. The code is already written and tested Reusing tested subroutines saves development time and is usually more reliable than writing them again.

Memory Match

  • A 6 Token: A keyword, identifier or operator found by the lexer
  • B 5 Symbol table: Holds identifiers and their attributes
  • C 1 Abstract syntax tree: The structure built by parsing the tokens
  • D 2 Linker: Joins object code with library code
  • E 4 Loader: Copies the executable into memory to run
  • F 3 Spiral: Iterative model with risk analysis each cycle

Sort It

  1. Agile The customer is involved throughout Agile depends on a customer who is available to give feedback all the time.
  2. Waterfall Each stage is finished before the next begins Waterfall runs its stages strictly in sequence.
  3. Agile Working software is delivered in short iterations Short cycles of working software are what agile means.
  4. Spiral Risk is analysed explicitly in every cycle A risk analysis in each turn is what defines the spiral model.
  5. Spiral Expensive, because every cycle includes a risk review The repeated risk analysis is what makes the spiral model costly.
  6. Spiral Excellent for large, high risk projects Spiral was designed for big projects where risk must be managed.
  7. Agile Lighter documentation can make maintenance harder Agile writes less documentation, a real trade off for long term maintenance.
  8. Spiral Needs genuine risk assessment expertise The spiral model only works if someone can assess risk properly.
  9. Waterfall A late change of requirement is very costly Earlier stages have to be revisited, which is waterfall's great weakness.
  10. Waterfall Suits fixed requirements in a safety critical system Stable requirements and full documentation at each stage suit waterfall.
  11. Waterfall The client sees nothing working until late Working software only appears once implementation is reached.
  12. Agile Copes well with changing requirements Each iteration can take in what the customer has learned.

Code Word

  1. TOKEN A keyword, identifier or operator produced by lexical analysis.
  2. LINKER Combines compiled object code with the library code a program uses.
  3. SPIRAL A methodology that analyses risk in every cycle.

Link Up

  • Stages of compilation Lexical analysis; Syntax analysis; Code generation; Optimisation
  • Made by a compiler Tokens; Symbol table; Syntax tree; Object code
  • Methodologies Waterfall; Spiral; Agile; Extreme programming

Bug Hunt: the wrong statement, and why

  1. Optimisation is the first stage of compilation. Optimisation comes last, after code generation. Lexical analysis is first.
  2. An interpreted program runs faster than the same program compiled. Interpreting translates every statement each time it runs, so it is slower. Compiled code runs at full speed.
  3. Dynamic linking makes the executable larger than static linking. Dynamic linking stores only a reference, so the file is smaller. Static linking copies the code in, making it larger.
  4. The linker copies the finished program into memory to run it. That is the loader's job. The linker combines object code with library code.
  5. Agile suits projects where the client cannot be contacted. Agile needs the customer involved throughout. Waterfall suits a client who is not available.

Odd One Out

  1. Waterfall is the odd one out: it goes with Methodologies. The other three: Stages of compilation.
  2. Spiral is the odd one out: it goes with Methodologies. The other three: Made by a compiler.
  3. Object code is the odd one out: it goes with Made by a compiler. The other three: Methodologies.
  4. Agile is the odd one out: it goes with Methodologies. The other three: Made by a compiler.
  5. Tokens is the odd one out: it goes with Made by a compiler. The other three: Methodologies.
  6. Extreme programming is the odd one out: it goes with Methodologies. The other three: Stages of compilation.

Memory Flash

  1. Abstract syntax tree The structure built by parsing the tokens
  2. Linker Joins object code with library code
  3. Spiral Iterative model with risk analysis each cycle
  4. Loader Copies the executable into memory to run
  5. Symbol table Holds identifiers and their attributes
  6. Token A keyword, identifier or operator found by the lexer

Fact or Fib

  1. Fact The loader copies an executable into memory.
  2. Fib Agile methods produce no documentation at all. The fix: Agile produces less documentation, not none, which can make long term maintenance harder.
  3. Fact A library holds subroutines that are already tested.
  4. Fact Spiral analyses risk in every cycle.
  5. Fact Dynamic linking loads the library while the program runs.
  6. Fib Optimisation is the first stage of compilation. The fix: Optimisation comes last, after code generation. Lexical analysis is first.
  7. Fib An interpreted program runs faster than the same program compiled. The fix: Interpreting translates every statement each time it runs, so it is slower. Compiled code runs at full speed.
  8. Fact Lexical analysis turns the source into tokens.
  9. Fib Agile suits projects where the client cannot be contacted. The fix: Agile needs the customer involved throughout. Waterfall suits a client who is not available.
  10. Fact Static linking copies library code into the executable.
  11. Fib The linker copies the finished program into memory to run it. The fix: That is the loader's job. The linker combines object code with library code.
  12. Fib Dynamic linking makes the executable larger than static linking. The fix: Dynamic linking stores only a reference, so the file is smaller. Static linking copies the code in, making it larger.