Library › Computer Science 9618 › Further Programming
AS Level · Computer Science 9618

Further Programming

Revise Further Programming for Computer Science 9618 (AS Level) — revision notes and instant AI marking.

📖 Revision notes · preview
  Cambridge International AS & A Level Computer Science (9618)

Further Programming

The big idea: A programming paradigm is a way of thinking about a program: as machine instructions, as a sequence of procedures, as objects that hold data and behaviour, or as facts and rules that answer questions. A Level also asks you to keep data in files and to keep programs running when something goes wrong.

Summary — What This Chapter Covers
  • A programming paradigm is a style or approach to programming with its own concepts and structure.
  • Low-level programming uses assembly language with immediate, direct, indirect, indexed and relative addressing.
  • Imperative (procedural) programs are sequences of statements that change variables, organised into procedures and functions.
  • Object-oriented programming uses classes, objects, attributes, methods, encapsulation, getters and setters, inheritance, polymorphism and containment.
  • Declarative programs state facts and rules; a query (goal) is answered by matching them.
  • Files are opened for READ, WRITE, APPEND or RANDOM, and closed when finished; random files use SEEK, GETRECORD and PUTRECORD.
  • An exception is an unexpected event at run time; exception handling traps it so the program can recover instead of crashing.
1. Paradigms and Low-level Programming
20.1

Addressing modes

A programming paradigm is a fundamental style of programming: the way a problem is broken down and the concepts a language provides to express it. The four in this syllabus are low-level, imperative (procedural), object-oriented and declarative.

Low-level programming uses assembly language: each instruction matches one machine code instruction and works directly with memory and registers (here a single accumulator, ACC, and an index register, IX).

ModeHow the operand is usedExample
Immediatethe operand is the value itselfLDM #200: ACC ← 200
Directthe operand is the address of the valueLDD 200: ACC ← contents of 200
Indirectthe operand is an address that holds the address of the valueLDI 200: go to 200, read an address, load the contents of that address
Indexedthe address is the operand + the contents of the index registerLDX 201: ACC ← contents of (201 + IX)
Relativethe address is an offset from a base address, usually the address of the current instruction, so the code works wherever it is loadedan instruction at address 150 with relative operand 6 refers to address 156
Worked Example
Memory: address 200 contains 203, 201 contains 15, 202 contains 9, 203 contains 41, 204 contains 27. IX contains 3. Give the contents of ACC after each instruction: LDM #200, LDD 200, LDI 200, LDX 201.
Worked Example
Trace this program. NUMS is followed by two more data locations, so NUMS, NUMS + 1 and NUMS + 2 hold 5, 9 and 4. What is in TOTAL at the end?
        LDR #0
LOOP:   LDX NUMS
        ADD TOTAL
        STO TOTAL
        INC IX
        LDD COUNT
        INC ACC
        STO COUNT
        CMP #3
        JPN LOOP
        END
NUMS:   5
        9
        4
TOTAL:  0
COUNT:  0
2. Imperative (Procedural) Programming
20.1

Statements, variables, procedures

imperative how Procedural

Practice Question
parent(fatima, ali). FOR Count ← 1 TO 20 … NEXT Count LDD Counter / INC ACC / STO Counter CLASS Vehicle … ENDCLASS
4. Declarative Programming
20.1
🔓 Read the full Further Programming note → You're seeing the preview · sign in to read it all
Also in the full note
  • Classes, objects, inheritance, polymorphism
  • Facts, rules and goals
  • Text files and random files
  • Trapping run-time errors
What's inside
📖 Revision notes 🎯 Learn mode ✦ AI flashcards ✓ Instant AI marking 🧊 3D explorers 🧪 Experiments & simulations 📈 Progress tracking
📄 Practise Further Programming with Computer Science 9618 past papers Every paper with its mark scheme — answer online, marked instantly. Open →

Read the full Further Programming notes free

That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.

Unlock the full notes free →

More Computer Science topics