450 exam 1 Flashcards

1
Q

reasons for studying this course

A
  1. increased ability to express ideas
  2. improved bg for choosing appropriate languages
  3. increased ability to learn new languages
  4. better understanding of significance of implementation
  5. better use of languages that are already known
  6. overall advancement of computing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

four properties of programming languages

A

syntax, names, types, semantics

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

syntax

A

a precise description of a language’s grammatically correct programs

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

names

A

various kinds of entities in a program have names (e.g., variables, functions, parameters, classes, objects, etc.)

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

type

A

a collection of values and a collection of operations on those values

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

semantics

A

the meaning of a program

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

major programming domains

A

scientific, business, systems programming, AI, web software

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

language evaluation criteria (main)

A

simplicity and readability, orthogonality, clarity about binding, reliability, abstraction, support, cost

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

language evaluation criteria (other)

A

writability, portability, generality, well-definedness

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

simplicity and readability

A

small instruction set, simple syntax, ease of learning/programming

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

orthogonality

A

a relatively small set of primitive constructs can be combined in a relatively small number of ways to build the control and data structures; every combination is legal and meaningful

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

a lack of orthogonality leads to

A

exceptions to the rules of the language (and fewer exception rules = conceptual simplicity)

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

binding

A

the association between a variable and a property of that variable (e.g., a variable and its type or value)

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

early binding

A

takes place at compile time

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

late binding

A

takes place at run time

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

reliability

A

program behavior is the same under all conditions

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

with reliability, errors are ? and memory leaks are ?

A

detected and properly trapped; prevented

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

data abstraction

A

programmer-defined classes/types, class libraries

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

procedural abstraction

A

programmer-defined functions, standard function libraries

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

support

A

accessible (public domain) compilers/interpreters/IDEs, good texts and tutorials, wide community of users

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

cost

A

training programmers to use the language, writing/executing programs, maintaining programs (can be 2-4x as much as developing), reliability (poor reliability leads to high costs)

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

writabilty

A

how easily a language can be used to create programs

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

portability

A

the ease with which programs can be moved from one implementation to another

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

generality

A

the applicability to a wide range of applications

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

well-definedness

A

the completeness and precision of the language’s official definition

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

influence of the von Neumann architecture on the evolution of programming languages

A
  1. data and programs stored in MEMORY
  2. instructions and data are PIPED from MEMORY TO CPU
  3. basis for IMPERATIVE languages (variables ~ memory cells, assignment statements ~ piping, iteration/repetition is efficient)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

influence of programming methodologies: 1950s and early 1960s

A

simple applications; worry about machine efficiency

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

influence of programming methodologies: late 1960s

A

people efficiency became important; readability, better control structures

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

influence of programming methodologies: late 1970s

A

data abstraction

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

influence of programming methodologies: middle 1980s

A

domain and data complexity; object-oriented programming

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

influence of programming methodologies: today

A

web and networked environment; parallel and distributed computing

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

four main programming paradigms

A

imperative, object-oriented, functional, and logic (declarative)

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

imperative programming languages

A

Fortran, Cobol, C, Ada, Perl

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

object-oriented programming languages

A

Smalltalk, Java, C++, C#, Python

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

functional programming languages

A

Lisp, Scheme, ML, Haskell

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

logic (declarative) programming languages

A

Prolog

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

imperative programming

A

the oldest; follows von Neumann model of computation

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

program and its variables are stored together in memory

A

imperative programming

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

program = a sequence of commands

A

imperative programming

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

state = values of all variables when program runs

A

imperative programming

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

essential building blocks of imperative programming

A

procedural abstraction, assignments, loops, sequences, conditional statements, etc.

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

object-oriented programming

A

a collection of objects that interact by passing messages that transform the state

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

sending messages, inheritance, polymorphism

A

object-oriented programming

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

functional programming

A

models a computation as a collection of mathematical functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q
input = domain
output = range
A

functional programming

46
Q

characterized by functional composition and recursion

A

functional programming

47
Q

logic (declarative) programming

A

declares what outcome the program should accomplish, rather than how it should be accomplished

48
Q

we see programs as sets of constraints on a problem, programs that achieve all possible solutions, and programs that are nondeterministic

A

logic (declarative) programming

49
Q

implementation methods

A

compilation, pure interpretation, hybrid implementation systems

50
Q

compilation

A

translate high-level programs (source language) into machine code (machine language) by a compiler; fast execution

51
Q

compilation use

A

large commercial applications

52
Q

pure interpretation

A

programs are interpreted by another program known as an interpreter

53
Q

pure interpretation use

A

small programs or when efficiency is not an issue

54
Q

hybrid implementation systems

A

a compromise between compilers and pure interpreters

55
Q

hybrid implementation systems use

A

small and medium systems when efficiency is not the first concern

56
Q

compilation process

A
  1. lexical analysis (convert characters into lexical units)
  2. syntax analysis (lexical units -> parse trees to represent syntactic structure)
  3. semantics analysis (generate intermediate code)
  4. code generation (of machine code)
57
Q

compilation languages

A

Fortran, Cobol, C, C++, Ada

58
Q

pure interpretation

A

easier implementation of programs, slower execution (than compiled programs)

59
Q

run-time errors can easily and immediately be displayed in which implementation method?

A

pure interpretation

60
Q

pure interpretation made a significant comeback with

A

some Web scripting languages (e.g., JavaScript, PHP)

61
Q

purely interpreted languages

A

Scheme, Haskell, Python, APL, SNOBOL, LISP, JavaScript, PHP

62
Q

hybrid implementation languages

A

Perl, initial implementations of Java (JVM), .NET languages

63
Q

hybrid implementation programs are a compromise between

A

compilers and pure interpreters

64
Q

hybrid implementation systems

A

a high-level language program is translated to an intermediate language that allows easy interpretation; faster than pure interpretation

65
Q

example of hybrid implementation system

A

JIT (Just In Time compilation) used in Java and .NET (bytecode -> interpreter)

66
Q

(chapter two)

A

(chapter two)

67
Q

syntax (ch 3)

A

the form (or structure) of the expressions, statements, and program units

68
Q

semantics (ch 3)

A

the meaning of those expressions, statements, and program units

69
Q

sentence

A

a string of characters over some alphabet

70
Q

language

A

a set of sentences

71
Q

lexeme

A

the lowest level syntactic unit of a language (e.g., *, sum, etc.)

72
Q

token

A

a category of lexemes (e.g., identifier)

73
Q

languages can be formally defined in two ways

A

recognizer or generator

74
Q

recognizer

A

a recognition device reads input strings over the alphabet of the language and decides whether the input strings belong to the language

75
Q

example recognizer

A

syntax analysis part of a compiler

76
Q

generator

A

a device that generates sentences of a language

77
Q

language generator

A

used to construct strings, given a start symbol

78
Q

context-free grammars were developed by ? in the ?

A

Noam Chomsky; mid-1950s

79
Q

context-free grammars were meant to

A

describe the syntax of natural languages

80
Q

BNF stands for

A

Backus-Naur Form

81
Q

BNF was created in

A

1959

82
Q

BNF was invented by ? and later modified by ?

A

John Backus (for Algol 58); Peter Naur (for Algol 60)

83
Q

BNF is nearly identical to

A

Chomsky’s context-free grammars

84
Q

BNF was first used to define the syntax of Algol 60, but is now used to define syntax of

A

most major languages

85
Q

in BNF, abstractions (nonterminals) are used to

A

represent classes of syntactic structures

86
Q

in BNF, abstractions (nonterminals) act like

A

syntactic variables

87
Q

in BNF, terminals are

A

lexemes or tokens

88
Q

a BNF rule has a left-hand side (LHS), which is ?, and a right-hand side (RHS) which is ?

A

nonterminal; a string of terminals and/or nonterminals

89
Q

BNF nonterminals are often enclosed in

A

angle brackets

90
Q

BNF grammar

A

a finite non-empty set of rules

91
Q

BNF rules: an abstraction (or nonterminal symbol) can have

A

more than one RHS, where | is a metacharacter that separates alternatives

92
Q

syntactic lists are described using

A

recursion

93
Q

derivation

A

a repeated application of rules, starting with the start symbol and ending with a sentence (all terminal symbols)

94
Q

every string of symbols in a derivation is a

A

sentential form

95
Q

a sentence is a sentential form that

A

only has terminal symbols

96
Q

leftmost derivation

A

one in which the leftmost nonterminal in each sentential form is the one that is expanded

97
Q

a derivation may be either

A

leftmost or rightmost

98
Q

parse tree

A

a hierarchical representation of a derivation

99
Q

each internal node of the parse tree corresponds to

A

a step in the derivation

100
Q

each child node in a parse tree represents

A

a right-hand side of a production

101
Q

each leaf node in a parse tree represents

A

a symbol of the derived string, reading from left to right

102
Q

a grammar is ambiguous if

A

it generates a sentential form that has two or more distinct parse trees

103
Q

a grammar can be used to define

A

associativity and precedence among the operators in an expression

104
Q

associativity and precedence are shown by

A

the structure of the parse tree

105
Q

in a parse tree, operators with highest precedence are

A

at the bottom

106
Q

in a parse tree, an operator is left-associative if

A

on the left at each level (recursion happens on the left of the operator and therefore makes the leaf node lower on the left)

107
Q

in a parse tree, an operator is right-associative if

A

on the right at each level (recursion happens on the right of the operator and therefore makes the leaf node lower on the right)

108
Q

three extensions common to most extended BNF forms

A

brackets, parentheses with vertical bars, braces

109
Q

optional parts of RHSs are placed

A

in brackets [ ]

110
Q

alternative parts of RHSs are placed

A

inside parentheses and separated via vertical bars

111
Q

repetitions (0 or more) are placed

A

inside braces { }

112
Q

review Fortran and Cobol

A

to be able to read and give output (based on HW and examples from class)