Basic Programme
Download the Lessonotes Mobile Nigeria 2025 app for faster lesson access on Android and iPhone.
Subject: Information Technology (IT)
Class: Junior Secondary 2
Term: 2nd Term
Week: 1
Theme: Basic Computer Operations And Concepts
This page supports the lesson note with a companion video and a short classroom-ready summary.
For class groups and homework, share this lesson page so learners also get the summary, objectives, and full lesson context.
state the meaning of the acronym BASIC; list key statements of BASIC; write a simple BASIC program.
A. Meaning of BASIC BASIC is an acronym that stands for Beginner's All-purpose Symbolic Instruction Code. It was developed in 1964 by John
G. Kemeny and Thomas
E. Kurtz at Dartmouth College in the US
A. Purpose: BASIC was designed to be a simple, easy-to-learn programming language, particularly for students and beginners who had no prior experience with computers. Its primary goal was to enable non-science students to use computers.
Significance: While modern programming languages are more advanced, BASIC laid the groundwork for many programming concepts and is still valuable for teaching the fundamentals of structured thought processes required for coding. B. Structure of a BASIC Program A BASIC program is a series of instructions given to the computer to perform a specific task. Each instruction (or statement) is typically preceded by a line number.
Line Numbers: Each line in a BASIC program must begin with a unique integer (whole number), typically in increments of 10 (e.g., 10, 20, 30...). This allows for easy insertion of new lines of code between existing ones later. The computer executes instructions in ascending order of line numbers.
Statements: These are the actual commands or instructions given to the computer. C. Key Statements of BASIC For Junior Secondary 2, focus will be on the most fundamental statements.
1. PRINT Statement: Function: Used to display text, numbers, or the value of a variable on the screen. It is the primary output statement.
Syntax: `PRINT "text"`, `PRINT variable`, `PRINT expression`
Examples: `10 PRINT "WELCOME TO BASIC PROGRAMMING"` (Displays the text in quotes) `20 PRINT 123` (Displays the number 123) `30 PRINT A` (Displays the value stored in the variable A)
2. INPUT Statement: Function: Used to get data from the user during program execution. The program will pause and wait for the user to type in a value and press Enter. This value is then stored in a specified variable.
Syntax: `INPUT variable` or `INPUT "prompt message"; variable` Variables: A variable is a named storage location in memory that holds a value. In BASIC, variables usually start with a letter. String variables (for text) end with a dollar sign `$` (e.g., `NAME$`, `CITY$`). Numeric variables (for numbers) do not have a suffix (e.g., `AGE`, `SCORE`, `PRICE`).
Examples: `10 INPUT NAME$` (Asks the user to enter text and stores it in `NAME$`) `20 INPUT "Enter your age: "; AGE` (Displays "Enter your age: " then waits for input, storing it in `AGE`)
3. LET Statement: Function: Used to assign a value to a variable. It is often used for calculations or initialising variables. The `LET` keyword is optional in many BASIC versions (e.g., `A = 10` works instead of `LET A = 10`).
Syntax: `LET variable = value` or `LET variable = expression`
Examples: `10 LET X = 100` (Assigns the value 100 to the variable X) `20 LET NAME$ = "Bola"` (Assigns the text "Bola" to the string variable NAME$) `30 LET SUM = A + B` (Calculates the sum of A and B and stores it in SUM)
4. REM Statement (Remark): Function: Used to add comments or remarks within a program. These lines are ignored by the computer during execution but are very important for programmers to understand what different parts of the code do. It helps in program documentation and readability.
Syntax: `REM comment text`
Examples: `10 REM This program calculates the area of a rectangle` `20 REM Get input from the user`
5. END Statement: Function: Marks the logical and physical end of a BASIC program. When the computer encounters this statement, it stops execution.
Syntax: `END`
Example: `90 END` (Often the last statement in a program)
D. Writing a Simple BASIC Program Example 1: Displaying a Greeting Message Problem: Write a BASIC program to display the message "Welcome to the world of BASIC programming!" Solution: ```basic 10 REM Program to display a welcome message 20 PRINT "Welcome to the world of BASIC programming!" 30 END ``` Explanation: `10 END Statement: Function: Marks the logical and physical end of a BASIC program. When the computer encounters this statement, it stops execution.
Syntax: `END`
Example: `90 END` (Often the last statement in a program)
D. Writing a Simple BASIC Program Example 1: Displaying a Greeting Message Problem: Write a BASIC program to display the message "Welcome to the world of BASIC programming!" Solution: ```basic 10 REM Program to display a welcome message 20 PRINT "Welcome to the world of BASIC programming!" 30 END ``` Explanation: `10 REM`: A comment explaining the program's purpose. `20 PRINT`: Displays the enclosed text on the screen. `30 END`: Terminates the program.
Example 2: Accepting Input and Displaying a Personalised Greeting (Nigerian Context)
Problem: Write a BASIC program that asks the user for their name, accepts it, and then displays a personalized greeting like "Hello, [Name]! Welcome to our JSS 2 IT class." Solution: ```basic 10 REM Program to get user name and display a greeting 20 INPUT "Please enter your name: "; USERNAME$ 30 PRINT "Hello, "; USERNAME$; "! Welcome to our JSS 2 IT class." 40 END ``` Explanation: `10 REM`: Comment indicating the program's function. `20 INPUT`: Displays the prompt "Please enter your name: " and waits for the user to type their name. The entered name is stored in the string variable `USERNAME$`. `30 PRINT`: Displays "Hello, " then the value stored in `USERNAME$`, then "! Welcome to our JSS 2 IT class." The semicolons (`;`) are used to concatenate (join) different parts of the output on the same line. `40 END`: Ends the program execution.
Example 3: Calculating the Sum of Two Numbers Problem: Write a BASIC program that takes two numbers from the user and calculates their sum, then displays the result.
Solution: ```basic 10 REM Program to calculate the sum of two numbers 20 INPUT "Enter the first number: "; NUM1 30 INPUT "Enter the second number: "; NUM2 40 LET SUM = NUM1 + NUM2 50 PRINT "The sum is: "; SUM 60 END ``` Explanation: `10 REM`: Comment for program description. `20 INPUT NUM1`: Prompts for and stores the first number in `NUM1`. `30 INPUT NUM2`: Prompts for and stores the second number in `NUM2`. `40 LET SUM = NUM1 + NUM2`: Adds the values of `NUM1` and `NUM2` and stores the result in the numeric variable `SUM`. `50 PRINT`: Displays "The sum is: " followed by the calculated value of `SUM`. * `60 END`: Ends the program.
Teacher Activities: Introduction (10 minutes): Begin by asking students what they understand by "programming" or "giving instructions to a computer." Relate it to giving instructions to a younger sibling or a cook. Introduce BASIC as a very simple language designed for beginners. Write the acronym BASIC on the board and ask students to guess what each letter might stand for.
Reveal the full meaning: Beginner's All-purpose Symbolic Instruction Code. Explain its historical context and purpose (ease of learning).
Explanation of Key Concepts (20 minutes): Line Numbers: Explain the concept of line numbers and their importance in ordering program instructions. Demonstrate writing a simple program structure with line numbers (e.g., `10 ...`, `20 ...`).
PRINT Statement: Explain its function.
Write examples on the board: `PRINT "Hello"`, `PRINT 50`, `PRINT A`. Ask students what each would display.
INPUT Statement: Explain its function (getting data from the user). Introduce numeric and string variables, explaining the `$` suffix for strings.
Provide examples: `INPUT NAME$`, `INPUT AGE`. Demonstrate with a "prompt" message.
LET Statement: Explain its function for assigning values and performing calculations.
Provide examples: `LET X = 10`, `LET SUM = A + B`. Mention that `LET` is often optional.
REM Statement: Explain its use for comments and documentation, emphasising that the computer ignores it.
END Statement: Explain its role in marking the program's termination. Demonstration of Program Writing (15 minutes): Using the whiteboard or a projector (if available, using a simple BASIC interpreter like QB64 or FreeBASIC on a PC), demonstrate writing the "Personalised Greeting" program (Example 2 from Section 2D) step-by-step. Start with `REM` for program description. Add `INPUT` to get the name. Add `PRINT` to display the greeting. Add `END`. "Run" the program mentally with the students, asking them what they expect to see at each step. If a computer is available, run it live. Demonstrate the "Sum of Two Numbers" program (Example 3 from Section 2D), highlighting how `LET` is used for calculation.
Student Activities: Active Listening and Note-Taking: Students will listen attentively to explanations and take notes on the meaning of BASIC and the functions of the key statements (`PRINT`, `INPUT`, `LET`, `REM`, `END`).
Question and Answer: Students will ask clarifying questions and answer questions posed by the teacher regarding the functions of BASIC statements. Tracing Programs (Individual/Pair Work - 15 minutes): The teacher writes 2-3 simple BASIC programs (similar to the examples in Section 2D but slightly varied) on the board. Students, individually or in pairs, will "trace" the program execution on paper, writing down what each line does and what the final output would be.
Example: ```basic 10 REM Trace this program 20 LET A = 5 30 LET B = 7 40 LET C = A * B 50 PRINT "The product is: "; C 60 END ``` Students would write: 10: Comment, ignored. 20: A becomes 5. 30: B becomes 7. 40: C becomes 5 7 = 35. 50: Display "The product is: 35". 60: Program ends.
Group Program Writing (10 minutes): Divide students into small groups. Assign each group a simple task to write a BASIC program for (e.g., "Ask for favourite food and display it," "Calculate the difference between two numbers"). Groups will write their programs on paper or small whiteboards. Selected groups will present their programs to the class.
Task 1: What does the acronym BASIC stand for?
Solution: BASIC stands for Beginner's All-purpose Symbolic Instruction Code.
Commentary: This directly addresses the first performance objective, ensuring students recall the fundamental definition.
Task 2: List three key statements in BASIC and briefly describe their functions.
Solution: PRINT: Used to display text, numbers, or variable values on the screen.
INPUT: Used to get data (text or numbers) from the user during program execution.
LET: Used to assign a value to a variable or to perform calculations and store the result in a variable. (Other acceptable answers include REM for remarks and END for program termination).
Commentary: This assesses understanding of core BASIC commands and their purposes, linking to the second performance objective.
Task 3: Write a simple BASIC program that asks a user for their village name in Nigeria, and then displays a message like "Welcome to [Village Name], a beautiful place!" Solution: ```basic 10 REM Program to greet user with their village name 20 INPUT "What is the name of your village in Nigeria? "; VILLAGE_NAME$ 30 PRINT "Welcome to "; VILLAGE_NAME$; ", a beautiful place!" 40 END ```
Commentary: This exercise integrates the `INPUT` and `PRINT` statements, using a relevant Nigerian context, and directly targets the third performance objective (writing a simple program). It checks variable handling for strings.
Task 4: Write a BASIC program that calculates the simple interest on a principal amount. The program should take the principal (P), rate (R), and time (T) as input, then calculate and display the simple interest. (Formula: SI = P R T / 100).
Solution: ```basic 10 REM Program to calculate Simple Interest (SI) 20 INPUT "Enter Principal Amount (e.g., 5000): "; P 30 INPUT "Enter Interest Rate (e.g., 10 for 10%): "; R 40 INPUT "Enter Time in Years (e.g., 2): "; T 50 LET SI = (P R T) / 100 60 PRINT "The Simple Interest is: N"; SI 70 END ```
Commentary: This program combines `INPUT`, `LET` for calculations, and `PRINT` for output. It demonstrates the use of numeric variables and arithmetic operations, addressing the third objective with a practical financial calculation relevant to Nigeria. The `N` prefix for Naira is a nice touch for local context.
Basic Automation and Calculation in Local Businesses: Simple BASIC-like logic is used in everyday applications like calculating bills at a local restaurant or market stall, or tracking inventory in a small shop in a Nigerian community. Understanding BASIC helps students appreciate the underlying logic of these basic systems that automate calculations and data entry. For example, a POS (Point of Sale) system uses similar logic to take item prices and quantity to calculate a total bill. Foundational for App Development and Digital Innovation: While BASIC itself is not used for modern app development, its principles (sequence, input, output, variables, simple logic) are foundational to all programming languages. Students learning BASIC are taking their first step towards understanding how apps on their phones or web applications are built. This understanding can inspire future Nigerian software developers and tech entrepreneurs who can create solutions for local challenges (e.g., apps for farmers, local marketplaces, e-health platforms).
Understanding Device Instructions: Many everyday electronic devices, from simple calculators to ATMs and ticketing machines at Nigerian transport hubs, operate based on a sequence of instructions (a program). Learning BASIC helps students demystify these devices, understanding that they are simply executing predefined steps, often involving inputs, calculations, and outputs. This reduces technophobia and encourages critical thinking about technology.