Pass path: Learn the ANSI flowchart symbols and the structure of a C program in Part 1 and Part 2. Top path: Study compilation pipeline mechanics, linker vs loader responsibilities, and debugging strategies in Part 3 and Part 4.
Part 1: Core Concepts (2 Marks)
- ★ Algorithm: A finite, unambiguous, step-by-step sequence of computational instructions that takes zero or more inputs and terminates within finite time, producing at least one defined output.
- ★ Structured Programming: A programming paradigm emphasizing modular code organized into functional blocks using single-entry/single-exit control structures (sequence, selection, iteration), strictly avoiding unstructured jumps (
goto). - ★ Flowchart: A standardized graphical representation of an algorithm displaying the sequential flow of execution through ANSI symbols connected by directional flowlines.
Part 2: Structural Frameworks (10 Marks)
1. ANSI Standard Flowchart Symbols
Flowchart Blueprint Symbols
When asked to present the standard blueprint symbols utilized in algorithmic flowcharts:
- Terminal (Oval / Rounded Rectangle): Denotes the unequivocal start or termination point of the program logic (
Start,Stop,End). - Input / Output (Parallelogram): Represents any data acquisition operation from the user (
Input N,Read A, B) or result presentation on the screen (Print Sum,Display Average). - Process (Rectangle): Indicates arithmetic computations, data assignments, or variable initialization (
Sum = A + B,i = 1,Tax = Gross * 0.15). - Decision / Branching (Diamond): Represents a conditional logical evaluation that produces exactly two outgoing path options based on boolean criteria (
Is A > B?True / False). - Connector (Circle): Connects intersecting or complex flowlines on the same page, preserving visual clarity without messy line overlaps.
2. The Complete Compilation Pipeline in C
When explaining how a C program transforms from source code to execution:
- Source Code (
.c): Human-readable high-level C code written in an editor. - Preprocessor: Processes directives beginning with
#(#include,#define), expanding macro constants and copying header file declarations into expanded source code (.i). - Compiler: Translates preprocessed source code into platform-specific assembly language instructions (
.s), performing syntax and lexical analysis. - Assembler: Converts assembly instructions into machine-level binary object files (
.obj/.o), leaving library references unresolved. - Linker: Combines the object file with compiled C runtime library functions (e.g.,
printfimplementation inlibc) to generate a standalone executable file (.exe). - Loader: Operating system module that copies the executable from secondary storage into main RAM, allocates memory segments (code, data, stack, heap), and transfers CPU control to
main().
Part 3: Distinction Tables
Programming Approaches: Top-Down vs. Bottom-Up Design
| Dimension | Top-Down Programming (e.g., Structured C) | Bottom-Up Programming (e.g., OOP in Java/C++) |
|---|---|---|
| Architectural Focus | Breaks the main problem downward into smaller subroutines | Builds low-level modules first, combining them into systems |
| Primary Decomposition | Functions, procedures, and modules | Classes, encapsulated objects, and interfaces |
| Data Flow & Security | Global data moves freely between functions; low security | Data is encapsulated within objects; private data hiding |
| Code Reusability | Limited; tightly coupled to specific function logic | High reusability achieved through inheritance and polymorphism |
Part 4: Worked Problems & Exam Traps
Types of Programming Errors in C
- Syntax Errors: Violations of C grammar rules detected by the compiler before execution (e.g., missing semicolon
;, undeclared identifier). - Runtime Errors: Errors causing abrupt program crashes during execution (e.g., division by zero
x / 0, segmentation fault from dereferencing a null pointer). - Logical Errors: The program compiles and executes without crashing, but yields mathematically incorrect results due to flawed algorithm design (e.g., writing
while(i > 10)instead ofwhile(i < 10)).
Students lose marks here because they draw generic non-standard shapes for flowchart decisions, and confuse the Linker (combines object files with libraries) with the Loader (loads executables into RAM).