Programming Languages, Translators and Algorithms: Generations, Compiler, Interpreter and Flowchart

⏱ 7 min read

Computer Operator and other IT papers in Lok Sewa regularly ask about generations of programming languages, the difference between a compiler and an interpreter, who made C or Java, and what each flowchart symbol means. This note explains these topics in simple language, with tables to help you revise quickly before the exam.

1. Program, programmer and programming language

A program is a set of step-by-step instructions given to a computer to do a task. Writing programs is called programming, and the person who writes them is a programmer. A collection of programs with their documentation is software.

A programming language is a formal language with its own words and grammar (syntax) used to write programs. The instructions written by the programmer are called source code. After translation into machine language, it becomes object code (machine code). Ada Lovelace is called the first computer programmer because she wrote an algorithm for Charles Babbage’s Analytical Engine in the 1840s.

2. Generations of programming languages

GenerationLanguage typeMain features
First (1GL)Machine languageWritten in binary 0 and 1; understood directly by the CPU, so no translator is needed; fastest, but very hard to write and machine dependent
Second (2GL)Assembly languageUses short words called mnemonics such as ADD, SUB and MOV; needs an assembler; still machine dependent
Third (3GL)High-level languageEnglish-like statements; machine independent (portable); needs a compiler or interpreter. Examples: FORTRAN, COBOL, BASIC, Pascal, C, C++, Java
Fourth (4GL)Very high-level or non-procedural languageThe user says what is wanted, not how to do it; used for databases and reports. Example: SQL
Fifth (5GL)Natural and logic languagesUsed in artificial intelligence and expert systems; the programmer gives rules and constraints. Examples: Prolog, Mercury

Machine and assembly languages are called low-level languages because they are close to the hardware. Languages from the third generation onwards are high-level languages because they are close to human language.

3. Language translators

A computer understands only machine language, so every other program must be translated. A language translator is system software that does this job.

PointAssemblerCompilerInterpreter
TranslatesAssembly language into machine codeWhole high-level program at onceHigh-level program one line (statement) at a time
Object codeProducedProduced and saved, so the program can run again without translatingNot saved; translated every time it runs
Speed of runningFastFastSlower
Error reportingShows errors after translationLists errors after checking the whole programStops at the first error line, so debugging is easier
ExamplesUsed for assembly programsC, C++, FORTRAN, COBOLBASIC (classic), Python, JavaScript
  • Linker: joins object code files and library files into one executable program.
  • Loader: loads the executable program into main memory (RAM) to run it.
  • Java is first compiled into bytecode, which the Java Virtual Machine (JVM) then runs on any computer. This is why Java is called ‘write once, run anywhere’.

4. Famous programming languages and their makers

LanguageYearDeveloperNotes
FORTRAN (FORmula TRANslation)1957John Backus and team, IBMFirst widely used high-level language; for science and engineering
COBOL (COmmon Business Oriented Language)1959Committee (CODASYL); Grace Hopper’s work was a major influenceFor business and government data processing
BASIC (Beginner’s All-purpose Symbolic Instruction Code)1964John Kemeny and Thomas KurtzEasy language for beginners
Pascal1970Niklaus WirthFor teaching structured programming
C1972Dennis Ritchie, Bell LabsUsed to write the UNIX operating system; called the mother of modern languages
C++1980s (name from 1983)Bjarne StroustrupC with object-oriented features
Python1991Guido van RossumSimple, readable; popular in AI and data science
Java1995James Gosling, Sun MicrosystemsPlatform independent through the JVM
JavaScript1995Brendan Eich, NetscapeMakes web pages interactive
PHP1995Rasmus LerdorfServer-side web programming

HTML (HyperText Markup Language), created by Tim Berners-Lee, is a markup language for designing web pages, not a full programming language. SQL (Structured Query Language) is used to work with databases. LISP and Prolog are used in artificial intelligence.

5. Programming approaches

  • Procedural or structured programming: the program is divided into procedures or functions and works step by step, usually designed top-down. Examples: C, Pascal, FORTRAN.
  • Object-oriented programming (OOP): the program is built from objects, which combine data and functions. A class is a blueprint and an object is an instance of a class. Examples: C++, Java, Python, C#.
  • Main OOP features: encapsulation (wrapping data and functions together and hiding data), inheritance (a new class gets the features of an old class), polymorphism (one name, many forms) and abstraction (showing only essential details).
  • Every structured program uses three basic control structures: sequence (one step after another), selection (decision, such as IF … ELSE) and iteration (loops, such as FOR and WHILE).

6. Algorithm

An algorithm is a finite, step-by-step procedure written in simple language to solve a problem. The word comes from the name of the Persian mathematician al-Khwarizmi. An algorithm written in a form close to program code is called pseudocode.

  • Input: it takes zero or more inputs.
  • Output: it gives at least one result.
  • Definiteness: each step is clear and has only one meaning.
  • Finiteness: it must end after a limited number of steps.
  • Effectiveness: each step is simple enough to be carried out.

Example algorithm to find the larger of two numbers: Step 1: Start. Step 2: Read A and B. Step 3: If A is greater than B, print A; otherwise print B. Step 4: Stop.

7. Flowchart and its symbols

A flowchart is a diagram that shows the steps of an algorithm using standard symbols joined by arrows. It makes the logic easy to understand, check and explain.

Symbol (shape)NameUse
Oval or rounded rectangleTerminalStart or Stop (beginning and end)
Parallelogram (slanted rectangle)Input/OutputRead data or print results
RectangleProcessCalculation or assignment, such as Sum = A + B
Diamond (rhombus)DecisionA question with Yes or No (True or False) branches
Arrow linesFlow linesShow the direction of flow from one step to the next
Small circleOn-page connectorJoins parts of a flowchart on the same page
Pentagon shaped like a home plateOff-page connectorContinues the flowchart on another page
Rectangle with double lines on both sidesPredefined processA sub-program or function defined elsewhere

Rules: a flowchart has one Start and at least one Stop; flow usually goes from top to bottom and left to right; a decision box has one entry and two or more exits; flow lines should not cross where it can be avoided.

8. Errors, debugging and the program development life cycle

ErrorMeaningExample
Syntax errorBreaking the grammar rules of the language; found by the compiler or interpreterMissing semicolon or misspelled keyword in C
Logical errorThe program runs but gives the wrong answer; hardest to find because no error message appearsUsing + instead of × in a formula
Runtime errorError that happens while the program is runningDividing a number by zero, or running out of memory

A mistake in a program is called a bug, and finding and removing it is debugging. The term became popular after Grace Hopper‘s team found a moth stuck in the Harvard Mark II computer in 1947.

Program Development Life Cycle: problem analysis, then design (algorithm and flowchart), coding, testing and debugging, implementation, documentation, and maintenance. Documentation is the written description that helps users and other programmers understand the program.

📌 Key points to remember

  • A program is a set of instructions; source code is translated into object (machine) code.
  • 1GL machine language (0 and 1), 2GL assembly (mnemonics), 3GL high-level (C, Java), 4GL SQL, 5GL Prolog (AI).
  • Assembler: assembly to machine code. Compiler: whole program at once, faster. Interpreter: line by line, easier debugging.
  • FORTRAN 1957 John Backus; C 1972 Dennis Ritchie; C++ Bjarne Stroustrup; Java 1995 James Gosling; Python Guido van Rossum.
  • Ada Lovelace is called the first programmer; HTML is a markup language, not a programming language.
  • OOP features: class, object, encapsulation, inheritance, polymorphism and abstraction.
  • An algorithm must have input, output, definiteness, finiteness and effectiveness.
  • Flowchart: oval = start or stop, parallelogram = input or output, rectangle = process, diamond = decision, circle = connector.
  • Syntax errors are found by the translator; logical errors give wrong output; runtime errors occur while running.
📝 Quiz

Test yourself: Programming Languages, Translators and Algorithms

Practise Program, programmer and programming language, Programming approaches and Errors, debugging and the program development life cycle with 20 questions.

Loading quiz...

Leave a Comment

Your email address will not be published. Required fields are marked *

Loksewa Pathsala is an independent educational platform. It is not affiliated with the Public Service Commission (Lok Sewa Aayog) or the Government of Nepal. · लोक सेवा आयोगको आधिकारिक साइट होइन। · Sources & disclaimer
Scroll to Top