Lesson Notes By Weeks and Term - Senior Secondary School 1

Basic language

TERM: 1st Term

WEEK: 6

CLASS: S.S. 1

DATE:

SUBJECT: Computer Science
TOPIC: Basic language

BASIC LANGUAGE/SIMPLE LANGUAGE

A computer language is a special language understood by a computer. It consists of various commands that we give to the computer to do any work.

BASIC (an acronym for Beginner’s All-purpose Symbolic Instruction Code) is a family of general-purpose, high-level programming languages whose design philosophy emphasizes ease of use.

A computer language is a set of words, symbols and codes that are used to write a computer program. The process of writing these instructions (program) is called PROGRAMMING. The people who write these programs are called PROGRAMMERS.

Human beings understand a variety of spoken languages (English, Hausa, Igbo and so on) but computer cannot understand these languages. Computer can only understand on language, that is the machine language.

Computer uses machine language to carryout their jobs. This language uses binary digits, 0 and 1, which stand for ‘off and on’ condition of the electric current. It is difficult for the programmer to write the program directly in terms of these digits. So, they write their program in a language called Programming Language.

Programming language code programs in such a manner that the computer can understand them and decode (translate) them into its machine language.

CATEGORIES OF PROGRAMMING LANGUAGE

There are a number of programming languages available nowadays. Some languages are developed for specific computer, other were developed for specific uses, such as scientific or business application.

Programming languages are classified into two major categories.

  1. LOW LEVEL LANGUAGE: Low level languages are written to run one particular computer and cannot be easily used on another computer. These languages are difficult for a common programmer to learn
  • Machine Language: A machine language is a language directly understood by a computer without any translator. It refers to 0’s and 1’s that the computers understand as instruction. Due to this reason, it is also called a low level language or the first generation language. Writing or coding of programs in the 1s and 0s of machine can be boring and can take a lot of time.
  • A machine language program written in assembly language uses a short sequence of letter called mnemonic code like A for addition, C for comparison, L for loading and M for multiplying. As the computer only understands machine languages, you have to convert these mnemonic codes to machine language (0s and 1s). To convert these mnemonic codes into machine language requires the use of translators. An assembler is a program used to translate assembly language into machine language so that the computer can understand it.
  1. HIGH LEVEL LANGUAGE: A high level language has the instructions which are similar to English language. It is very user friendly. It is much easier to understand and write with a program using this language. The greatest advantages of these languages are its independence. A program written in HLL can be used on almost all computers without any change. The instructions written in HLL are also converted into machine language with the help of translators. Interpreter and compiler are two program used to translate a high level language into machine language so that the computer can understand it.
  • Third generation language: Third generation language uses English –  like words to make it easy for the programmer to write the program. For example, a programmer writes ADD for addition and PRINT for print. Many third generation language also use arithmetic operation such as * for multiplication and + for addition. A third generation program is called source program, which must be translate into machine language before the computer can understand it. Compiler and interpreters are the program used to perform the translation for third generation language. BASIC, COBOL, PASCAL, and FORTRAN are example third generation language.
  • Fourth generation language: The fourth generation language also uses English like statement. A fourth generation language is fast and requires much less time and effort on the part of the programmer. In fact, fourth generation language is so easy that the user with very little program background can develop programs while using it. VISUAL BASIC, ORACLE, JAVA e.t.c are example of fourth generation language.
  • Natural language: A natural language program does not follow a specific set of rules unlike the fourth generation language. A natural language, sometimes called fifth generation language is a type query language that allows the user to enter request that resembles the speech. Natural languages are often associated with expert system and artificial intelligence.

These systems are popular in the medical field, but are not widely used in business application.

SOME HIGH LEVEL PROGRAMS

  1. BASIC: It stands for Beginner’s all purpose symbolic instruction code. It is a programming language used by beginners
  2. LOGO: It stands for Language of Graphics Oriented. It is a programming language used to draw different shapes and figure.
  3. COBOL: It stands for common business oriented language. This language is specially designed for business application
  4. FORTRAN: It stands for ‘Formula Translation’. It is one of the oldest high level languages. This language was designed to solve scientific problems
  5. C AND C++: They are the general purpose programming languages popular on minicomputer and microcomputer. They are the most widely used language for developing commercial applications.
  6. JAVA: Java is a programming language developed to write programs. It helps in creating games and animation and in developing multimedia effect for the internet.

TYPICAL BASIC KEYWORDS

Data Manipulation

  • LET: assigns a value (which may be the result of an expression) to a variable.
  • DATA: holds a list of values which are assigned sequentially using the READ command.

Program Flow Control

  • IF … THEN … ELSE: used to perform comparisons or make decisions.
  • FOR … TO … {STEP} … NEXT: repeat a section of code a given number of times. A variable that acts as a counter is available within the loop.
  • WHILE … WEND and REPEAT … UNTIL: repeat a section of code while the specified condition is true. The condition may be evaluated before each iteration of the loop, or after.
  • DO … LOOP {WHILE} or {UNTIL}: repeat a section of code Forever or While/Until the specified condition is true. The condition may be evaluated before each iteration of the loop, or after.
  • GOTO: jumps to a numbered or labelled line in the program.
  • GOSUB: jumps to a numbered or labelled line, executes the code it finds there until it reaches a RETURN Command, on which it jumps back to the operator following the GOSUB – either after a colon, or on the next line. This is used to implement subroutines.
  • ON … GOTO/GOSUB: chooses where to jump based on the specified conditions. See Switch statement for other forms.
  • DEF FN: a pair of keywords introduced in the early 1960s to define functions. The original BASIC functions were modelled on FORTRAN single-line functions. BASIC functions were one expression with variable arguments, rather than subroutines, with a syntax on the model of DEF FND(x) = x*x at the beginning of a program. Function names were originally restricted to FN+one letter.

Input and Output

  • PRINT: displays a message on the screen or other output device.
  • INPUT: asks the user to enter the value of a variable. The statement may include a prompt message.
  • TAB or AT: sets the position where the next character will be shown on the screen or printed on paper.

Miscellaneous

  • REM: holds a programmer’s comment or REMark; often used to give a title to the program and to help identify the purpose of a given section of code.
  • USR: transfers program control to a machine language subroutine, usually entered as an alphanumeric string or in a list of DATA statements.
  • TRON: turns on a visual, screen representation of the flow of BASIC commands by displaying the number of each command line as it is run. The TRON command, largely obsolete now, stood for, TRace ON. This meant that command line numbers were displayed as the program ran, so that the command lines could be traced. This command allowed easier debugging or correcting of command lines that caused problems in a program. Problems included a program terminating without providing a desired result, a program providing an obviously erroneous result, a program running in a non-terminating loop, or a program otherwise having a non-obvious error.
  • TROFF: turns off the display of the number of each command line as command lines run after the command TRON has been used.
  • ALT+CTRL+DEL: For re-booting a computer

ASSESSMENT.

  1. What is a computer language?
  2. The process of writing instructions for the computer is called?
  3. List and explain the various categories of programming languages.
  4. List and explain the types of High Level programs.


© Lesson Notes All Rights Reserved 2023