Programming Languages

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

1/118

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:40 AM on 9/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

119 Terms

1
New cards

Imperative

2
New cards

functional

programs are constructed by applying and composing

functions (output from one function call serves as an argument to

another function call).

3
New cards

declarative

programs are (logic) statements that express what the

program must do, without specifying how to do it

4
New cards

Object oriented

based on concept of objects that contain data and

classes with methods (code) to apply to data; objects inherit properties from class definitions

5
New cards

Markup

6
New cards

chatbot

7
New cards

compilation

translate source code to machine language to be executed directly on computer's CPU

8
New cards

interpretation

source code commands are executed by an interpreter program

9
New cards

Hybrid

translate source code to intermediate code that can interpreted quickly/easily

10
New cards

Readability

ease with which programs can be read and understood in the context of the problem domain

11
New cards

Writability

12
New cards

Reliability

13
New cards

Cost

the sum of costs of training programmers, effort in writing programs, compiling programs, executing programs, relying on programs, and maintaining programs

14
New cards

Simplicity

has a small number of constructs and clear rules for using them

15
New cards

Orthogonality

An orthogonal language has a relatively small set of primitive constructs, and these can be combined in a relatively small number of ways to build all the control and data structures of the language

16
New cards

expressivity

how convenient or cumbersome is it to specify computation in the language?

17
New cards

Syntax design

how complex are the forms of the language, and how obvious are the meanings of these forms?

18
New cards

data types

the adequacy of facilities for defining data types and data structures

19
New cards

Abstraction support

ability to define and use complicated structures or operations in ways that allow details to be ignored

20
New cards

type checking

what kind of testing for type errors does the language support at compile time and runtime?

21
New cards

Aliasing restriction

does the language limit or eliminate possibilities for more than one reference to the same memory cell to exist?

22
New cards

Exception handling

how does a language support interception of runtime errors, take corrective measures, and continue?

23
New cards

Name

a string that represents an entity in a program

24
New cards

special word

symbol that aids readability by naming predefined actions/programming structures

25
New cards

keyword

word that is special in certain contexts

26
New cards

reserved word

special word that cannot be used as a name

27
New cards

variable

an abstraction of a memory cell

28
New cards

name, value, lifetime, address, type, scope

characterized by a sextuple of attributed

29
New cards
30
New cards

name

identifier used to refer to a variable

31
New cards

address

memory location associated with a variable

32
New cards

value

contents in the variable's location

33
New cards

type

determines variable's values & permitted operations

34
New cards

binding

an association between a variable and an attribute

35
New cards

binding time

time at which a binding is made

36
New cards

language design time

37
New cards

language implementation time

38
New cards

compile time

39
New cards

link/load time

40
New cards

execution time

41
New cards

static binding

a binding is static if it occurs before run time

and remains unchanged throughout program execution

42
New cards

dynamic binding

a binding is dynamic if it occurs during

execution OR can change during program execution

43
New cards

stack-dynamic binding

44
New cards

explicit heap-dynamic binding

45
New cards

implicit heap-dynamic binding


46
New cards

Program call stack

(THE Stack) memory set aside by process to keep track of calls to program units as the program runs.

47
New cards

the heap

memory set aside for process to store and dynamically maintain data as the program runs

48
New cards

stack storage

bound to memory address before execution, and remains bound to same cell throughout execution

49
New cards

static storage

Advantage: efficiency (direct addressing)

Disadvantage: lack of flexibility (no recursion)

50
New cards

stack-dynamic storage

  • Storage allocated on stack for variable when its declaration statement is elaborated (executed)

  • All attributes except address are statically bound


  • advantage:


  • disadvantage: overhead of allocation and deallocation;

    inefficient references (indirect addressing)


51
New cards

explicit heap-dynamic storage

  • allocation and deallocated by explicit directives during execution

  • Advantage: dynamic storage management

  • Disadvantage: occasionally unreliable


52
New cards

Implicit heap-dynamic storage

  • allocation and deallocation caused by assignment statements

  • advantage: flexibility

  • disadvantages: inefficient, all attributes are dynamic, loss of error detection


53
New cards

A language's type binding rules define

  • how types are specified

  • when type bindings take place


54
New cards

Types are specified by explicit or implicit declarations

  • explicit: stated in program source code

  • implicit:


55
New cards

type

determined at compile time

56
New cards

static type binding

  • Advantage: readability, safety, reliability

  • Disadvantages: long compile times, coding can be inflexible


57
New cards

Dynamic type binding

  • Advantage: programming flexibility, writability

• Disadvantages: dynamic type checking takes a lot of time during interpretation (run time); type error detection by compiler is difficult

58
New cards

lifetime of a variable

the time during which the variable is bound to a particular memory cell

59
New cards

allocation

get a cell from some

pool of available cells

60
New cards

deallocation

put a cell back in the free pool

61
New cards

visibility of a variable

where in a program that a variable's value can be accessed

62
New cards

scope of a variable

the range of code statements over which it is visible

63
New cards

local variables of a program unit

declared in the unit

64
New cards

nonlocal variables of a program unit

visible in the unit but not declared there

65
New cards

global variables

nonlocal variables visible over all code

66
New cards

static scope

Based on program’s text (source code)

67
New cards

dynamic scope

Based on calling sequences of program units (methods,

functions, etc), not their textual layout.

68
New cards

dynamic scope

  • Advantage: Convenience in Writing

• Disadvantages: While a subprogram unit is executing, its variables are visible to all subprograms it calls, Impossible to do static type checking, Poor readability - not possible to determine the type of a variable statically

69
New cards

java

  • local: vars defined inside methods; these are created

at function call, not at function definition

  • nonlocal: members of objects passed into a method "this" to reference members of a class class prefix to reference members, global: vars defined as members of program class


70
New cards

Python

  • uses the "namespace" model

  • Local: any variable defined inside a function; these

are created at function call, not function definition

  • Global: all variables defined at topmost level in a

program (outside defs); need to use "global"

keyword when accessing inside a function.

  • Nonlocal: for nested functions; vars defined in

enclosing function are visible to the code in the

enclosed function using "nonlocal".

71
New cards

referencing environment

  • the collection of all names that are visible in the statement

  • In static-scoped languages, it’s the local variables plus all visible variables in all of the enclosing scopes

  • In dynamic-scoped languages, it’s the local variables plus all variables in all active subprograms

  • “active subprogram” = execution has begun but

has not yet terminated

72
New cards

named constants

  • A variable that is bound to a value only ONCE.

  • Advantages: readability and modifiability

  • Advantage: parameterizes programs


73
New cards

data type

a collection of data objects and a set of predefined operations on those objects

74
New cards

object

an instance of a user-defined (abstract data) type

75
New cards

descriptor

the collection of attributes of a variable

76
New cards

primitive data types

A data type that is not defined in terms of other

data types

77
New cards

integer

  • Almost an exact reflection of the hardware, so mapping is trivial

  • There may be as many as eight different integer types in a language

  • EX: Java has byte, short, int, and long

  • Sizes:


78
New cards

floating point

  • Meant to model real numbers, as approximations

  • For scientific use, languages support at least two types: float and double, sometimes more

  • Usually a direct mapping to hardware, but not always


79
New cards

rationals

  • a ratio of integers, represented as pairs of integers

Size:

  • Advantage: supports precise rational arithmetic


80
New cards

complex

  • Each value consists of two floats, the real part and the imaginary part

  • EG: literal form in Python: (7 + 3j)

  • EG: literal form in Lisp: #C(7 3)


81
New cards

decimal

  • (NOT INTEGERS) For business applications

  • Available in COBOL and C#

  • Stores a fixed number of decimal digits, in BCD (binary

coded decimal) form

  • Advantage: Accuracy (includes decimal-point values)

  • Disadvantage: limited range, wastes memory


82
New cards

boolean

  • Simplest of all

  • Range of values: two elements

one for “true” and one for “false”

  • Could be implemented as bits, but

often as bytes

83
New cards

character

  • Values ==> stored as numeric codings

  • ASCII (8-bit, 7-bit) is most common


84
New cards

16-bit unicode

  • includes characters from many human languages

  • first supported in Java

  • C#, JavaScript, Python 3, and Lisp and Swift also support Unicode


85
New cards

32-bit unicode

Fortran, starting in 2003

86
New cards

C and C++

Not primitive; uses char arrays + library

87
New cards

SNOBOL4 (a string manipulation language)

Primitive; many ops, elaborate pattern matching

88
New cards

Fortran and Python and Lisp

Primitive; assignment and several ops

89
New cards

Java

Primitive via String class

90
New cards

static length

COBOL, Java String

91
New cards

limited dynamic length

(C and C++) a special character code (0) indicates end of a string’s content

92
New cards

dynamic (no maximum) length

SNOBOL, Perl, JavaScript, Lisp, Python

93
New cards

benefits and cost of character string type

  • Aid to writability

  • Implementation Issues


94
New cards

user-defined ordinal types

An ordinal type is one in which the range of possible values can be readily associated with the set of positive integers

95
New cards

enumeration types

All possible values, which are named constants, are provided in the definition

96
New cards

pros of enumeration types

  • Aid to readability (no need for magic numbers to

represent non-obvious meanings, e.g. color names)

  • Aid to reliability — better than constants, compiler can

check stuff

  • operator validity (e.g. don’t let colors be multiplied)

  • no enumeration variable can be assigned a value

outside of its defined range

  • Ada, C#, and Java have better support for

enumeration than C: they do not allow enumeration

type variables to be coerced into integer types.

97
New cards

cons of enumeration types

Problem with writability: Some languages require

writing of extra code for reading/writing the values of

an enumeration-typed variable

98
New cards

subrange type

  • An ordered contiguous subsequence of an ordinal type

Aids readability: make it clear to reader that variables of subrange can store only certain range of values

• Aids reliability: assigning a value to a subrange variable that is outside the specified range is detected as an error

• Natively available in Algol68, Pascal, Python, and Ada.


99
New cards

array

a homogeneous aggregate of data elements in which an individual element is identified by its position in the aggregate, relative to the first element

100
New cards

array indexing