Midterm Ready Flashcards

(152 cards)

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
What is one advantage of hybrid implementation systems?
Faster than pure interpretation
26
What is a key characteristic of programming languages that allows easy interpretation?
Faster than pure interpretation ## Footnote This characteristic is crucial for efficient programming and debugging.
27
What is the purpose of partially compiling Perl programs?
To detect errors before interpretation ## Footnote This helps in identifying issues early in the development process.
28
What is byte code in Java?
An intermediate form that provides portability to any machine with a byte code interpreter and a run-time system ## Footnote This is executed by the Java Virtual Machine (JVM).
29
What does JIT stand for in programming?
Just-in-Time Implementation Systems ## Footnote JIT systems compile intermediate language to machine code during execution.
30
What is the primary function of preprocessors in programming?
To expand embedded preprocessor macros ## Footnote Examples include #include and #define in C preprocessor.
31
What is an example of a programming environment that is a collection of tools used in software development?
Microsoft Visual Studio.NET ## Footnote This environment supports building both Web and non-Web applications.
32
What are the most important criteria for evaluating programming languages?
* Readability * Writability * Reliability * Cost ## Footnote These criteria help in choosing the right programming language for a task.
33
What are the major methods of implementing programming languages?
* Compilation * Pure interpretation * Hybrid implementation ## Footnote Each method has its own advantages and disadvantages.
34
True or False: Zuse’s Plankalkül was designed in 1945 and published in 1972.
True ## Footnote It was never implemented but introduced advanced data structures.
35
What was the main issue with using machine code?
* Poor readability * Poor modifiability * Tedious expression coding * No indexing or floating point ## Footnote These limitations led to the development of higher-level programming languages.
36
What was Speedcoding developed for?
IBM 701 ## Footnote It introduced pseudo ops for arithmetic and math functions.
37
What was a significant feature of Fortran I?
User-defined subprograms ## Footnote This allowed programmers to create reusable code.
38
What is the significance of Fortran IV?
Introduced independent compilation and fixed bugs from earlier versions ## Footnote It was a major step forward in the evolution of Fortran.
39
What programming paradigm does Lisp primarily follow?
Functional Programming ## Footnote Lisp was designed for AI research and emphasizes processing data in lists.
40
What is a defining feature of Common Lisp?
An effort to combine features of several dialects of Lisp into a single language ## Footnote It is known for its complexity and large feature set.
41
What programming language was developed at MIT in the mid-1970s and is known for its simple syntax?
Scheme ## Footnote It is often used for educational applications due to its small size.
42
What programming feature was introduced in Fortran 90?
* Modules * Dynamic arrays * Pointers * Recursion * CASE statement * Parameter type checking ## Footnote These features significantly modernized the Fortran language.
43
What does the acronym AI stand for in the context of programming languages?
Artificial Intelligence ## Footnote Lisp was specifically designed to facilitate AI research.
44
What programming paradigm allows functions to be treated as first-class entities?
Functions as first-class entities ## Footnote This allows functions to be passed as arguments, returned from other functions, and assigned to variables.
45
What is a key feature of Common Lisp?
An effort to combine features of several dialects of Lisp into a single language ## Footnote Common Lisp is large, complex, and used in industry for large applications.
46
What was ALGOL 60 designed to achieve?
To design a universal language for communicating algorithms ## Footnote It was a response to the lack of portable languages that were machine-independent.
47
What were the goals of the early design process for ALGOL?
Close to mathematical notation, good for describing algorithms, translatable to machine code ## Footnote These goals were set during the ACM and GAMM meeting in 1958.
48
What significant concept was formalized in ALGOL 58?
The concept of type ## Footnote This included features like names of any length and arrays with multiple subscripts.
49
What was a major limitation of ALGOL 60?
Lack of I/O and string handling ## Footnote This contributed to its limited adoption despite its theoretical strengths.
50
What was COBOL's historical background based on?
FLOW-MATIC ## Footnote COBOL features embedded hyphens in names and English names for arithmetic operators.
51
What were the design goals of COBOL?
Must look like simple English, easy to use, broaden the base of computer users ## Footnote These goals were established during the first design meeting in May 1959.
52
What was a significant contribution of COBOL?
First macro facility in a high-level language ## Footnote It also introduced hierarchical data structures and separate data division.
53
What is a characteristic of PL/I?
Designed to handle both scientific and business computing ## Footnote It originated from the need for a single language that could address both types of applications.
54
What did APL emphasize in its design?
Highly expressive with many operators for scalars and arrays ## Footnote It was initially designed as a hardware description language.
55
What are the primary contributions of SIMULA 67?
Coroutines, classes, objects, and inheritance ## Footnote It was primarily designed for system simulation.
56
What was ALGOL 68 known for?
User-defined data structures and reference types ## Footnote It introduced dynamic arrays called flex arrays.
57
What was Pascal primarily designed for?
Teaching structured programming ## Footnote It became the most widely used language for teaching programming from the mid-1970s to late 1990s.
58
What is a defining feature of C?
Designed for systems programming with powerful operators but poor type checking ## Footnote Initially spread through UNIX and has been used in many application areas.
59
What is Prolog based on?
Formal logic ## Footnote It is a non-procedural language and operates as an intelligent database system.
60
What were the design goals of the Basic programming language?
Easy to learn and use for non-science students, pleasant and friendly interface ## Footnote It was the first widely used language with time-sharing capabilities.
61
What was a major concern regarding PL/I?
Many new features were poorly designed, too large and complex ## Footnote These concerns limited its effectiveness and adoption.
62
What is a characteristic of dynamic languages like APL and SNOBOL?
Dynamic typing and dynamic storage allocation ## Footnote Variables acquire a type when assigned a value, and storage is allocated at that time.
63
What type of logic is the intelligent database system based on?
Formal logic ## Footnote The system uses an inferencing process to infer the truth of given queries.
64
Who is Ada named after?
Augusta Ada Byron ## Footnote She is recognized as the first programmer.
65
What was the sequence of requirements for Ada's design?
Strawman, Woodman, Tinman, Ironman, Steelman ## Footnote This design effort took about eight years and involved hundreds of people.
66
What are some contributions of Ada?
* Packages for data abstraction * Exception handling * Generic program units * Concurrency through tasking model
67
What significant feature was introduced in Ada 95?
Support for OOP through type derivation ## Footnote It also included better control mechanisms for shared data and new concurrency features.
68
What is the main reason for Ada's decline in popularity?
The DoD no longer requires its use and the popularity of C++
69
Who developed Smalltalk?
Alan Kay initially, later by Adele Goldberg ## Footnote Smalltalk is known for being the first full implementation of an object-oriented language.
70
What does C++ combine?
Imperative and Object-Oriented Programming ## Footnote It evolved from C and SIMULA 67.
71
What is the ANSI standard approval date for C++?
November 1997
72
What is Swift a replacement for?
Objective-C ## Footnote Released in 2014, it is used by Apple for systems programming.
73
What is the primary use of PHP?
Server-side HTML-embedded scripting language ## Footnote Often used for form processing and database access through the Web.
74
What kind of typing does Python use?
Dynamically typed ## Footnote Python is an OO interpreted scripting language.
75
What is the flagship .NET language?
C# ## Footnote It is part of the .NET development platform and includes features like pointers and delegates.
76
What is XSLT?
eXtensible Stylesheet Language Transformation ## Footnote It transforms XML documents for display.
77
What is meant by syntax in programming languages?
The form or structure of the expressions, statements, and program units
78
What does semantics refer to in programming languages?
The meaning of the expressions, statements, and program units
79
What is a lexeme?
The lowest level syntactic unit of a language ## Footnote Examples include characters like '*', 'sum', and 'begin'.
80
What is a token in the context of programming languages?
A category of lexemes, such as an identifier
81
Who developed Context-Free Grammars?
Noam Chomsky in the mid-1950s
82
What is Backus-Naur Form (BNF)?
A notation to describe the syntax of programming languages ## Footnote Invented by John Backus for Algol 58.
83
What does a grammar consist of?
A finite non-empty set of rules
84
What is the purpose of a start symbol in a grammar?
It is a special element of the nonterminals
85
What is a rule in BNF?
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
How are syntactic lists described in BNF?
Using recursion ## Footnote Example: → ident | ident,
87
What is a syntactic list described using?
Recursion ## Footnote The structure is defined as → ident | ident,
88
What is a derivation in the context of grammar?
A repeated application of rules, starting with the start symbol and ending with a sentence
89
What does the grammar expand to?
## Footnote This is part of the example grammar provided.
90
What is a sentential form?
Every string of symbols in a derivation
91
What defines a leftmost derivation?
The leftmost nonterminal in each sentential form is the one that is expanded
92
What is a parse tree?
A hierarchical representation of a derivation
93
When is a grammar considered ambiguous?
If it generates a sentential form that has two or more distinct parse trees
94
What is the purpose of using a parse tree for precedence levels?
To avoid ambiguity
95
What is operator precedence?
The rule that multiplicative operators come before additive operators
96
What does associativity of operators define?
The order in which operators of the same precedence are evaluated
97
What type of recursion causes problems in syntax analysis?
Left recursion
98
What does right recursion indicate?
Right associativity
99
What is an example of an ambiguous grammar in Java?
→ if () | if () else
100
What is the purpose of Extended BNF?
To define optional parts, alternatives, and repetitions in grammar
101
What do brackets [] indicate in Extended BNF?
Optional parts
102
What do braces {} signify in Extended BNF?
Repetitions (0 or more)
103
What is static semantics concerned with?
More syntax than semantics, related to the structure of programs
104
What are attribute grammars (AGs)?
Context-free grammars with additions to carry semantic information on parse tree nodes
105
What is the primary value of attribute grammars?
Static semantics specification
106
How is an attribute grammar defined?
A context-free grammar G = (S, N, T, P) with additional attributes and functions
107
What type of attributes are defined by functions of the form S(X0) = f(A(X1), ..., A(Xn))?
Synthesized attributes
108
What is a predicate in the context of attribute grammars?
A condition to check for attribute consistency
109
What are the two types of attributes defined in attribute grammars?
Synthesized attributes and inherited attributes ## Footnote Synthesized attributes pass information up a parse tree, while inherited attributes pass semantic information down and across a tree.
110
Define synthesized attributes in the context of attribute grammars.
Functions of the form S(X0) = f(A(X1), ..., A(Xn)) define synthesized attributes ## Footnote Synthesized attributes are used to pass information up a parse tree.
111
Define inherited attributes in the context of attribute grammars.
Functions of the form I(Xj) = f(A(X0), ..., A(Xn)) for i <= j <= n define inherited attributes ## Footnote Inherited attributes pass semantic information down and across a tree.
112
What are intrinsic attributes in attribute grammars?
Attributes determined outside the tree, e.g., type of a variable looked up in the symbol table ## Footnote Intrinsic attributes exist on the leaves of the parse tree.
113
What is the role of expected_type in attribute grammars?
Used to store type expected for as determined by variable of LHS of assignment ## Footnote This is an example of an inherited attribute.
114
What is the operational semantics?
Describes the meaning of a program by executing its statements on a machine ## Footnote The change in the state of the machine defines the meaning of the statement.
115
What is the challenge of using a pure hardware interpreter?
It would be too expensive ## Footnote This is a limitation in defining operational semantics.
116
What are the two different levels of uses of operational semantics?
Natural operational semantics and structural operational semantics
117
Define denotational semantics.
Based on recursive function theory; the most abstract semantics description method ## Footnote Originally developed by Scott and Strachey in 1970.
118
What does the process of building a denotational specification involve?
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
What defines the meaning of language constructs in denotational semantics?
The values of the program's variables
120
What is the state of a program in denotational semantics?
The values of all its current variables ## Footnote Represented as s = {, , ..., }
121
What is the function VARMAP used for in denotational semantics?
It returns the current value of the variable when given a variable name and a state
122
What does Mdec represent in the context of decimal numbers?
The mapping from character representation of decimal numbers to their integer values
123
What are expressions mapped onto in the context of the discussed semantics?
Z ∪ {error} ## Footnote Expressions can be decimal numbers, variables, or binary expressions.
124
What action does the function Me perform on an expression?
It evaluates the expression based on its type, returning either a value or error
125
What does the assignment statement map in the context of semantics?
Maps state sets to state sets U {error}
126
What do assignment statements map?
State sets to state sets ## Footnote Maps state sets to state sets U {error}
127
What is the outcome of M_a(x := E, s) if M_e(E, s) equals error?
Error
128
How is the new state s' defined in assignment statements?
s' = {, ,...,} ## Footnote Where vj' is determined by M_e(E, s) or VARMAP(ij, s)
129
What does M_l(while B do L, s) represent?
The execution of a loop while a condition B is true
130
What is the meaning of a loop in programming?
The value of program variables after executing the loop statements a prescribed number of times
131
How is recursion compared to iteration in the context of loops?
Recursion is easier to describe with mathematical rigor
132
What can denotational semantics be used for?
To prove the correctness of programs
133
What is the original purpose of axiomatic semantics?
Formal program verification
134
What are assertions in axiomatic semantics?
Logic expressions that state relationships and constraints among variables
135
What is a precondition in the context of axiomatic semantics?
An assertion before a statement
136
What is a postcondition in axiomatic semantics?
An assertion following a statement
137
Define weakest precondition.
The least restrictive precondition that guarantees the postcondition
138
What is the form of an axiomatic semantics statement?
{P} statement {Q}
139
What is the example given for a precondition in axiomatic semantics?
{b > 10}
140
What is the weakest precondition example provided?
{b > 0}
141
What is the postcondition for the entire program in program proof process?
The desired result
142
What does the axiom for assignment statements state?
{Q x->E} x = E {Q}
143
What is the Rule of Consequence in axiomatic semantics?
{P} S {Q}, P' ⇒ P, Q ⇒ Q' {P'} S {Q'}
144
What is the inference rule for sequences in axiomatic semantics?
{P1} S1 {P2}, {P2} S2 {P3} ⇒ {P1} S1; S2 {P3}
145
What is the inference rule for selection in axiomatic semantics?
{B and P} S1 {Q}, {(not B) and P} S2 {Q} ⇒ {P} if B then S1 else S2 {Q}
146
What is the inference rule for logical pretest loops?
{P} while B do S end {Q}
147
What are the conditions that a loop invariant I must meet?
* 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
What is a loop invariant?
A weakened version of the loop postcondition and a precondition
149
What is a challenge in developing axiomatic semantics?
Developing axioms or inference rules for all statements in a language
150
How does operational semantics differ from denotational semantics?
Operational semantics defines state changes by coded algorithms, while denotational semantics defines them by rigorous mathematical functions
151
What are the three primary methods of semantics description?
* Operational * Axiomatic * Denotational
152