Programming and Programming Languages (Week 6) Flashcards

1
Q

What does it mean for a computer to be a general-purpose computing machine?

A

Computers are general- purpose computing machines, they can be used for many different tasks

But they do not know how to do anything unless somebody programs them => tells them what to do

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Programming?

A

Programming means creating a sequence of instructions for a computer to carry out a task

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the difference between an algorithm and a program?

A
  • An algorithm is an “abstract or idealized” process
    => it might ignore details, e.g. invalid user input, hardware failure or limitations of the hardware
  • A program, like an algorithm, is a sequence of detailed instructions, but…
    => A computer must understand each instruction and accomplish the task
    => A program is much more detailed than an algorithm – it implements the algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What do Programs need to worry about that Algorithms don’t?

A

Unlike an algorithm, a program may have to worry about the shortcomings of hardware and data input, e.g.

  • Insufficient memory: not enough storage or RAM
  • Limited processor speed: too much data per time unit
  • Invalid or malicious input: letter instead of number
  • Hardware failure, e.g. broken network connection

A program typically contains implementations of one or more algorithms bundled together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Machine Code?

A

At first (1950’s), people wrote programs “manually”

Programs were written in machine code - a sequence of binary numbers for instructions and data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some drawbacks of Machine Code?

A

Time consuming to create, difficult to locate and correct errors

Each CPU type uses its own set of instructions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How was Machine Code initially inputted?

A

Punched cards were used to load programs and data into the memory of a computer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an Assembly Language?

A

Soon, assembly languages were used – the instructions we used for the Toy computer are an example for an assembly language.

Allows programmers to use meaningful words instead of binary numbers for instructions and memory locations.
* E.g. PRINT instead of machine code 001
* E.g. STORE Sum instead of 010 110 (labels in assembly languages make it easier to refer to a memory location)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is an Assembler?

A

Assembler: a program that translates assembly code to machine code

Basic idea: use a program that helps to create other programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why write code in Assembly language?

A

It is easier to use than binary code.

The assembler also automates some of the “clerical tasks”, e.g. it keeps records where data is stored in memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the main limitation of Assembly Code?

A

Machine Dependency

  • An assembly language program running on one CPU must be largely rewritten to run on a different CPU type
  • An assembler is aware of specific instructions and properties of a CPU, e.g. how many accumulators can be used, etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a High Level Programming Language?

A

A high-level programming language is a programming language with a strong abstraction from the details of the computer (think binary/machine code).

It may use natural language understanding and elements for ease of use.

It may automate (or even hide entirely) significant areas of computing systems like storage management - making the process of developing a program simpler and more understandable than when using a lower-level language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Why were High Level Programming Languages developed?

A

Various high level languages have been developed to make it easier to create programs, usually for specific purposes, e.g.

  • Learning how to program, scientific calculations, business tasks, web applications, system programming, data analytics, etc.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What advantages do High Level Languages have?

A

They provide instructions that are more powerful than assembly code and closer to the way people think.
=> Learning how to write programs is easier and faster.

Software can be created in shorter time.
=> Shorter time to market and lower cost of development.

It is easier to detect some program errors.

Programs are independent of any specific CPU architecture.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are 6 examples of High Level Languages?

A
  1. Fortran
  2. Cobol
  3. Basic
  4. C and C++
  5. Java
  6. Javascrips
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Describe the purpose of each High Level Programming Language :

  1. Fortran
  2. Cobol
  3. Basic
  4. C and C++
  5. Java
  6. Javascript
A
  1. formula translation; successful for expressing computations in science and engineering
  2. common business oriented language; specifically aimed at business data processing
  3. beginners all purpose symbolic Insturction code
  4. system programming; programming language used in Firefox and Edge
  5. originally for small embedded systems, now widely used for web systems and android; original programming target was for home appliances
  6. used in a browser to achieve dynamic effects on web pages
17
Q

What is a Compiler?

A

Every high level instruction is translated (=compiled) into equivalent assembly instructions.

Any program written in a high level language can be compiled for different CPUs (e.g. PC, smartphone, embedded system)

18
Q

What is the process of turning High Level Languages into run-able Machine Code?

A
  1. First, a compiler converts a program written in a high level language into CPU-specific assembly language instructions
  2. Second, an assembler converts the assembly language instructions into machine code (binary instructions specific to that CPU)
19
Q

What is JavaScript?

A
  • Developed at Netscape in 1995
  • Purpose: rather simple language to enable dynamic effects on web pages
  • Does not need an extra compiler => browsers execute (= interpret) the code
  • Any web browser is a JavaScript Interpreter (think of it as an “on-the-fly” compiler)