Chapter 6: Programming Languages Flashcards

1
Q

First generation of programming languages

A
  • First generation: pure machine languages (machine code)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Second generation: assembly languages

  • Assembler:
A
  • A mnemonic system for representing machine instructions:
    mnemonic names for op-codes
    descriptive names for memory locations (variables) chosen by the programmer
  • One to one correspondence between machine instructions and assembly instructions
  • Inherently machine-dependent
  • Assembler: convert assembly language to machine language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Third generation languages

Compiler:

  • Early examples:
A
  • Uses high level primitives
  • Machine independent (mostly)
  • Each primitive corresponds to a sequence of machine language instructions
  • Compiler: converts third generation language to machine language
  • Early examples: Fortran, Cobol
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Programming paradigms

A
  • Functional: basic building blocks: functions
  • Object-oriented: basic building block: objects
  • Imperative: basic building block: procedures
  • Declarative, for example:
    • logic programming: basic building block: logical formulas
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Primitive data types

A
  • Integer: whole numbers signed/unsigned
  • Float: numbers with fractions
  • Characters: symbols, 8/16 bits
  • Boolean: True/False
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is array (data structure)

A

An array is a block of data where all elements are of the same type

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

What is aggregate type (data structure)

A

It’s a block of data where different elements can have different types

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

What is a variable?

A

En variabel är ett namngivet utrymme i primärminnet.

It’s a named location in primary memory, which can store a value.

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

What is a literal?

A

It’s a value of some type for example: 3.14

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

What is a constant?

A

It’s a named literal for example: const PI = 3.14;

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

Procedural units?

A
  • Subprogram, subroutine, procedure, function, method, predicate
  • Used to simplify program development by abstraction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Translation process

A
  • Step 1:
    Source Program
    Step 2:
    Lexical Analyzer: categorizes the codes into tokens
    Step 3:
    Parser: Builds data structure or abstract syntax tree
    Step 4:
    Code Generator: Turns into machine language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Object oriented programming

  • Class:
  • Object:
  • Features:
A
  • Class:
    template from which objects are constructed
    includes descriptions of both variables and methods (functions)
  • Object:
    active program unit containing both data and code;
    called a instance of the class, from which it is constructed
  • Features:
    Inheritance
    Encapsulation
    Polymorphism
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Concurrent programming

  • Parallel processing:
  • Thread:
A
  • Concurrent programming: simultaneous execution of multiple processes
  • Parallel processing: parallel execution of multiple processes, which requires multiple CPU cores
  • Thread: concurrent/parallel execution path within the same program/process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Logic Programming

A
  • Program consists of logical formulas (statements) in the form of rules and facts
  • There is no distinction between code and data
  • Built-in deduction engine using a derivation technique called resolution
  • Answer question whether a fact is a logical consequence of the program or not
How well did you know this?
1
Not at all
2
3
4
5
Perfectly