APCS – Unit 2 – Lesson 1 – Introduction to Programming Languages

1. What is a computer program?

According to wikipedia, a computer program is a collection of instructions that can be executed by a computer to execute a certain task. The instructions are written by following the rules of chosen programming language. Without computer programs, computers are useless.

A computer program contains statements and variables. The statements are instructions to tell the computer what to do with the variables.

2. What is a programming language?

According to wikipedia, a programming language is a formal language comprising a set of instructions that produce various kinds of output. Programming languages are used in computer programming to implement algorithms.

3. What are the different types of programming languages?
  • Machine Language
    • Uses binary code
    • Machine-dependent
    • Not portable
  • Assembly Language
    • Uses mnemonics
    • Machine-dependent
    • Not usually portable
  • High-Level Language (HLL)
    • Uses English-like language
    • Machine independent
    • Portable (but must be compiled for different platforms)
    • Examples: Pascal, C, C++, Java, Fortran, . .
4. What is Machine Language?
  • The representation of a computer program which is actually read and understood by the computer.
    • A program in machine code consists of a sequence of machine instructions.
  • Instructions:
    • Machine instructions are in binary code
    • Instructions specify operations and memory cells involved in the operation

Example:

Operation

Address

0010

0000 0000 0100

0100

0000 0000 0101

0011

0000 0000 0110

5. What is Assembly Language?
  • A symbolic representation of the machine language of a specific processor.
  • Is converted to machine code by an assembler.
  • Usually, each line of assembly code produces one machine instruction (One-to-one correspondence).
  • Programming in assembly language is slow and error-prone but is more efficient in terms of hardware performance.
  • Mnemonic representation of the instructions and data
  • Example:

                Load             Price

Add               Tax

Store             Cost

6. What is High – level Language?
  • A programming language which use statements consisting of English-like keywords such as “FOR”, “PRINT” or “IF“, … etc.
  • Each statement corresponds to one or multiple machine language instructions (one-to-many correspondence).
  • Much easier to program than in assembly language.
  • Data  are referenced using descriptive names
  • Operations can be described using familiar symbols
  • Example:

Cost = Price + Tax;

7. What are some of the most popular programming languages?

There are many programming languages in the world. The term programming language usually refers to high – level languages. Here’s a list of the most popular programming languages in the recent years:

  • Python
  • Java
  • C / C++
  • JavaScript
  • Go
  • R
  • Swift
  • C# .NET

List of Sources and References:

  1. CMU Lectures, Introduction to Computer Programming
  2. MIT Open Courseware, Introduction to Programming Langages