Languages, algorithms, flowcharts and BASIC programming
JAMBWAECNECO
What the syllabus asks
JAMB: Section G Developing problem-solving skills 1 Programming languages (machine, assembly, high-level: BASIC, C, Java, Fortran 2008, Python, Perl; advantages and disadvantages); 2 High-level languages (classifications; characteristics; translators: interpreters, compilers); 3 Algorithms and flowcharts (definitions; functions; properties: input, output, definiteness, effectiveness, finiteness;…
WAEC: Programming languages (ML, LLL, HLL; classification; features of BASIC, C, Pascal, COBOL); algorithm and flowchart (average of a set, y=a(b-c)²/(d+2), first ten odd numbers); BASIC (acronym, characteristics, data types, INPUT, PRINT, LPRINT, LET, END, REM, READ, DATA; operators; expressions; area of triangle and rectangle, average of 3; built-in functions SQR, INT, SIN, ABS, RND, COS, TAN, LOG,…
NECO: Programming languages (ML, LLL, HLL; classification; features of BASIC, C, Pascal, COBOL); algorithm and flowchart (average of a set, y=a(b-c)²/(d+2), first ten odd numbers); BASIC (acronym, characteristics, data types, INPUT, PRINT, LPRINT, LET, END, REM, READ, DATA; operators; expressions; area of triangle and rectangle, average of 3; built-in functions SQR, INT, SIN, ABS, RND, COS, TAN, LOG,…
What you will learn
- Define program and programming language; describe machine, assembly and high-level languages with advantages and disadvantages.
- Classify high-level languages and compare BASIC, C, Pascal and COBOL.
- Explain how compilers and interpreters work and give examples.
- Define algorithm, state its functions and properties, and write the WAEC set algorithms.
- Identify flowchart symbols and draw flowcharts for given problems.
- State what BASIC stands for, its characteristics and data types.
- Use INPUT, PRINT, LPRINT, LET, REM, READ, DATA and END correctly.
- Write BASIC forms of mathematical expressions and evaluate them in the correct order.
- Use the built-in functions SQR, INT, ABS, SIN, COS, TAN, LOG, EXP and RND.
- Write loops with FOR…NEXT and WHILE…WEND, and arrays with DIM.
- Describe the characteristics of a good program, the precautions and the steps of program development, including desk checking.
Key points
- A program is a set of instructions; a programming language is the notation used to write it.
- Machine language (binary, fastest, hardest), assembly (mnemonics, assembler), high-level (English-like, portable, needs a compiler or interpreter).
- HLL classes: scientific (FORTRAN), business (COBOL), general purpose (BASIC, Pascal, C, Python), AI (LISP, Prolog), string processing (SNOBOL), object-oriented, scripting.
- Compiler: whole program → object code, fast runs; interpreter: line by line, stops at the first error. BASIC interpreted; COBOL, FORTRAN compiled.
- Algorithm: finite, ordered, unambiguous steps; properties: input, output, definiteness, effectiveness, finiteness.
- Flowchart symbols: oval (start/stop), parallelogram (I/O), rectangle (process), diamond (decision), circle (connector), arrows.
- BASIC = Beginner’s All-purpose Symbolic Instruction Code; Kemeny and Kurtz, Dartmouth, 1964.
- Data: numeric and string constants; numeric variables (A) and string variables (A$).
- Statements: REM, LET, INPUT, PRINT, LPRINT, READ/DATA, IF…THEN, GOTO, FOR…NEXT, WHILE…WEND, DIM, END.
- Order: brackets, ^, * and /, + and −; left to right for equal priority.
- Functions: SQR, INT (rounds down), ABS, SIN/COS/TAN (radians), LOG (natural), EXP, RND.
- Sum of 1 to 100 = 5050; ten odd numbers 1–19 by 2I − 1; INT(X + .5) rounds.
- Arrays need DIM; subscript selects an element; loops input, output and process arrays.
- Good program: accurate, readable, maintainable, efficient, general, clear.
- Development steps: definition, analysis, design, desk checking, coding, compilation, testing/debugging, documentation, maintenance.
Start here: Programs and levels of programming language
A program is a set of instructions, written in the right order, that tells a computer how to carry out a task or solve a problem. A programming language is a set of words, symbols and grammar rules (syntax) for writing those instructions. Writing programs is programming, and the person is a programmer.
1. Machine language (ML), first generation
Instructions written entirely in binary, e.g. 100011001 (WAEC’s example). Each processor family has its own machine code. Advantages: executed directly with no translation, so it runs fastest; uses memory efficiently. Disadvantages: very hard to write, read and debug; the programmer must know the hardware in detail; programs are machine dependent (not portable).
2. Low-level (assembly) language, second generation
Uses short words called mnemonics in place of binary: MOV (move), ADD, SUB, JMP (jump), with symbolic names for memory. An assembler translates it into machine code; JAMB describes assembly as a “thin wrapper” over machine language because each instruction usually matches one machine instruction. Advantages: easier than binary; fast and compact; gives direct control of hardware (used for device drivers and embedded systems). Disadvantages: still machine dependent, tedious and needs a translator.
3. High-level languages (HLL), third generation and above
English-like statements and ordinary mathematical notation, e.g. LET AREA = L * B. Examples: BASIC, FORTRAN, COBOL, Pascal, C, C++, Java, Python, Perl. Advantages: easy to learn, read, write, debug and maintain; machine independent (portable); one statement does the work of many machine instructions; built-in functions and data structures. Disadvantages: must be translated by a compiler or interpreter; the translated program is usually slower and larger than hand-written assembly; less direct hardware control.
| Feature | ML | Assembly | HLL |
|---|---|---|---|
| Form | 0s and 1s | mnemonics | English-like |
| Translator | none | assembler | compiler / interpreter |
| Portability | none | none | high |
| Ease of use | hardest | hard | easiest |
| Speed of execution | fastest | fast | slower |
Fourth-generation languages (4GLs) such as SQL (cs6) let users say what they want rather than how to get it.
Continue this lesson in the free app →
Practice questions
- machine language
- assembly language
- BASIC
- COBOL
Show answer
A: machine language
Low-level, no translation needed.
- Basic Algorithmic System for Instruction Coding
- Binary Assembly Symbolic Interpreted Code
- Beginner’s Automatic Simple Instruction Code
- Beginner’s All-purpose Symbolic Instruction Code
Show answer
D: Beginner’s All-purpose Symbolic Instruction Code
Created at Dartmouth in 1964.
- parallelogram
- oval
- diamond
- rectangle
Show answer
C: diamond
Rectangle = process; parallelogram = input/output.
- circle
- parallelogram
- diamond
- rectangle
Show answer
B: parallelogram
Oval = start/stop; diamond = decision.
- N$
- N
- N%
- N!
Show answer
A: N$
$ marks a string variable.
Key words
- Program
- A set of instructions that directs a computer to solve a problem.
- Programming language
- A formal notation for writing programs.
- Machine language
- Binary instructions the processor executes directly.
- Assembly language
- A low-level language using mnemonics such as ADD and MOV.
- Assembler
- Translates assembly language into machine code.
- High-level language
- A machine-independent, English-like language such as BASIC or Python.
- Compiler
- Translates a whole high-level program into machine code before execution.
- Interpreter
- Translates and executes a program one statement at a time.
- Source program
- The program as written by the programmer.
- Object program
- The machine-code program produced by a compiler.
- Algorithm
- A finite, ordered set of unambiguous steps to solve a problem.
- Flowchart
- A diagram of an algorithm drawn with standard symbols.
The Cara's Tips app teaches every topic from the very basics, with quick checks, worked examples and exam practice. It works offline.
Open this lesson in the free appDownload for Android