Test 1 Flashcards

1
Q

What is the CPU?

A

Central Processing unit, or the “Brain” of the computer. Controls all other computer functions. Also known as the microprocessor or simply processor.

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

What is the BUS?

A

Computer Components are connected by a bus, or a group of parallel wires that carry signals and data between components.

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

What is main memory?

A

Main memory is made up of capacitors. If a capacitor is charged it’s state is 1 or ON, or set. If not its state is 0 or OFF or reset or cleared.

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

How is memory divided?

A

Divided into cells where each cell contains 8 bits (a 1 or 0) called a byte. Each cell is uniquely numbered, with a number called its address.

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

What kind of storage is Main Memory?

A

Volatile, meaning if power is lost the information in main memory is lost.

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

How do other components access information in Main Memory?

A

Other components can get the information at a particular address in MM, known as READ. This does not alter the contents. Other components can also store information at a particular address known as WRITE, which alters the contents of MM.

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

What kind of access is MM, what does this mean?

A

Random access or direct access means any memory address can be reached in the same amount of time because we can go directly to the address we want without starting from 0 and reading everything until we get to where we want (sequential address).

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

What are some kinds of Secondary Storage Media?

A
Disks (floppy, hard, removable)
Tapes
CDs
DVDs 
This kind of storage is called persistent (permanent) because it is nonvolatile.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are some I/O Devices?

A

Also known as peripheral devices.

Keyboard, mouse, monitor, disk drive, CD or DVD drive, printer, scanner.

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

What are the kinds of languages?

A

Machine languages: machine dependent, a set of binary strings, each of them is a sequence of ‘0’ and ‘1’, of fixed length.

Assembly languages: English-like abbreviations to represent operations of computer.

Example: ADD A Reg1

High-level language (HLL): Assembly languages are still too troublesome even for simple operations like C=A+B. An HLL has structures well recognized by humans.

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

What are some high level languages?

A

Fortran: IBM during 50’s. Scientific/engineering computation.

COBOL (Common Business Oriented Language), Late 50’s. Database

C, 70’s at Bell Lab. System language. Many modern OSs are written using C.

C++, 80’s

Java: Early 90’s SUN Microsystems. Written using C++.

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

What is the process of running a normal HLL?

A

HLL is turned into Assembly Language by the compiler, then the assembler turns it into machine code, then the loader loads it onto your computer to run.

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

How does Java run programs?

A

Compiler turns program into byte code, which is then loaded into and executed by the Java virtual machine which is then run on the real machine.

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

What does readability mean?

A

How easy is it to read and understand programs written in the programming language?

Arguably the most important criterion!

Factors effecting readability include:

Simplicity: too many features is bad

Orthogonality: small set of primitive constructs combinable in a small number of ways to build the language’s control and data structures

Makes the language easy to learn and read

Meaning is context independent

Control statements

Data type and structures

Syntax considerations

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

What does writability mean?

A

How easy is it to write programs in the language?

Factors effecting writability:

Simplicity and orthogonality

Support for abstraction

Expressivity

Fit for the domain and problem

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

What are the factors in reliability?

A

Factors:

Type checking

Exception handling

Aliasing

Readability and writability

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

What are the categories of cost?

A

Categories:

Programmer training

Software creation

Compilation

Execution

Compiler cost

Poor reliability

Maintenance

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

What other concepts are important in determining the usefulness of a PL?

A

Portability

Generality

Well-definedness

Good fit for hardware (e.g., cell) or environment (e.g., Web)

etc…

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

What are von Neumann Machines?

A

John von Neuman is generally considered to be the inventor of the “stored program” machines, the class to which most of today’s computers belong
One CPU + one memory system that contains both program and data
Focus on moving data and program instructions between registers in CPU to memory locations
Fundamentally sequential

20
Q

What is the von Neumann Diagram?

A
Memory
^                    ^
|                      |
v                     v
Control -->  Arithmetic                 Output
                    (Accumulator)

Processor

21
Q

What were some PL Methodologies through the decades?

A

50s and early 60s: Simple applications; worry about machine efficiency
Late 60s: People efficiency became important; readability, better control structures. maintainability
Late 70s: Data abstraction
Middle 80s: Object-oriented programming
90s: distributed programs, Internet
00s: Web, user interfaces, graphics, mobile, services
10s: parallel computing, cloud computing?, pervasive computing?, semantic computing?, virtual machines?

22
Q

What are the big 4 PL Paradigms? What are some others?

A
The big four PL paradigms:
Imperative or procedural (e.g., Fortran, C)
Object-oriented (e.g. Smalltalk, Java)
Functional (e.g., Lisp, ML)
Rule based (e.g. Prolog, Jess)
Others:
Scripting (e.g., Python, Perl, PHP, Ruby)
Constraint (e.g., Eclipse)
Concurrent (Occam)
…
23
Q

What are some language design tradeoffs?

A

Reliability versus cost of execution
Ada, unlike C, checks all array indices to ensure proper range but has very expensive compilation

Writability versus readability
(2 = 0 +.= T o.| T) / T < iN
APL one-liner producing prime numbers from 1 to N, obscure to all but the author

Flexibility versus safety
C, unlike Java, allows one to do arithmetic on pointers, see worse is better

24
Q

What are some implementation methods?

A

Direct execution by hardware
e.g., native machine language

Compilation to another language
e.g., C compiled to Intel Pentium 4 native machine language

Interpretation: direct execution by software
e.g., csh, Lisp, Python, JavaScript

Hybrid: compilation then interpretation
Compilation to another language (aka bytecode), then interpreted by a ‘virtual machine’, e.g., Java, Perl

Just-in-time compilation
Dynamically compile some bytecode to native code (e.g., V8 JavaScript engine)

25
Q

What are some implementation issues?

A
  1. Complexity of compiler/interpreter (interpreted best)
  2. Translation speed (interpreted best)
  3. Execution speed (compiled best)
  4. Code portability (interpreted best)
  5. Code compactness (interpreted best)
  6. Debugging ease (interpreted best)
26
Q

Who are some of the first programmers?

A

Jacquard loom of early 1800s
Translated card patterns into cloth designs
Charles Babbage’s analytical engine (1830s & 40s)
Programs were cards with data and operations. Steam powered!
Ada Lovelace – first programmer

27
Q

Who was Konrad Zuse?

A

Konrad Zuse began work on Plankalkul (plan calculus), the first algorithmic programming language, with an aim of creating the theoretical preconditions for the formulation of problems of a general nature.
Seven years earlier, Zuse had developed and built the world’s first binary digital computer, the Z1. He completed the first fully functional program-controlled electromechanical digital computer, the Z3, in 1941.
Only the Z4 – the most sophisticated of his creations – survived World War II.

28
Q

Who was Von Neumann?

A

Von Neumann led a team that built computers with stored programs and a central processor
ENIAC wasprogrammed with patch cards

29
Q

What were machine codes? What was wrong with them?

A

Initial computers (1940s) were programmed in raw machine codes.
These were entirely numeric.
What was wrong with using machine code? Everything!
Poor readability
Poor modifiability
Expression coding was tedious
Inherit deficiencies of hardware, e.g., no indexing or floating point numbers

30
Q

What were some Pseudocodes?

A

Short Code or SHORTCODE - John Mauchly, 1949.
Pseudocode interpreter for math problems, on Eckert and Mauchly’s BINAC and later on UNIVAC I and II.
Possibly the first attempt at a higher level language.
Expressions were coded, left to right, e.g.:
X0 = sqrt(abs(Y0))
00 X0 03 20 06 Y0
Some operations:
01 – 06 abs 1n (n+2)nd power
02 ) 07 + 2n (n+2)nd root
03 = 08 pause 4n if <= n
04 / 09 ( 58 print & tab

More Pseudocodes
Speedcoding; 1953-4
A pseudocode interpreter for math on IBM701, IBM650.
Developed by John Backus
Pseudo ops for arithmetic and math functions
Conditional and unconditional branching
Autoincrement registers for array access
Slow but still dominated by slowness of s/w math
Interpreter left only 700 words left for user program
Laning and Zierler System - 1953
Implemented on the MIT Whirlwind computer
First “algebraic” compiler system
Subscripted variables, function calls, expression translation
Never ported to any other machine

31
Q

What was Fortran?

A

1954-1957

FORmula TRANslator
Developed at IBM under the guidance of John Backus primarily for scientific, computational programming
Dramatically changed forever the way computers used
Has continued to evolve, adding new features & concepts.
FORTRAN II, FORTRAN IV, FORTRAN66, FORTRAN77, FORTRAN90
Always among the most efficient compilers, producing fast code

32
Q

What was COBOL?

A

COmmon Business Oriented Language
Principal mentor: (Rear Admiral Dr.) Grace Murray Hopper (1906-1992)
Based on FLOW-MATIC which had such features as:
Names up to 12 characters, with embedded hyphens
English names for arithmetic operators
Data and code were completely separate
Verbs were first word in every statement
CODASYL committee (Conference on Data Systems Languages) developed a programming language by the name of COBOL

33
Q

What was BASIC?

A

(1964)
Beginner’s All purpose Symbolic Instruction Code
Designed by Kemeny & Kurtz at Dartmouth for the GE 225 with the goals:
Easy to learn and use for non-science students and as a path to Fortran and Algol
Must be “pleasant and friendly”
Fast turnaround for homework
Free and private access
User time is more important than computer time
Well suited for implementation on first PCs (e.g., Gates and Allen’s 4K Basic interpreter for the MITS Altair personal computer (circa 1975)
Current popular dialects: Visual BASIC

34
Q

What is LISP?

A

(1959)
LISt Processing language (Designed at MIT by McCarthy)
AI research needed a language that:
Process data in lists (rather than arrays)
Symbolic computation (rather than numeric)
One universal, recursive data type: the s-expression
An s-expression is either an atom or a list of zero or more s-expressions
Syntax is based on the lambda calculus
Pioneered functional programming
No need for variables or assignment
Control via recursion and conditional expressions
Status
Still the dominant language for AI
COMMON LISP and Scheme are contemporary dialects
ML, Miranda, and Haskell are related languages

35
Q

What is APL?

A

designed by Ken Iverson at Harvard in late 1950’s
APL = A Programming Language
A language for programming mathematical computations
especially those using matrices
Functional style and many whole array operations
Drawback is requirement of special keyboard

36
Q

What is a programming languages syntax? What about semantics?

A

Syntax is the form or structure of the expressions, statements and program units. Semantics are the meaning of those expressions, statements and program units

37
Q

What is a sentence?

A

A sentence is a string of characters over some alphabet.

e.g.: def add1(n): return n + 1

38
Q

What is a language?

A

A language is a set of sentences

39
Q

What is a lexeme?

A

The lowest level syntactic unit of a language

e.g.: *, add1, begin

40
Q

What is a token?

A

A category of lexemes

e.g.: identifier

41
Q

What are the lexical structures of PLs?

A

The structure of its lexemes? (words or tokens)

  • The scanning phase (lexical analyser) collects characters into tokens
  • Parsing phase (syntactic analyser) determines syntactic structure

Stream of characters ==> Lexical analyser ==> Tokens and values ==> Syntactic analyser ==> Result of parsing

42
Q

What is a formal grammar?

A

A formal grammar is a set of rules for strings in a formal language that describe how to form strings from the language’s alphabet that are valid according to the language’s syntax. This does not describe the meaning of the strings or what can be done with them in any context, only their form.

43
Q

What is the role of grammars in PLs?

A

A grammar defines a programming language in terms of syntax. It can be used to:

  • Generate sentences in the language
  • Test whether a string is in the language
  • Produce a structures representation of the string that can be used in subsequent processing.
44
Q

What are context free grammars?

A
  • Developed by Noam Chomsky in the mid-1950s
  • Language generators, meant to describe the syntax of natural languages
  • Define a class of languages called context-free languages
45
Q

What is the BNF?

A

Backus Normal/Naur Form (1959)

  • Invented by John Backus to describle Algol 58 and refined by Peter Naur for Algol 60
  • BNF is equivalent to context-free grammars