Week 1 Flashcards

1
Q

When was the invention of the Diffrence Engine

A

1822

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

How many stages have the computer languages of the last fifty years come to

A

Two: The first major language and the second major languages

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

What is a programming language

A

A programming language is an artificial
language designed to express computations or
algorithms that can be performed by a
computer

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

What is a program

A

A program is computer coding of
an algorithm that
– Takes input
– Performs some calculations on
the input
– Generates output

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

factorial program in C

A

int fact(int n) {
int sofar = 1;
while (n>0) sofar *= n–;
return sofar;
}

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

Master the von Neumann Architecture

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

Key Features of von Neumann Architecture

A
  • Data and programs stored in memory
    – Instructions and data are piped from memory to CPU
    – Fetch-execute-cycle for each machine instruction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Describe the fetch-execute cycle

A

initialize the program counter (PC)
repeat forever
fetch the instruction pointed by PC
increment the counter
decode the instruction
execute the instruction
end repeat

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

Mention some programmnig languages that mimic von neumann architecture

A

C, C++ Java

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

How do these programming languages micmic the von neumman architecture

A

– Variables → memory cells
– Assignment statements → data piping between
memory and CPU
– Operations and expressions → CPU executions
– Explicit control of execution flows → prog. counter

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

The architecture is limited by?

A

Allow efficient mapping between language and
hardware for good execution performance, but
limited by von Neumann bottleneck

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

How old is LISP

A

LISP is the second oldest general programming language
that is still in use since 1958

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

Give a summary of imperative langauge

A

– Variables, assignment statements, and iteration
– Include languages that support object-oriented
programming, scripting languages, visual languages
– Ex.: C, Java, Perl, JavaScript, Visual BASIC .NE

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

Give a summary of functional language

A

– Computing by applying functions to given parameters
– Ex.: LISP, Scheme, ML

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

Give a sumary of logic language

A

– Rule-based (rules are specified in no particular order)
– Ex.: Prolog

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

Mention the Programming Design Methodology

A
  • 1950s and early 1960s: simple applications; worry
    about machine efficiency (FORTRAN)
  • Late 1960s: people efficiency important;
    readability, better control structures (ALGOL)
    – Structured programming, free format lexical
    – Top-down design and step-wise refinement
  • Late 1970s: process-oriented to data-oriented
    – Data abstraction
  • Middle 1980s: object-oriented programming
    – Data abstraction + inheritance + dynamic binding
17
Q

What makes a good PL

A
  • Readability: the ease with which programs can
    be read and understood
  • Writability: the ease with which a language
    can be used to create programs
  • Reliability: a program performs to its
    specifications under all conditions
  • Cost
18
Q

Mention features related to readablity

A

Overall Simplicity
Orthogonality
Control Statements
Data types and structures
Syntax consideration

19
Q

Mention features related to writability

A

Simplicity and orthogonality
Support for abstraction
Expressivity

20
Q

Mention features related to reliablity

A

Type checking
Exception handling
Aliasing
Readability and writability

21
Q

Mention features related to cost

A

Training programmers to use language
Compiling programs
Executing programs: runtime type checking
Language implementation system
reliability: poor reliability leads to high cost
Maintaining programs

22
Q

Mention other things that make a good PL

A
  • Portability
    – The ease with which programs can be moved from
    one implementation to another
  • Generality
    – The applicability to a wide range of applications
  • Well-definedness
    – The completeness and precision of the language’s
    official definition
  • Power efficiency?
23
Q

Describe compilation

A

Translate a high-level program into equivalent
machine code automatically by another program
(compiler)

24
Q

Mention the phase of compilation

A

Lexical analysis: converts characters in the source
program into lexical units
– Syntax analysis: transforms lexical units into parse
trees which represent syntactic structure of program
– Semantics analysis: generate intermediate code
– Code generation: machine code is generated
– Link and load

25
Q

Describe interprtation

A
  • Program interpreted by another program
    (interpreter) without translation
    – Interpreter acts a simulator or virtual machine
  • Easier implementation of programs (run-time
    errors can easily and immediately displayed)
  • Slower execution (10 to 100 times slower than
    compiled programs)
  • Often requires more space
  • Popular with some Web scripting languages (e.g.,
    JavaScript)
26
Q
A