Programming Language and Basic Language – JSS2 Computer Studies Lesson Note (Second Term)
Download this term · ₦1,000Lesson note at a glance
- Subject
- Computer Studies
- Class
- JSS2
- Term
- Second Term
- Topic
- Programming Language and Basic Language
- Order
- Topic 1 of 6 this term
- Reading time
- 5 min
A programming language is a set of words and grammatical rules used to instruct a computer to perform specific tasks.
Behavioural objectives
By the end of the lesson, students should be able to:
- define a programming language and give examples;
- distinguish between machine language, low-level language and high-level language;
- list the elements required to construct a BASIC program;
- use the QBasic math operators and the order of operation;
- store the results of calculations in variables;
- print the result of the calculations.
What is a programming language?
A programming language is a vocabulary and a set of grammatical rules for instructing a computer to perform specific tasks.
- Keywords: the words a language understands, such as PRINT and INPUT in BASIC.
- Syntax: the special rules for writing and organising program instructions.
- Program: a set of instructions written in a programming language.
- Programmer: the person who writes the program.
What are examples of programming languages?
- BASIC: a simple language for beginners. The name means Beginner’s All-purpose Symbolic Instruction Code.
- C and C++: general-purpose high-level languages.
- COBOL: used mainly for business data processing.
- FORTRAN: used mainly for science and engineering calculations.
- Pascal: often used to teach programming.
- Ada: a high-level language used in many technical systems.
What are the types of programming language?
There are three types of programming language: machine language, low-level language and high-level language.
What is machine language?
Machine language is a programming language that a computer can directly understand and obey without translation.
- Binary form: it is made up of only two characters, 0 and 1.
- Machine dependent: each type of CPU has its own machine language.
- Hard for people: it is difficult for humans to read and understand.
What is a low-level language?
A low-level language is a programming language whose commands map closely to the instructions of the computer’s processor.
- Little abstraction: it provides little or no distance from the computer’s instruction set.
- Examples: machine code and assembly language.
- Assembly language: uses short code words instead of 0s and 1s, so it needs translation into machine code.
What is a high-level language?
A high-level language is a programming language that is close to human language and far from machine language.
- Machine independent: programs are more or less independent of a particular type of computer.
- Easy to read and write: the words are close to English.
- Needs translation: a compiler or an interpreter converts it to machine language.
- Examples: BASIC, C, FORTRAN and Pascal.
What is the difference between the three types of language?
| Feature | Machine language | Low-level language | High-level language |
|---|---|---|---|
| Form | 0s and 1s | Code words or 0s and 1s | English-like words |
| Translation needed | No | Yes, for assembly language | Yes |
| Ease of use | Very difficult | Difficult | Easy |
| Depends on CPU | Yes | Yes | No, mostly |
| Example | Binary code | Assembly language | BASIC, Pascal |
What are the elements of QBasic?
The elements required to construct a BASIC program are the character set, keywords, constants, variables, operators and expressions.
1. What is the character set?
The character set is the group of symbols that BASIC recognises.
- Alphabets: small and capital letters.
- Numbers: the digits 0 to 9.
- Special characters: symbols such as + – * / ( ) and $, each with its own meaning and function.
2. What are keywords?
Keywords are words that have special meanings in BASIC.
- Kinds: statements, reserved words, commands and names of operators.
- CLS: clears the screen.
- REM: adds a remark that the computer ignores.
- INPUT: collects data typed by the user.
- LET: gives a value to a variable.
- PRINT: displays output on the screen.
- Others: FOR, DO, SELECT, MID$, ASC, SQR, LEN, LEFT$, TIME$ and INT.
3. What are constants?
Constants are data or values in a program that cannot be changed during program execution.
- String constant: letters, words or symbols in quotation marks, such as “LAGOS”.
- Numeric constant: a number, such as 25 or 3.5.
4. What are variables?
A variable is a named place that stores data needed in a program.
- String variable: stores text. Its name ends with $, as in NAME$.
- Numeric variable: stores numbers, as in A or TOTAL.
- Naming rule: a variable name starts with a letter and must not be a keyword.
- Value: the stored value can change while the program runs.
5. What are operators?
Operators are symbols that tell BASIC the type of operation to perform on data.
- Arithmetic operators: do calculations, such as + and *.
- Relational operators: compare values, such as =, <, > and <>.
- Logical operators: combine conditions, such as AND, OR and NOT.
- String operators: join text, using the + sign.
6. What are expressions?
An expression is a combination of constants, variables and operators that gives a value.
- Example: A + B * 2 is an expression.
What are the QBasic math operators?
A math operator is a symbol used for addition, subtraction, multiplication, division or other calculations.
| Symbol | Meaning | Example |
|---|---|---|
| * | Multiplication | 4 * 3 = 12 |
| / | Division | 95 / 2 = 47.5 |
| + | Addition | 4 + 3 = 7 |
| – | Subtraction | 4 – 3 = 1 |
| ^ | Exponentiation | 2 ^ 3 = 8 |
| \ | Integer division | 95 \ 2 = 47 |
| MOD | Modulus (remainder) | 95 MOD 2 = 1 |
What is integer division?
Integer division (\) divides one number by another and gives only the whole-number part of the answer.
- Ordinary division: 95 / 2 gives 47.5.
- Integer division: 95 \ 2 gives 47, with no decimal part.
- Decimal numbers: QBasic rounds each number to a whole number before dividing.
| Formula | Result |
|---|---|
| 8\2 | 4 |
| 95\2 | 47 |
| 95.0\2 | 47 |
| 95\2.0 | 47 |
| 95.0\2.0 | 47 |
What is the order of operation in QBasic?
The order of operation is the sequence in which QBasic works out the operators in an expression.
| Order | Operation |
|---|---|
| 1st | Brackets ( ) |
| 2nd | Exponentiation ^ |
| 3rd | Multiplication * and division /, left to right |
| 4th | Integer division \ |
| 5th | MOD |
| 6th | Addition + and subtraction -, left to right |
- 2 + 3 * 4: multiplication first, so the answer is 14.
- (2 + 3) * 4: brackets first, so the answer is 20.
- 20 / 4 + 2: division first, so the answer is 7.
How do you store and print the result of a calculation?
You store a result by assigning it to a variable with LET, then display it with PRINT.
- Type CLS to clear the screen.
- Give values to variables using LET.
- Write an expression and store its result in a new variable.
- Use PRINT to display the variable.
- Press F5 to run the program.
| Program line | What it does |
|---|---|
| CLS | Clears the screen |
| LET A = 10 | Stores 10 in A |
| LET B = 4 | Stores 4 in B |
| LET TOTAL = A + B | Adds A and B, then stores 14 in TOTAL |
| PRINT TOTAL | Displays 14 |
| END | Ends the program |
Evaluation
- What is a programming language?
- Give three examples of programming languages.
- What is machine language?
- Name the four types of operators in BASIC.
- What is the result of 95\2 in QBasic?
Assignment
- List the elements required to construct a BASIC program, then write the seven QBasic math operators with their meanings.
This term's Computer Studies topics
JSS2 Second Term · 6 topics
- Programming Language and Basic Language
- Example of Basic Programming Language
- Graphics Packages and Features
- Graphics Packages: Paint Environment
- ICT as a Transformation Tool
- Benefit of ICT Gadget
Get Computer Studies as PDF and Word
Every week of JSS2 Computer Studies, Second Term, formatted and ready to print. Ad-free, and the copy lock comes off.
Get this term Card, bank transfer, USSD or OPay

