Midterm Ready Flashcards

1
Q

What are the reasons for studying concepts of programming languages?

A

Increased ability to express ideas, Improved background for choosing appropriate languages, Increased ability to learn new languages, Better understanding of significance of implementation, Better use of languages that are already known, Overall advancement of computing

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

Name a programming language commonly used for scientific applications.

A

Fortran

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

Which language is primarily used for business applications?

A

COBOL

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

What is the main focus of artificial intelligence programming languages?

A

Symbols rather than numbers manipulated; use of linked lists

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

Identify a programming language used in systems programming.

A

C

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

What are the categories of programming languages?

A

Imperative, Functional, Logic, Markup/programming hybrid

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

List the evaluation criteria for programming languages.

A
  • Readability
  • Writability
  • Reliability
  • Cost
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define readability in the context of programming languages.

A

The ease with which programs can be read and understood

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

What does writability refer to in programming languages?

A

The ease with which a language can be used to create programs

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

What is meant by reliability in programming languages?

A

Conformance to specifications (i.e., performs to its specifications)

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

What is the ultimate total cost in programming languages?

A

Cost

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

Fill in the blank: The ease with which programs can be moved from one implementation to another is called _______.

A

Portability

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

What is the influence of computer architecture on programming languages?

A

Languages are developed around the prevalent computer architecture, known as the von Neumann architecture

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

What are the components of the fetch-execute cycle in the von Neumann architecture?

A
  • Initialize the program counter
  • Fetch the instruction pointed by the counter
  • Increment the counter
  • Decode the instruction
  • Execute the instruction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What did programming methodologies evolve from in the 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
16
Q

What is a characteristic of imperative programming languages?

A

Central features are variables, assignment statements, and iteration

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

True or False: Functional programming languages compute by applying functions to given parameters.

A

True

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

What is the main purpose of hybrid implementation systems?

A

A compromise between compilers and pure interpreters

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

Define the term ‘compilation’ in programming.

A

Translate high-level program (source language) into machine code (machine language)

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

What are the phases of the compilation process?

A
  • Lexical analysis
  • Syntax analysis
  • Semantics analysis
  • Code generation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the von Neumann bottleneck?

A

The connection speed between a computer’s memory and its processor determines the speed of a computer

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

What is the main disadvantage of pure interpretation?

A

Slower execution (10 to 100 times slower than compiled programs)

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

What does the term ‘load module’ refer to?

A

The user and system code together

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

What is the purpose of linking and loading in programming?

A

The process of collecting system program units and linking them to a user program

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

What is one advantage of hybrid implementation systems?

A

Faster than pure interpretation

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

What is a key characteristic of programming languages that allows easy interpretation?

A

Faster than pure interpretation

This characteristic is crucial for efficient programming and debugging.

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

What is the purpose of partially compiling Perl programs?

A

To detect errors before interpretation

This helps in identifying issues early in the development process.

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

What is byte code in Java?

A

An intermediate form that provides portability to any machine with a byte code interpreter and a run-time system

This is executed by the Java Virtual Machine (JVM).

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

What does JIT stand for in programming?

A

Just-in-Time Implementation Systems

JIT systems compile intermediate language to machine code during execution.

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

What is the primary function of preprocessors in programming?

A

To expand embedded preprocessor macros

Examples include #include and #define in C preprocessor.

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

What is an example of a programming environment that is a collection of tools used in software development?

A

Microsoft Visual Studio.NET

This environment supports building both Web and non-Web applications.

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

What are the most important criteria for evaluating programming languages?

A
  • Readability
  • Writability
  • Reliability
  • Cost

These criteria help in choosing the right programming language for a task.

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

What are the major methods of implementing programming languages?

A
  • Compilation
  • Pure interpretation
  • Hybrid implementation

Each method has its own advantages and disadvantages.

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

True or False: Zuse’s Plankalkül was designed in 1945 and published in 1972.

A

True

It was never implemented but introduced advanced data structures.

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

What was the main issue with using machine code?

A
  • Poor readability
  • Poor modifiability
  • Tedious expression coding
  • No indexing or floating point

These limitations led to the development of higher-level programming languages.

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

What was Speedcoding developed for?

A

IBM 701

It introduced pseudo ops for arithmetic and math functions.

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

What was a significant feature of Fortran I?

A

User-defined subprograms

This allowed programmers to create reusable code.

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

What is the significance of Fortran IV?

A

Introduced independent compilation and fixed bugs from earlier versions

It was a major step forward in the evolution of Fortran.

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

What programming paradigm does Lisp primarily follow?

A

Functional Programming

Lisp was designed for AI research and emphasizes processing data in lists.

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

What is a defining feature of Common Lisp?

A

An effort to combine features of several dialects of Lisp into a single language

It is known for its complexity and large feature set.

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

What programming language was developed at MIT in the mid-1970s and is known for its simple syntax?

A

Scheme

It is often used for educational applications due to its small size.

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

What programming feature was introduced in Fortran 90?

A
  • Modules
  • Dynamic arrays
  • Pointers
  • Recursion
  • CASE statement
  • Parameter type checking

These features significantly modernized the Fortran language.

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

What does the acronym AI stand for in the context of programming languages?

A

Artificial Intelligence

Lisp was specifically designed to facilitate AI research.

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

What programming paradigm allows functions to be treated as first-class entities?

A

Functions as first-class entities

This allows functions to be passed as arguments, returned from other functions, and assigned to variables.

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

What is a key feature of Common Lisp?

A

An effort to combine features of several dialects of Lisp into a single language

Common Lisp is large, complex, and used in industry for large applications.

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

What was ALGOL 60 designed to achieve?

A

To design a universal language for communicating algorithms

It was a response to the lack of portable languages that were machine-independent.

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

What were the goals of the early design process for ALGOL?

A

Close to mathematical notation, good for describing algorithms, translatable to machine code

These goals were set during the ACM and GAMM meeting in 1958.

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

What significant concept was formalized in ALGOL 58?

A

The concept of type

This included features like names of any length and arrays with multiple subscripts.

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

What was a major limitation of ALGOL 60?

A

Lack of I/O and string handling

This contributed to its limited adoption despite its theoretical strengths.

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

What was COBOL’s historical background based on?

A

FLOW-MATIC

COBOL features embedded hyphens in names and English names for arithmetic operators.

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

What were the design goals of COBOL?

A

Must look like simple English, easy to use, broaden the base of computer users

These goals were established during the first design meeting in May 1959.

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

What was a significant contribution of COBOL?

A

First macro facility in a high-level language

It also introduced hierarchical data structures and separate data division.

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

What is a characteristic of PL/I?

A

Designed to handle both scientific and business computing

It originated from the need for a single language that could address both types of applications.

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

What did APL emphasize in its design?

A

Highly expressive with many operators for scalars and arrays

It was initially designed as a hardware description language.

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

What are the primary contributions of SIMULA 67?

A

Coroutines, classes, objects, and inheritance

It was primarily designed for system simulation.

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

What was ALGOL 68 known for?

A

User-defined data structures and reference types

It introduced dynamic arrays called flex arrays.

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

What was Pascal primarily designed for?

A

Teaching structured programming

It became the most widely used language for teaching programming from the mid-1970s to late 1990s.

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

What is a defining feature of C?

A

Designed for systems programming with powerful operators but poor type checking

Initially spread through UNIX and has been used in many application areas.

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

What is Prolog based on?

A

Formal logic

It is a non-procedural language and operates as an intelligent database system.

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

What were the design goals of the Basic programming language?

A

Easy to learn and use for non-science students, pleasant and friendly interface

It was the first widely used language with time-sharing capabilities.

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

What was a major concern regarding PL/I?

A

Many new features were poorly designed, too large and complex

These concerns limited its effectiveness and adoption.

62
Q

What is a characteristic of dynamic languages like APL and SNOBOL?

A

Dynamic typing and dynamic storage allocation

Variables acquire a type when assigned a value, and storage is allocated at that time.

63
Q

What type of logic is the intelligent database system based on?

A

Formal logic

The system uses an inferencing process to infer the truth of given queries.

64
Q

Who is Ada named after?

A

Augusta Ada Byron

She is recognized as the first programmer.

65
Q

What was the sequence of requirements for Ada’s design?

A

Strawman, Woodman, Tinman, Ironman, Steelman

This design effort took about eight years and involved hundreds of people.

66
Q

What are some contributions of Ada?

A
  • Packages for data abstraction
  • Exception handling
  • Generic program units
  • Concurrency through tasking model
67
Q

What significant feature was introduced in Ada 95?

A

Support for OOP through type derivation

It also included better control mechanisms for shared data and new concurrency features.

68
Q

What is the main reason for Ada’s decline in popularity?

A

The DoD no longer requires its use and the popularity of C++

69
Q

Who developed Smalltalk?

A

Alan Kay initially, later by Adele Goldberg

Smalltalk is known for being the first full implementation of an object-oriented language.

70
Q

What does C++ combine?

A

Imperative and Object-Oriented Programming

It evolved from C and SIMULA 67.

71
Q

What is the ANSI standard approval date for C++?

A

November 1997

72
Q

What is Swift a replacement for?

A

Objective-C

Released in 2014, it is used by Apple for systems programming.

73
Q

What is the primary use of PHP?

A

Server-side HTML-embedded scripting language

Often used for form processing and database access through the Web.

74
Q

What kind of typing does Python use?

A

Dynamically typed

Python is an OO interpreted scripting language.

75
Q

What is the flagship .NET language?

A

C#

It is part of the .NET development platform and includes features like pointers and delegates.

76
Q

What is XSLT?

A

eXtensible Stylesheet Language Transformation

It transforms XML documents for display.

77
Q

What is meant by syntax in programming languages?

A

The form or structure of the expressions, statements, and program units

78
Q

What does semantics refer to in programming languages?

A

The meaning of the expressions, statements, and program units

79
Q

What is a lexeme?

A

The lowest level syntactic unit of a language

Examples include characters like ‘*’, ‘sum’, and ‘begin’.

80
Q

What is a token in the context of programming languages?

A

A category of lexemes, such as an identifier

81
Q

Who developed Context-Free Grammars?

A

Noam Chomsky in the mid-1950s

82
Q

What is Backus-Naur Form (BNF)?

A

A notation to describe the syntax of programming languages

Invented by John Backus for Algol 58.

83
Q

What does a grammar consist of?

A

A finite non-empty set of rules

84
Q

What is the purpose of a start symbol in a grammar?

A

It is a special element of the nonterminals

85
Q

What is a rule in BNF?

A

It has a left-hand side (LHS) which is a nonterminal and a right-hand side (RHS) which is a string of terminals and/or nonterminals

86
Q

How are syntactic lists described in BNF?

A

Using recursion

Example: <ident_list> → ident | ident, <ident_list></ident_list></ident_list>

87
Q

What is a syntactic list described using?

A

Recursion

The structure is defined as <ident_list> → ident | ident, <ident_list></ident_list></ident_list>

88
Q

What is a derivation in the context of grammar?

A

A repeated application of rules, starting with the start symbol and ending with a sentence

89
Q

What does the grammar <program> expand to?</program>

A

<stmts>

## Footnote

This is part of the example grammar provided.
</stmts>

90
Q

What is a sentential form?

A

Every string of symbols in a derivation

91
Q

What defines a leftmost derivation?

A

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

92
Q

What is a parse tree?

A

A hierarchical representation of a derivation

93
Q

When is a grammar considered ambiguous?

A

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

94
Q

What is the purpose of using a parse tree for precedence levels?

A

To avoid ambiguity

95
Q

What is operator precedence?

A

The rule that multiplicative operators come before additive operators

96
Q

What does associativity of operators define?

A

The order in which operators of the same precedence are evaluated

97
Q

What type of recursion causes problems in syntax analysis?

A

Left recursion

98
Q

What does right recursion indicate?

A

Right associativity

99
Q

What is an example of an ambiguous grammar in Java?

A

<if_stmt> → if (<logic>) <stmt> | if (<logic>) <stmt> else <stmt>
</stmt></stmt></logic></stmt></logic></if_stmt>

100
Q

What is the purpose of Extended BNF?

A

To define optional parts, alternatives, and repetitions in grammar

101
Q

What do brackets [] indicate in Extended BNF?

A

Optional parts

102
Q

What do braces {} signify in Extended BNF?

A

Repetitions (0 or more)

103
Q

What is static semantics concerned with?

A

More syntax than semantics, related to the structure of programs

104
Q

What are attribute grammars (AGs)?

A

Context-free grammars with additions to carry semantic information on parse tree nodes

105
Q

What is the primary value of attribute grammars?

A

Static semantics specification

106
Q

How is an attribute grammar defined?

A

A context-free grammar G = (S, N, T, P) with additional attributes and functions

107
Q

What type of attributes are defined by functions of the form S(X0) = f(A(X1), …, A(Xn))?

A

Synthesized attributes

108
Q

What is a predicate in the context of attribute grammars?

A

A condition to check for attribute consistency

109
Q

What are the two types of attributes defined in attribute grammars?

A

Synthesized attributes and inherited attributes

Synthesized attributes pass information up a parse tree, while inherited attributes pass semantic information down and across a tree.

110
Q

Define synthesized attributes in the context of attribute grammars.

A

Functions of the form S(X0) = f(A(X1), …, A(Xn)) define synthesized attributes

Synthesized attributes are used to pass information up a parse tree.

111
Q

Define inherited attributes in the context of attribute grammars.

A

Functions of the form I(Xj) = f(A(X0), …, A(Xn)) for i <= j <= n define inherited attributes

Inherited attributes pass semantic information down and across a tree.

112
Q

What are intrinsic attributes in attribute grammars?

A

Attributes determined outside the tree, e.g., type of a variable looked up in the symbol table

Intrinsic attributes exist on the leaves of the parse tree.

113
Q

What is the role of expected_type in attribute grammars?

A

Used to store type expected for <expr> as determined by variable of LHS of assignment</expr>

This is an example of an inherited attribute.

114
Q

What is the operational semantics?

A

Describes the meaning of a program by executing its statements on a machine

The change in the state of the machine defines the meaning of the statement.

115
Q

What is the challenge of using a pure hardware interpreter?

A

It would be too expensive

This is a limitation in defining operational semantics.

116
Q

What are the two different levels of uses of operational semantics?

A

Natural operational semantics and structural operational semantics

117
Q

Define denotational semantics.

A

Based on recursive function theory; the most abstract semantics description method

Originally developed by Scott and Strachey in 1970.

118
Q

What does the process of building a denotational specification involve?

A

Define a mathematical object for each language entity and define a function that maps instances of the language entities onto instances of the corresponding mathematical objects

119
Q

What defines the meaning of language constructs in denotational semantics?

A

The values of the program’s variables

120
Q

What is the state of a program in denotational semantics?

A

The values of all its current variables

Represented as s = {<i1, v1>, <i2, v2>, …, <in, vn>}

121
Q

What is the function VARMAP used for in denotational semantics?

A

It returns the current value of the variable when given a variable name and a state

122
Q

What does Mdec represent in the context of decimal numbers?

A

The mapping from character representation of decimal numbers to their integer values

123
Q

What are expressions mapped onto in the context of the discussed semantics?

A

Z ∪ {error}

Expressions can be decimal numbers, variables, or binary expressions.

124
Q

What action does the function Me perform on an expression?

A

It evaluates the expression based on its type, returning either a value or error

125
Q

What does the assignment statement map in the context of semantics?

A

Maps state sets to state sets U {error}

126
Q

What do assignment statements map?

A

State sets to state sets

Maps state sets to state sets U {error}

127
Q

What is the outcome of M_a(x := E, s) if M_e(E, s) equals error?

128
Q

How is the new state s’ defined in assignment statements?

A

s’ = {<i1, v1’>, <i2, v2’>,…,<in, vn’>}

Where vj’ is determined by M_e(E, s) or VARMAP(ij, s)

129
Q

What does M_l(while B do L, s) represent?

A

The execution of a loop while a condition B is true

130
Q

What is the meaning of a loop in programming?

A

The value of program variables after executing the loop statements a prescribed number of times

131
Q

How is recursion compared to iteration in the context of loops?

A

Recursion is easier to describe with mathematical rigor

132
Q

What can denotational semantics be used for?

A

To prove the correctness of programs

133
Q

What is the original purpose of axiomatic semantics?

A

Formal program verification

134
Q

What are assertions in axiomatic semantics?

A

Logic expressions that state relationships and constraints among variables

135
Q

What is a precondition in the context of axiomatic semantics?

A

An assertion before a statement

136
Q

What is a postcondition in axiomatic semantics?

A

An assertion following a statement

137
Q

Define weakest precondition.

A

The least restrictive precondition that guarantees the postcondition

138
Q

What is the form of an axiomatic semantics statement?

A

{P} statement {Q}

139
Q

What is the example given for a precondition in axiomatic semantics?

140
Q

What is the weakest precondition example provided?

141
Q

What is the postcondition for the entire program in program proof process?

A

The desired result

142
Q

What does the axiom for assignment statements state?

A

{Q x->E} x = E {Q}

143
Q

What is the Rule of Consequence in axiomatic semantics?

A

{P} S {Q}, P’ ⇒ P, Q ⇒ Q’ {P’} S {Q’}

144
Q

What is the inference rule for sequences in axiomatic semantics?

A

{P1} S1 {P2}, {P2} S2 {P3} ⇒ {P1} S1; S2 {P3}

145
Q

What is the inference rule for selection in axiomatic semantics?

A

{B and P} S1 {Q}, {(not B) and P} S2 {Q} ⇒ {P} if B then S1 else S2 {Q}

146
Q

What is the inference rule for logical pretest loops?

A

{P} while B do S end {Q}

147
Q

What are the conditions that a loop invariant I must meet?

A
  • I must be true initially
  • Evaluation of B must not change validity of I
  • I is not changed by executing the body of the loop
  • If I is true and B is false, Q is implied
148
Q

What is a loop invariant?

A

A weakened version of the loop postcondition and a precondition

149
Q

What is a challenge in developing axiomatic semantics?

A

Developing axioms or inference rules for all statements in a language

150
Q

How does operational semantics differ from denotational semantics?

A

Operational semantics defines state changes by coded algorithms, while denotational semantics defines them by rigorous mathematical functions

151
Q

What are the three primary methods of semantics description?

A
  • Operational
  • Axiomatic
  • Denotational