C1: Intro Prog Concepts/Von Neumann Model Flashcards Preview

Programming in C > C1: Intro Prog Concepts/Von Neumann Model > Flashcards

Flashcards in C1: Intro Prog Concepts/Von Neumann Model Deck (19)
Loading flashcards...
1
Q

What does memory consist of in the von Neumann Model.

A

Memory consists of addressable memory
cells (usually one byte per cell) which can
be read and written freely by a program

2
Q

What is a program in the von Neumann Model?

A

A program consist of (binary) commands
(or instructions) that are stored in memory
and can be loaded by the CPU

3
Q

What is data in the von Neumann Model?

A

Data is also stored in memory and can be

loaded or stored by commands

4
Q

How is a program executed by the CPU in the von Neumann Model?

A

A program is executed by the CPU sequentially by
1. loading a command from memory,
2. executing it (e.g. adding two data items), including
loading data from memory and storing results,
3. loading the next command,
4. etc.

The address of the next command (i.e. where to find it
in memory) is stored in the instruction counter register
 (Conditional) Jump commands can be used to explicitly
set the command counter and thus change the control
flow

5
Q

What is procedural programming?

A

a program is structured
into smaller sub programs (procedures / functions),
which can be called by other procedures

6
Q

What is structured programming?

A

in addition to calling
procedures there are only three control structures: (1)
sequence, (2) iteration (WHILE), (3) selection (IFTHEN-ELSE)
 Object oriented programming: a program consi

7
Q

What is OOP?

A

a program consists of
objects that communicate by sending and receiving
messages

8
Q

What is an ‘attribute’ in Programming languages?

A
The set of properties that characterize all language constructs (e.g. variables,
types, procedures, objects). Ex: common attributes of variables: value
 name
 scope
 address
 type
 lifetime
 mutability
9
Q

What are language constructs in programming?

A
Syntax and semantics. ex:  integer variable definitions, if-then-else
control structures, class declarations, etc
10
Q

What is a binding in a prog. lang.?

A

The process of assigning a value to an

attribute is called binding.

11
Q

What are the types of bindings in a prog lang.?

A

static (before runtime) or dynamic (at runtime)

12
Q

Name an abstraction of memory transformations.

A

operators (specifies memory transformations)

13
Q

Name some abstractions of a sequence

A

Control structures and subprograms

14
Q

What is a compiler?

A

Compiler generates code from program
• Can perform correctness checks in the process
• Can optimise generated code, e.g. for multi-cores
• Generated code can be executable code,
intermediary code, or a program in another language
(trans-compiling),
ex: C, C++

15
Q

What is an interpreter?

A

Interpreter reads program instructions and
executes them directly
• Example: classical BASIC interpreter, script
languages
• Often more ‘dynamic’

16
Q

What is a Just in Time Compiler?

A

Just-in-time compiler is a way of combining compiler and interpreter:
• Reads, executes and analyses program instructions
• Performs code optimizations at runtime

17
Q

What is a linker?

A

In addition to a compiler, the linker combines several compiled program parts. ex: C, C++

18
Q

What is a loader?

A

In addition to a compiler, the loader loads program into memory, assigns actual
addresses (typically part of OS or shell), ex: C, C++

19
Q

What is a language runtime?

A

In addition to a compiler, the language runtime provides additional code to execute a program on a concrete machine.

 Handles program initialisation and clean-up
 Performs necessary runtime checks
 Manages error handling
 Performs dynamic memory management
 Usually realised as a combination of compiler generated code, libraries and OS calls
 Different languages provide different runtime
environments!
• Java: very powerful (Java Virtual Machine)
• C: minimalistic