← AS/A Level

CS · Unit 1

Done

🚀 CS Masterclass: Paradigms & Files

Level up your programming fundamentals with Guru Jazzy! No cap, pure W energy.

Programming Paradigms

ParadigmThe VibeHow It WorksExamples
Low-LevelDirect hardware control. ⚙️Manipulating memory and CPU instructions directly. Fast but complex.Assembly, Machine Code
ImperativeStep-by-step boss. 📋Telling the computer *exactly* how to achieve the result with statements.C, Pascal
Object-OrientedReal-world modeling. 🧱Organizing code into "objects" containing data (attributes) and logic (methods).Java, Python, C++
DeclarativeFocus on the "What". ✨Describing the desired outcome, leaving the "how" to the language engine.SQL, HTML, Prolog

File Management Fundamentals

folder_open Access Types

  • arrow_right_alt
    Sequential FilesRead linearly from start to finish. Good for bulk processing (like logs).
  • gps_fixed
    Random-Access FilesJump directly to specific records using an ID or index. Crucial for databases.

settings_applications File Modes

  • Read Mode (r)Look, don't touch.
  • Write Mode (w)Overwrites existing data.
  • Append Mode (a)Adds to the end safely.

Random Access Lifecycle

Step 1Hash ID
arrow_downward
Step 2SEEK Pointer
arrow_downward
Step 3PUT / GET
arrow_downward
Step 4CLOSEFILE

Exception Handling

An Exception is an unexpected event that disrupts the normal flow of a program (like trying to divide by zero or opening a file that doesn't exist). We use structured blocks to handle these gracefully instead of crashing.

TRY

Contains the "risky" code that might throw an error.

try
  result = 10 / 0;

EXCEPT / CATCH

The safety net. Executes only if an error occurs in TRY.

catch (Exception e)
  print("Can't divide by zero!");

FINALLY

Cleanup crew. Runs no matter what (success or failure).

finally
  closeConnection();

Concept Review

Click a card to flip it and reveal the definition.

Programming Paradigm
A fundamental style or approach to writing computer programs (e.g., Object-Oriented, Imperative).
Random-Access File
A file structure that allows jumping directly to any specific record without reading preceding data.
Record Structure
A composite data type that groups related fields (which can be of different types) into a single unit.
Exception
An event that occurs during program execution that disrupts the normal flow of instructions.

Knowledge Check

1. What command is used to move the read/write pointer to a specific location in a Random-Access File?

2. SQL and HTML are examples of which programming paradigm?