Lesson
12 of 26
Translate

Programming Languages & Flowcharts

Machine, assembly, high-level languages (C, C++, Java, Python), flowcharts, algorithms, and program development concepts for UPSSSC AGTA.

What is a Programming Language?

Just as humans communicate using languages like Hindi or English, programmers communicate with computers using programming languages. These languages provide a structured way to write instructions that a computer can understand and execute.

Definition: A programming language is a formal set of rules and syntax used to write instructions (programs) that a computer can execute.


Generations of Programming Languages

Programming languages evolved from machine-level to human-friendly:

flowchart LR
A["1GL<br/>Machine<br/>(Binary 0/1)"] --> B["2GL<br/>Assembly<br/>(Mnemonics)"]
B --> C["3GL<br/>High-Level<br/>(C, Java, Python)"]
C --> D["4GL<br/>(SQL, MATLAB)"]
D --> E["5GL<br/>AI Languages<br/>(Prolog, LISP)"]
Evolution of Programming Languages

1. First Generation — Machine Language (1GL)

  • Written in pure binary (0s and 1s)
  • Directly understood by CPU — no translation needed
  • Extremely difficult for humans to write and debug
  • Machine-dependent — different for each processor

2. Second Generation — Assembly Language (2GL)

  • Uses mnemonics (short codes) instead of binary: ADD, SUB, MOV, JMP
  • Requires an Assembler to convert to machine language
  • Slightly easier than binary but still complex
  • Still machine-dependent

3. Third Generation — High-Level Languages (3GL)

  • Written in English-like syntax that humans can read
  • Needs a Compiler or Interpreter to convert to machine language
  • Machine-independent (portable) — same code runs on different computers
  • Most popular generation
LanguageCreated ByYearKey Use
FORTRANIBM (John Backus)1957Scientific computing (FORmula TRANslation)
COBOLGrace Hopper1959Business applications (COmmon Business Oriented Language)
BASICKemeny & Kurtz1964Teaching beginners
CDennis Ritchie1972System programming, OS development
C++Bjarne Stroustrup1979Object-Oriented, games, applications
JavaJames Gosling (Sun)1995Web, mobile (Android), enterprise
PythonGuido van Rossum1991AI, Data Science, web, scripting
JavaScriptBrendan Eich1995Web pages, interactive websites

4. Fourth Generation (4GL)

  • Designed for specific purposes — database queries, reports
  • Even closer to natural English
  • Examples: SQL (database queries), MATLAB, R

5. Fifth Generation (5GL)

  • Languages for Artificial Intelligence
  • Focus on problem-solving rather than step-by-step instructions
  • Examples: Prolog, LISP, Mercury

Low-Level vs High-Level Languages

FeatureLow-Level (1GL, 2GL)High-Level (3GL, 4GL, 5GL)
ReadabilityDifficult (binary/mnemonics)Easy (English-like)
SpeedFaster executionSlower (needs translation)
PortabilityMachine-dependentMachine-independent
ExamplesMachine code, AssemblyC, Java, Python
TranslationAssemblerCompiler/Interpreter
Memory ControlDirect hardware accessAbstracted from hardware

Algorithms

An algorithm is a step-by-step procedure to solve a problem. Before writing a program, a programmer first designs an algorithm.

Properties of a Good Algorithm:

  1. Finiteness — Must end after a finite number of steps
  2. Definiteness — Each step must be clear and unambiguous
  3. Input — Takes zero or more inputs
  4. Output — Produces at least one output
  5. Effectiveness — Each step must be doable in finite time

Example Algorithm: Finding the largest of three numbers

  1. START
  2. Read three numbers A, B, C
  3. If A > B and A > C, then LARGEST = A
  4. Else if B > C, then LARGEST = B
  5. Else LARGEST = C
  6. Print LARGEST
  7. STOP

Flowcharts

A flowchart is a diagrammatic representation of an algorithm using standard symbols connected by arrows showing the flow of logic.

Example Flowchart: Finding Largest of Three Numbers

flowchart TD
A([START]) --> B[/Read A, B, C/]
B --> C{A > B<br/>and A > C?}
C -->|Yes| D[LARGEST = A]
C -->|No| E{B > C?}
E -->|Yes| F[LARGEST = B]
E -->|No| G[LARGEST = C]
D --> H[/Print LARGEST/]
F --> H
G --> H
H --> I([STOP])
Flowchart — Finding Largest of Three Numbers

Standard Flowchart Symbols

SymbolShapePurpose
TerminalOval/Rounded rectangleSTART and STOP
ProcessRectangleCalculations, operations
DecisionDiamondYes/No or True/False branching
Input/OutputParallelogramReading input or displaying output
Flow LinesArrowsDirection of flow
ConnectorSmall circleConnecting different parts

Advantages of Flowcharts

  • Easy to understand visually
  • Helps in debugging and error finding
  • Serves as documentation
  • Makes programming easier

Limitations

  • Complex for large programs
  • Difficult to modify once drawn
  • No standard for detail level

Key Programming Concepts

ConceptMeaning
Source CodeThe program as written by the programmer
Object CodeMachine-language version after compilation
ExecutableFinal runnable program (.exe file)
BugAn error in a program
DebuggingFinding and fixing bugs
SyntaxRules of the programming language (grammar)
Syntax ErrorViolation of language rules (typo, missing semicolon)
Logic ErrorProgram runs but gives wrong results
Runtime ErrorError during program execution (e.g., divide by zero)

Python — The AI/ML Language

Python is currently the most popular language for Artificial Intelligence and Machine Learning. Key reasons:

  • Simple syntax — reads almost like English, easy for beginners
  • Extensive libraries: NumPy (numbers), Pandas (data analysis), TensorFlow & PyTorch (deep learning), Scikit-learn (ML), Matplotlib (graphs)
  • Used in: AI, Data Science, Web Development (Django, Flask), Automation, Scripting
  • Interpreted language — runs line by line (no compilation needed)

Java — Platform Independent

Java’s motto: “Write Once, Run Anywhere” (WORA)
  • Java programs compile into bytecode, which runs on the JVM (Java Virtual Machine)
  • JVM is available on all platforms (Windows, Mac, Linux, Android)
  • This makes Java platform-independent — same program runs everywhere
  • Used in: Android apps, enterprise applications, web servers, banking systems
flowchart LR
A["Java Source Code<br/>(.java)"] -->|javac Compiler| B["Bytecode<br/>(.class)"]
B --> C["JVM<br/>(Windows)"]
B --> D["JVM<br/>(Mac)"]
B --> E["JVM<br/>(Linux)"]
B --> F["JVM<br/>(Android)"]
Java — Write Once, Run Anywhere (WORA)

HTML is NOT a Programming Language

HTML (HyperText Markup Language) is a markup language, not a programming language. It defines the structure of web pages using tags like <h1>, <p>, <img> — but it cannot perform logic, loops, or calculations.

  • CSS — styles the appearance (colors, fonts, layout)
  • JavaScript — adds interactivity and logic to web pages
  • Together: HTML (structure) + CSS (style) + JavaScript (behavior) = modern websites

OOP — Object-Oriented Programming Concepts

ConceptMeaning
ClassBlueprint/template for creating objects (e.g., “Car” class defines properties like color, speed)
ObjectInstance of a class (e.g., “MyCar” is an object of Car class)
InheritanceA class can inherit properties/methods from another class (parent → child)
PolymorphismSame function behaves differently based on context (“poly” = many, “morph” = forms)
EncapsulationBundling data and methods together, hiding internal details (data hiding)
AbstractionShowing only essential features, hiding complexity (e.g., driving a car without knowing engine internals)

OOP languages: Java, C++, Python, C#

classDiagram
class Animal {
+name: String
+sound: String
+makeSound()
}
class Dog {
+breed: String
+fetch()
}
class Cat {
+color: String
+purr()
}
Animal &lt;|-- Dog : Inheritance
Animal &lt;|-- Cat : Inheritance
OOP — Inheritance Example

Development Tools & Concepts

IDE (Integrated Development Environment)

An IDE is a software application that provides tools for writing, testing, and debugging code — all in one place.

IDEUsed For
VS CodeMulti-language (most popular, free, by Microsoft)
PyCharmPython development
EclipseJava development
NetBeansJava development
Android StudioAndroid app development

Version Control — Git

Git is a version control system that tracks changes in code over time. Developers use GitHub or GitLab for online collaboration, code sharing, and backup.

API (Application Programming Interface)

An API allows different programs or systems to communicate with each other. For example, a weather app on your phone uses an API to fetch weather data from a remote server.

Pseudocode

Pseudocode is an informal, plain-English description of algorithm steps in a structured format. It is NOT actual code — it helps plan logic before writing real code.


Important Pioneers

PersonContribution
John BackusCreated FORTRAN (1957) — first high-level programming language
Grace HopperCoined the terms “bug” and “debugging”; developed COBOL; pioneered compiler development
Dennis RitchieCreated C language (1972); co-created UNIX operating system
James GoslingCreated Java (1995) at Sun Microsystems
Guido van RossumCreated Python (1991)
Charles BabbageFather of Computer — designed Analytical Engine
Ada LovelaceFirst computer programmer — wrote algorithm for Analytical Engine

Key Takeaways

  • Programming languages evolved: Machine (1GL) → Assembly (2GL) → High-Level (3GL) → 4GL (SQL) → 5GL (AI — Prolog, LISP)
  • Machine language is binary (0/1); Assembly uses mnemonics (needs Assembler); High-level uses English-like syntax (needs Compiler/Interpreter)
  • FORTRAN (1957, John Backus) = first high-level language; COBOL (1959, Grace Hopper) = business apps
  • C (1972, Dennis Ritchie) = system programming; Java (1995, James Gosling) = WORA via JVM bytecode
  • Python (1991, Guido van Rossum) = AI/ML, interpreted, libraries: NumPy, Pandas, TensorFlow, Scikit-learn, Matplotlib
  • HTML is NOT a programming language — it is a markup language (structure); CSS (style) + JavaScript (behavior)
  • OOP concepts: Class (blueprint), Object (instance), Inheritance (parent→child), Polymorphism (many forms), Encapsulation (data hiding), Abstraction (hide complexity)
  • IDE = Integrated Development Environment (VS Code most popular, free, by Microsoft)
  • Git = version control; GitHub/GitLab = online code collaboration
  • API = Application Programming Interface — allows programs to communicate
  • Grace Hopper coined “bug” and “debugging”, developed COBOL, pioneered compilers
  • Algorithm = step-by-step procedure; Flowchart = visual diagram of algorithm
  • Flowchart symbols: Oval (start/stop), Rectangle (process), Diamond (decision), Parallelogram (I/O)
  • Bug = error; Debugging = fixing; Syntax error vs Logic error vs Runtime error
  • Pseudocode = informal English-like algorithm description (not actual code)

Summary Cheat Sheet

ConceptKey Details
1GL Machine LanguageBinary (0/1), fastest, hardest to write, machine-dependent
2GL AssemblyMnemonics (ADD, MOV), needs Assembler, machine-dependent
3GL High-LevelEnglish-like, needs Compiler/Interpreter, machine-independent
FORTRANFirst high-level language, 1957, John Backus, scientific computing
COBOL1959, Grace Hopper, business applications
C1972, Dennis Ritchie, system programming, UNIX
C++Object-Oriented extension of C, Bjarne Stroustrup
Java1995, James Gosling, WORA, JVM bytecode, Android
Python1991, Guido van Rossum, AI/ML, NumPy/Pandas/TensorFlow, interpreted
SQL4GL, database query language
HTMLNOT a programming language — markup for web structure
OOP — ClassBlueprint/template for creating objects
OOP — ObjectInstance of a class
OOP — InheritanceChild class inherits from parent class
OOP — PolymorphismSame function, different behavior (poly=many, morph=forms)
OOP — EncapsulationBundling data + methods, hiding internals
OOP — AbstractionShow essential features, hide complexity
IDEIntegrated Development Environment — VS Code (most popular, Microsoft)
GitVersion control — tracks code changes; GitHub for collaboration
APIApplication Programming Interface — programs communicate
Grace HopperCoined “bug”/“debugging”, developed COBOL, pioneered compilers
AlgorithmStep-by-step problem-solving procedure (5 properties)
FlowchartVisual diagram — Oval, Rectangle, Diamond, Parallelogram
PseudocodeInformal English-like algorithm — NOT actual code
BugError in program
DebuggingFinding and fixing bugs
CompilerTranslates entire program → .exe (C, C++)
InterpreterTranslates line by line (Python, BASIC)

Knowledge Check

Take a dynamically generated quiz based on the material you just read to test your understanding and get personalized feedback.

Lesson Doubts

Ask questions, get expert answers

Lesson Doubts is a Pro feature.Upgrade