# Lesson Notes By Weeks and Term - Senior Secondary 1

BASIC programming language

Term: 2nd Term

Week: 9

Class: Senior Secondary School 1

Age: 15 years

Duration: 40 minutes of 2 periods each

Date:

Subject:                Computer Studies and ICT

Topic:-  BASIC Programming language

SPECIFIC OBJECTIVES: At the end of the lesson, pupils should be able to

1. State the full meaning of BASIC and a brief history of its invention
2. Highlight the basic character set
3. List some arithmetic and relational operators and what they are used for
4. Explain data types, keyword, variables and constant

INSTRUCTIONAL TECHNIQUES: Identification, explanation, questions and answers, demonstration, videos from source

INSTRUCTIONAL MATERIALS: Videos, loud speaker, pictures, Data Processing for senior Secondary Education by Hiit Plc, WAPB Computer Studies for Senior Secondary I by Adekunle et al, On-line Materials.

INSTRUCTIONAL PROCEDURES

PERIOD 1-2

 PRESENTATION TEACHER’S ACTIVITY STUDENT’S ACTIVITY STEP 1 INTRODUCTION The teacher reviews the previous lesson on the BASIC programming languages Students pay attention STEP 2 EXPLANATION He states the full meaning of BASIC and gives a brief history. He highlights the basic character set and arithmetic and relational operators(functions and uses) Students pay attention and participates STEP 3 DEMONSTRATION He further explains what data types, keyword, variables and constant are. Students pay attention and participate STEP 4 NOTE TAKING The teacher writes a summarized note on the board The students copy the note in their books

NOTE

BASIC PROGRAMMING LANGUAGE

The BASIC programming language was developed in 1964 by John G. Kemeny and Thomas Kurtz at Dartmouth College. BASIC is an acronym that stands for “Beginner’s All-Purpose Symbolic Instruction Code”

Basic Character Set

A character set is simply a list of letters, numbers and symbols that provide one with the characters used in a particular language. BASIC as a language has its own character set, they include the following:

• Alphabets characters (A to Z or a to z)
• Numeric character (0, 1 to 9) including hexadecimal characters.
• Special characters that perform special functions in BASIC

Arithmetic operators

 CHARACTER NAME USES * Asterisk For multiplication, e.g. A*B or (3*5) - Minus For subtraction, e.g. M-N or (4-1) + Plus For addition, e.g. K+N or (1+6) / Forward slash For real division, e.g. A/B or (7/3)=2.33 \ Bask slash For integer division, e.g. P\G or (7\3)=2 ^ Caret For exponentiation, e.g. A^B or (7^3)

Relational (Comparison) Operator

 CHARACTER NAME USES = Equal to A=B > Greater than A>B < Less than A = Greater than or Equal to A >=B < = Less than or Equal to A <= B

Data types

Data type is a description of the set of values and the basic set of operation that can be applied to values of the type.

1. i) Integers: a positive or negative number without decimal. It has a range of values from -32,768 to 32,767. Each value is stored using 2 bytes of memory (storage) space.
2. ii) Real numbers: numbers with fractional parts or with a decimal point. It is stored using 4 bytes of memory space.

iii) Boolean: consist of only two values; “YES and NO” or “True or False” or 1 or 0.

1. iv) String: a sequence of characters in double quote. For example, “Computer Studies” is a string value with 16 characters. Each character is stored using 8 bits (one byte) in the ASCII character set and two byte in the UNICODE character set. Alphabet is represented in ASCII.

Keyword

Keywords are words that have special meaning and function in BASIC. Such words must be used strictly according to their functions, otherwise the computer will respond with error message.

Here are some of the BASIC keywords and their uses

 KEYWORDS USES EXAMPLE REM Make comment about an instruction or about the whole program 10 REM Program to add two numbers INPUT Used to ask the user to supply the data to be processed while the program is executing 5 INPUT A,B,C PRINT Used to display the output of operation on the screen PRINT “The values”, A,B LET Used to assign a value to a variable 3 LET A=5 READ Used to tell the computer that the data to be processed is supplied within the program statements. Used together with DATA keyword 10 READ A,B DATA Used to show the computer the data it is asked to read in the READ statement. Used along with READ keyword. 10 DATA 4,7 END To end the program 5 END

Variables and Constant

Variable is an identifier or a name of a memory location where data (values) can be placed or stored. Because the value placed in a memory location can be changed at any time, we call such memory location “a variable”. However, when the value of a memory location is not to be changed, we refer to such memory location as “constant”.

Declaration of Variables and Constants

When you are to supply data to the computer for processing, you are required to state the data type. This help the computer to interpret it and an appropriate storage space is reserved for the data. To achieve this, the keyword DIMENSION (or DIM) is used to specify the data type. For example, variable Name and Pie are to hold “character and real” data values respectively. This can be written in BASIC as follows:

1. DIM Char Name, INT Age, REAL Height
2. DIM Name AS Char, Age AS INT, Height AS Real
3. DIM Name\$, Age%, Height!

Rules for naming Variable

1. Every variable must begin with an English alphabet (A to Z or a to z).
2. The name must not be more than 40 characters in length.
3. Names can be alphanumeric (combinations of alphabet and numbers).
4. Name must not be any keyword
5. Do not include a blank space in the name.

EVALUATION:    1. Write a brief a history on BASIC

1. Discuss the basic character set in BASIC
2. List four each of arithmetic and relational operators in BASIC and discuss what they are used for
3. Write short notes on
4. keyword
5. data types
6. variables
7. constant

CLASSWORK: As in evaluation

CONCLUSION: The teacher commends the students positively