Lesson Notes By Weeks and Term - Senior Secondary 1

BASIC programming language II

Term: 2nd Term

Week: 12

Class: Senior Secondary School 1

Age: 16 years

Duration: 40 minutes of 2 periods each

Date:       

Subject:      Computer Studies and ICT

Topic:-       Introduction to BASIC programming II

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

  1. Explain what functions are in BASIC programming
  2. State and explain the types of BUILT-IN functions in BASIC
  3. Define library functions and how they are used.

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 introduction to BASIC programming

Students pay attention

STEP 2

EXPLANATION

He explains the meaning of function in BASIC. He states and explains the types of BUILT-IN functions in BASIC

 

Students pay attention and participates

STEP 3

DEMONSTRATION

He further explains what library functions are and how they are used

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

THE BASIC BUILT-IN FUNCTIONS

BASIC built-in functions are functions that perform a wide range of operations in BASIC.

 

A function in BASIC is a structure that simplifies a complex operation into a single step. They act as “black boxes” that accept some input value or values and process that input in a defined manner to produce or “return’” an output value.

 

For example, in the process of taking the square root of a numeric value, if this has to be defined in the program every time a square root is needed, extra code will always be repeated and this can be tiring. But the entire square root operation has now been compressed into a single step using the SQR function as shown below:

DO

INPUT PROMPT “Enter a number:” “:n”

IFn<0 then EXIT DO

RINT “The square root of”; n; “is”; Sqr(n) LOOP

END

Note that the SQR function displays the square root of a numeric value provided by the user.

 

TYPES OF BASIC BUILT-IN FUNCTIONS

  1. Numeric functions
  2. String Functions
  3. Time and Date Functions

1. Numeric Functions: These are Functions that are designed to return the answer or value as a number.

 

  1. SQR(X): This is used to find the square root of a number.
  2. SIN(X): This is used to find the sine of an angle.
  3. COS(X): This is used to find the cosine of an angle.
  4. TAN(X): This is used to find the tangent of an angle.
  5. ABS(X): This is used to find the absolute value of a number.
  6. EXP(X): This is used to find the exponential value of a number.
  7. INT(X): This is used to find the integer of a real number.
  8. RND(X): This is used to find the random value of a number
  9. LOG(X): This is used to find the natural logarithm of a number.

Note that X is the value to be found.

2. String Functions: These are functions that are designed for string manipulations. E.g.

  1. LEFT$()
  2. RIGHT$()
  3. MID$

3. Time and Date Functions: These functions return the time and date known by the system. If the current time and date are entered during the system Startup, the correct time and date will be given.

  1. Time (): This shows the current time including units.
  2. Years (): This shows the current time in years.
  3. Mins (): This shows the current time in minutes.

LIBRARY FUNCTIONS

A library is a file that contains any number or external procedures ( functions, subroutines or pictures) or modules, but no main program .

A library function is the collection of the modules and functions that are stored in the file library.

Importance of Library Functions

  1. Any program can use the procedures and modules in a library without having toDuplicate any code.
  2. Libraries can be compiled separately from the main program.
  3. Uncompiled programs can use compiled versions of libraries which reduce the time it takes your program to begin running by decreasing the amount of code that must be compiled.

How Library Functions are Used

Each library file must begin with an EXTERNAL statement as its first non-comment line. The EXTERNAL statement tells BASIC not to look for a main program in the current file, allowing the library to be compiled separately from the main program

File. Because no main programs are allowed, a library may not contain an END statement.

 

EVALUATION:    1. Define BASIC BUILT-IN functions

  1. State and explain the types of BASIC BUILT-IN      functions
  2. Describe what library functions are and what they are      used for

CLASSWORK: As in evaluation

CONCLUSION: The teacher commends the students positively