4080 Midterm definitions

0.0(0)
Studied by 16 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/82

Last updated 4:13 AM on 3/16/23
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

83 Terms

1
New cards
Simplicity
A language should help a programmer think about the problem in a clear manner not add complexity to the problem solving processs. the language feature set should be minimal, with the rules on how to apply them and combine them as simply and clear as possible
2
New cards
Orthogonality
Refers to the way the different constructs can be combined, and how these combinations are simple to understand and meaningful in the language
3
New cards
Orthogonality example
int = double + int
4
New cards
Level of abstraction
The degree to which the language allows the definition of powerful data abstractions that approxamitaly construct the problem domain
5
New cards
Portability
Refers to the degree to which a program can be moved, or transported from the system it was created in to another computer
6
New cards
Cost
The total cost of using a programming language. i.e. cost of development, compilation, maintenance, execution, etc…
7
New cards
Expressivity
How flexible is the language in providing concise, different ways of defining algorithms and comuptations.
8
New cards
Design issues: Computer architecture
Languages that introduce powerful abstractions that move away from the underlying architecture model have to tackle the problem of how to bridge the abstraction gap introducing execution and runtime design issues.
9
New cards
design issues: implementation
* compilers: source code is translated to machine code
* interpreters: source code is parsed and executed in real time
* virtual machines: middle ground between complilers and interpreters.
10
New cards
Syntax
Lexicon: alphabet (valid symbols), rules to make words

Grammar: rules to create valid sentences (expressions, statements, programs)
11
New cards
Semantics
The meaning behind the language. Without it the language is useless
12
New cards
Alphabet
The set of all valid symbols in the language (0-9, a-z, A-Z)
13
New cards
reserved words
Set of words that programmers may not use as a name. Some of these words will never be used by the language.
14
New cards
Variables
Holds a value, has a datatype, (name) identifier, can be changed (destructively updated), name for a memory location that holds a value of a particular type and can be destructively updated.
15
New cards
Binding
Connection or relation between a name and a property in a program

\
16
New cards
Types of Binding
Memory (memory allocation), Type, scope
17
New cards
Binding time
binding that happens either before exectution (static binding), or during execution (dynamic binding)
18
New cards
Memory Binding (memory allocation)
The process of reserving a block of memory to a particular name. Data allocated statically lives in the data section and persists throughout execution of the program.
19
New cards
Static Binding (static memory allocation)
The allocation happens before execution typically done by the compiler.
20
New cards
Typing (Type binding)
Refers to the association of a name to a type. Can happen statically and dynamically.
21
New cards
Static Typing
Names are typed (assigned a type) before the program runs
22
New cards
Dynamic Typing
Names are assigned a type as the program runs
23
New cards
Explicit Typing
If a language requires the user to explicitly specify the type of element with a syntactic feature (like a keyword)
24
New cards
Implicit Typing
If a language doesn’t require the user to specify the type of element with a syntactic feature
25
New cards
Scoping (scope binding)
The process of associating a name with a scope
26
New cards
Scope
The region/block/area in the code where a name is visible
27
New cards
Static Scoping (Lexical Scoping)
The scope of a name is defined at programming / writing time with lexical features in the code.
28
New cards
Dynamic Scoping
the visibility of names is determined while the program runs by looking at the stack of activation seconds.
29
New cards
Expressions
Sequence of words/symbols (usually operators and operands) that yields a value (meaning/sentiment)
30
New cards
Operators
A syntactic feature in a language that represents a function that takes input and produces a value. It produces an outcome from an input.
31
New cards
Depending on numer of operands an operator can be classified as:
* unary (one operand !, &)
* binary (2 operands: + - \*)
* ternary (3 operands : ?)
* n-ary (n operands)
32
New cards
Depending on the placement of operands we can classify operators as:
* prefix (operator is before the operand: + 3 4)


* infix (operator is between operands 3+4)
* Suffix (operator placed after operands: x++)
33
New cards
Types
The type T of a name is a property that describes the nature of the data associated with the name, and how it should be handled. Its a property associated with a name (var, const, func) that describes a specific property description of that name (size and how it should be handled)
34
New cards
Common Primitive Types
* integral number types
* floating point numbers
* character types
* boolean types
35
New cards
Integral Number Types
* integers (int) (32 bits)
* longs (long) (64 bits)
* short (16 bits)
* byte (8 bits)
36
New cards
Floating point numbers
* float (32 bits)
* double (64 bits)
37
New cards
Character types
Char

* ASCII (8 bits)
* UNICODE (1-4 bytes)
38
New cards
Boolean Types
bool (8 bits) (Side note: we only need 1 bit but we have to use a full byte)
39
New cards
User defined types
Any type created by the user. The variety of the mechanism used to create these types is high, and the complexity can go from simple enumerations to full blown ADTs
40
New cards
Arithmetic Expressions
Any expression that yields a numerical type
41
New cards
Common Arithmetic Operators
* addition (+, plus)
* subtraction (-, minus)
* multiplication (\*, times, x)
* division (/, div)
* Exponentiation (\*\*, ^)
* Modulo (%, mod)
42
New cards
Order of evaluation
in what order are operands evaluated
43
New cards
Precedence
A mechanism to sort ambiguous expressions by a hierarchy of operators, where the position in the hierarchy determines the relative binding strength of the operator.
44
New cards
Common Precedence order for Arithmetic Operators

1. exponentiation
2. modulo
3. multiplication and division
4. addition and subtraction
45
New cards
Parentheses
If order of evaluation and precedence yield an expression with semantics different than desired then parentheses can be used to override these and impose a particular evaluation order
46
New cards
Side effects
An expression is said to have side effects if evaluating it results in visible change (destructive update) in memory
47
New cards
Expressions with side effects
an expression has a side effect if evaluation of the expression results in visible change (destructive update) in memory. If an expression is side effect free we say it’s pure.
48
New cards
Referential Transparency
an expression is referentially transparent if the substitution of the expression by the value it yields results in a program with the same semantics
49
New cards
Overloading of operators
an operator is overloaded if it performs more than one function depending on the type of operands
50
New cards
Overloading example
“pre” + “fix”

2 + 3
51
New cards
Mixed Mode Expressions
An expression in which you have more than one type of operand
52
New cards
Example of a mixed mode expression
int x = 7

real y = 32.5

int z = x + y

// + is overloaded with both int and floating addition
53
New cards
Type Conversions
In certain circumstances a program will require converting a numerical type into another.
54
New cards
Type Coercion
If the conversion is implicit/automatic
55
New cards
Explicit type conversion (casting)
If a type conversion is explicit and performed with some syntatic feature provided by the language
56
New cards
Overflow
Occurs when an arithmetic operation results in a number greater than the maximum representable number in the current data format
57
New cards
Underflow
Occurs when a floating point operation results in a number that is less than the minimum representable number
58
New cards
Relational Expressions
* Great than (or equal)
* Less than (or equal)
* equals
* not equal
59
New cards
Logical expressions
* Logical and (&, &&, and)
* logical or ( |, ||, or )
* logical not (!, \~, not, -)
* logical implication (implies, =>, →)
60
New cards
Short circuit evaluation
A form of lazy evaluation in which given a logical binary operation, if evaluation of the first operand is enough to determine the value of the expression, then the second operand is not evaluated.
61
New cards
Strings
a sequence of characters usually enclosed by syntatic delimiters (“ “, ‘ ‘, / /)
62
New cards
Design and implementation issues (arrays)
* Arrays: fixed size
* linked lists: slow access to characters in the string, changing content is slow
* array list
63
New cards
Design and implementation issues
arrays, mutability, and types of subscript
64
New cards
mutability
Possible to change the string once created
65
New cards
Type of subscript
Typically integers since indices refers to discrete locations in memory. In some languages arrays may use strings as indices.
66
New cards
arrays
A sequential arrangement of elements (or items) with a fixed size in a continuous block of memory. Accessible because it has an index.

\
The simplest data structure in most imperative languages.
67
New cards
Symbol Table
see image:
see image:
68
New cards
An orthoganal language
It goes hand in hand with simplicity. But when there are a lot of exceptions it violates orthogonality.
69
New cards
Keywords
These are words used by the language for a particular purpose. Reserved words that are acutally used in the language.
70
New cards
Identifiers
Special characters allowed in words
71
New cards
Literals
Numbers, characters, etc…
72
New cards
Integer (bits)
32 bits
73
New cards
short (bits)
16 bits
74
New cards
long (bits)
64 bits
75
New cards
byte (in bits)
8 bits
76
New cards
float
32 bits
77
New cards
double (bits)
64 bits
78
New cards
ASCII (bits)
8 bits
79
New cards
bool (bits)
8 bits
80
New cards
UNICODE (bits)
1-4 bytes
81
New cards
prefix
the operator is **before** the operand: + 3 4
82
New cards
infix
the operator is **between** operands 3+4)
83
New cards
Suffix
the operator placed **after** operands: x++