Programming languages, translators, algorithms, flowcharts, and program design tools
Grade XI • Computer Science ⏱️ ~40 minBrief Intro — Programming Concepts & Logic
Programming is more than just typing code; it's a process of logical problem-solving that begins with a clear plan. By understanding how different programming languages work and how translators convert them for the computer, you'll gain a deeper appreciation for the software we use every day.
In this activity, you'll explore the generations of languages, master the use of algorithms and flowcharts, and learn the fundamental control structures that form the logic of every program.
From machine code to natural language, programming languages have evolved to become more human-readable while requiring complex translators to run.
A programming language is a set of rules that provides a way of telling a computer what operations to perform. It is a notational system for describing computation in both machine-readable and human-readable forms.
Just like English has words, symbols, and grammatical rules, programming languages also have words, symbols, and syntax rules. Each programming language has different syntax rules.
Consists of strings of binary numbers (0s and 1s) and is the only language the processor directly understands.
Merits: Fastest execution, efficient memory use, no translation needed
Demerits: Very difficult to program, time-consuming, hard to debug, requires experts
Uses mnemonic codes (symbolic operation codes like 'ADD' for addition) instead of 0s and 1s. Programs are converted to machine code by an assembler.
Merits: Easier than 1GL, faster programming, easier error identification, easier debugging
Demerits: Not directly understood by computer, hardware-dependent, not portable, requires knowledge of mnemonics
Designed to express logic and procedure. Examples: C, Pascal, FORTRAN, COBOL
Merits: Flexible, portable, programmer focuses on problem not architecture
Demerits: Needs higher processor and larger memory, execution time slower due to translation
Users specify what output should be without describing data manipulation details. Examples: Visual Basic, C#, PHP, SQL
Merits: Programmer need not think about procedure, programming is much easier
Demerits: Needs higher processor and larger memory, slower execution
Still in development stage, uses normal sentences. Programs have artificial intelligence (AI).
Merits: Easy to program, easy to understand, interactive and interesting
Demerits: Slower than previous generations, requires advanced expensive hardware
Translators convert source code to machine code (binary/object code).
| Translator | Description | Example |
|---|---|---|
| Assembler | Converts assembly language to binary machine code | Assembly programs |
| Interpreter | Translates and executes source code line by line | Python |
| Compiler | Converts entire source code to binary before execution | C, C++ |
| Hybrid | Combination: compiles to bytecode, then interprets | Java (Bytecode + JVM) |
| Aspect | Compiler | Interpreter |
|---|---|---|
| Translation Method | Translates entire program at once | Translates line by line |
| Execution | Creates binary file, then executes | Executes directly from source |
| Error Detection | During compilation (all errors reported) | Stops at first error encountered |
| Speed | Faster execution after compilation | Slower execution |
Compile-time errors: Detected during compilation (syntax/semantic)
Run-time errors: Occur during execution, difficult to identify during development
Computers represent data using different encoding systems, from pure binary to universal character standards that support global communication.
Absolute binary is the fundamental Base-2 numbering system used by CPUs. It represents values using only two states: 0 and 1. Each digit's value is determined by its position as a power of 2.
Function: Primary format for performing arithmetic and logical operations
Representation: The decimal value 10 is expressed as 1010₂
BCD is a specialized encoding method where each individual digit of a decimal number is represented by its own 4-bit binary sequence (a nibble). Unlike absolute binary, BCD treats digits independently.
Function: Used in systems where decimal rounding errors must be avoided, such as electronic displays (calculators and digital clocks) and financial accounting software
Representation: The decimal number 25 is represented in BCD as 0010 0101 (2 and 5), whereas in absolute binary, it would be 11001
The American Standard Code for Information Interchange (ASCII) is a character encoding standard for electronic communication. It originally used a 7-bit binary code to represent 128 characters, including the English alphabet (upper and lowercase), numerals 0-9, and punctuation marks.
Function: Served as the standard for data exchange between different software and hardware manufacturers for decades
Constraint: Limited to the Latin alphabet and lacks support for non-English languages
The Extended Binary Coded Decimal Interchange Code (EBCDIC) is an 8-bit character encoding primarily developed by IBM. It was designed for use on IBM mainframe computers and mid-range systems.
Function: Performs the same task as ASCII, but the binary values assigned to characters are different
Example: The character "A" is 1100 0001 in EBCDIC but 0100 0001 in ASCII
Status: Remains in use primarily for legacy support within corporate and banking mainframe environments
Unicode is a universal computing standard designed to provide a unique identification number for every character, regardless of the platform, program, or language. It supports over 140,000 characters, encompassing modern and ancient scripts, mathematical symbols, and emojis.
UTF-8: The most prevalent implementation of Unicode. It is variable-width (using 1 to 4 bytes) and is fully backward-compatible with ASCII
Function: Has largely replaced previous encoding standards to ensure global interoperability across the internet and modern operating systems
| System | Format | Size | Primary Application |
|---|---|---|---|
| Absolute Binary | Base-2 Math | Variable | CPU Arithmetic |
| BCD | Digit-by-digit | 4 bits per digit | Financial/Display hardware |
| ASCII | Character Mapping | 7 or 8 bits | Standard English Text |
| EBCDIC | Character Mapping | 8 bits | IBM Mainframe Systems |
| Unicode | Universal Mapping | 8, 16, or 32 bits | Global Software & Web |
Convert the decimal number 25 to both BCD and absolute binary, then match each encoding system to its primary application.
Encoding Applications: BCD → calculators/digital clocks/financial software; ASCII → English-text data exchange; EBCDIC → IBM mainframes; Unicode → global web/software
Control structures are the basic building blocks of logic, allowing programs to follow sequences, make choices, and repeat actions.
Any algorithm can be implemented using just these three structures:
Instructions executed one after another in order. Like reading a recipe or book.
Example: Accept two numbers, add them, display result.
Choosing which path to execute based on criteria. Uses IF/ELSE or switch statements.
Example: If student passed, clap and cheer. Otherwise, say "Better luck next time."
Looping or repeating operations a specific number of times or until condition occurs.
Example: Print numbers 1 to 10 by incrementing a counter.
Algorithms, flowcharts, and pseudocode are essential tools for planning and documenting the logic of a program before writing a single line of code.
Step-wise logical instructions written in human-understandable language to solve a problem in finite time. Written in simple English.
Characteristics:
Steps to develop an algorithm:
Pictorial representation of step-wise solutions to a problem. Uses different boxes linked by arrows. Helps programmers develop logic and serves as documentation.
Characteristics:
Advantages: Easy to explain logic, provides documentation, helps detect bugs systematically, guides program writing
Disadvantages: Time-consuming to draw, complicated logic hard to represent
Program Design Language (PDL) providing skeleton for program design. Artificial and informal language to develop algorithms. Outline of program that can be converted to real statements.
Rules for writing pseudocode:
Click "Step" to trace through an algorithm that finds the largest of three numbers.
Applying logic to simple problems like adding numbers or finding the largest value is the best way to master program design tools.
Algorithm:
Pseudocode:
START
READ a, b
SUM = a + b
DISPLAY SUM
END
Algorithm:
Pseudocode:
START
READ a, b
IF a > b THEN
DISPLAY a
ELSE
DISPLAY b
ENDIF
END
Algorithm:
Pseudocode:
START
count = 1
DO WHILE count <= 10
DISPLAY count
count = count + 1
ENDDO
END
Identify the generation of programming language from the description:
"This language uses mnemonics like ADD, SUB, DIV and requires an assembler to convert to machine code."
Think about which generation uses symbolic codes instead of binary but is still low-level.
✅ Verify: Your answer should be "2GL" or "Assembly Language" or "Second Generation".
🌟 Stretch Goal: Research and list one advantage and one disadvantage of this language generation.
Write an algorithm to check whether a user-entered number is even or odd.
Use the modulo operator (%) to check if remainder when divided by 2 is 0.
✅ Verify: Your algorithm should have: Start, Read number, Check condition, Display result, Stop.
🌟 Stretch Goal: Convert your algorithm to pseudocode using IF/THEN/ELSE/ENDIF.
Match the following flowchart symbols to their meanings:
Remember: Oval for terminals, Rectangle for actions, Diamond for questions, Parallelogram for data.
✅ Verify: Draw a simple flowchart for adding two numbers using correct symbols.
🌟 Stretch Goal: Create a flowchart for finding the largest of three numbers.
Identify the control structure used in each scenario:
Sequence = order, Selection = decision, Iteration = loop/repetition
✅ Verify: Your answers: 1-Sequence, 2-Selection, 3-Selection, 4-Iteration.
🌟 Stretch Goal: Write pseudocode for one of these scenarios using appropriate control structure keywords.
Classify the following errors as syntax, semantic, or logical:
Syntax = grammar rules, Semantic = meaning/usage, Logical = wrong logic/behavior
✅ Verify: Your answers: 1-Syntax, 2-Logical, 3-Run-time/Logical, 4-Syntax.
🌟 Stretch Goal: Explain which of these would be caught during compilation vs during execution.
Ready to test your knowledge?
Take the Assessment →