Ch1&2 Flashcards

(131 cards)

1
Q

Why is it useful for a programmer to have the ability to learn new languages, even though he or she may have a good knowledge of a number of programming languages?

A

increases their capacity to express ideas;
improved background for choosing appropriate languages;
increases the ability to learn new languages.

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

How can knowledge of programming language characteristics benefit the whole computing community?

A

Lead to the development of better programming languages suited for particular tasks, improving the overall quality of software development.

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

What programming language has dominated scientific computing over the past 50 years?

A

Fortran

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

What programming language has dominated business applications over the past 50 years?

A

COBOL

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

What programming language has dominated artificial intelligence over the past 50 years?

A

LISP

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

In what language is most of UNIX written?

A

C Language

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

What is the disadvantage of having too many features in a language?

A

Programmers might not be familiar with all of the features, hence making it more difficult to learn.

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

How can user-defined operator overloading harm the readability of a program?

A

If the user does not use it sensibly or intuitively, or in a way that diverts extremely from the operator’s intended purpose.

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

What is one example of a lack of orthogonality in the design of C?

A

How arrays and records (structs) are handled

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

What language used orthogonality as a primary design criterion?

A

Algol 68

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

What primitive control statement is used to build more complicated control statements in languages that lack them?

A

Goto

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

What construct of a programming language provides process abstraction?

A

Subprogram

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

What does it mean for a program to be reliable?

A

It performs to its specifications (as expected/programmed) under all conditions.

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

Why is type checking the parameters of a subprogram important?

A

It allows the compiler/run-time system to detect type errors for the purpose of increasing program reliability.

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

What is aliasing?

A

Having two or more distinct names that can be used to access the same memory cell

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

What is exception handling?

A

The ability of a program to intercept run-time errors / other unusual conditions detected, take corrective measures, and then continue.

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

Why is readability important to writability?

A

Writing in a program requires rereading of the already-written parts of a program.

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

How is the cost of compilers for a given language related to the design of that language?

A

Complex design with many features and intricate semantics can be more difficult and expensive to accommodate with a full, efficient compiler.

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

What have been the strongest influences on programming language design over the past 50 years?

A

Computer architecture and programming design methodologies.

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

What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture?

A

Imperative languages

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

What two programming language deficiencies were discovered as a result of the research in software development in the 1970s?

A

Incompleteness of type checking
Inadequacy of control statements

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

What are the three fundamental features of an object-oriented programming language?

A

Inheritance
Encapsulation
Polymorphism

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

What language was the first to support the three fundamental features of object-oriented programming?

A

Smalltalk

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

What is an example of two language design criteria that are in direct conflict with each other?

A

Reliability and cost of execution

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What are the three general methods of implementing a programming language?
Compilation Pure Interpretation Hybrid implementation systems
26
Which produces faster program execution, a compiler or a pure interpreter?
Compiler. In compilation, the translation to machine language is done only once, before execution; pure interpreters decode each statement every time it is executed.
27
What role does the symbol table play in a compiler?
Serves as a database for the compilation process.
28
What does a linker do?
Performs the process of collecting required programs from the OS, and linking them to the user program so it can execute.
29
Why is the von Neumann bottleneck important?
determining the overall speed of the system.
30
What are the advantages in implementing a language with a pure interpreter?
Easy implementation of many source-level debugging operations, Dynamic code execution/modification without requiring recompilation.
31
Do you believe our capacity for abstract thought is influenced by our language skills? Support your opinion.
Yes. The depth at which people can think is influenced by the expressive power of the language with which they communicate their thoughts.
32
What are some features of specific programming languages you know whose rationales are a mystery to you?
The specific choice of certain keywords or the particular syntax for a less-commonly-used feature in a language might not have an immediately obvious advantage or reason for it.
33
What arguments can you make for the idea of a single language for all programming domains?
Saves costs in programming training and compiler purchase and maintenance; Simplifies programmer recruiting and justify the development of numerous language dependent software development aids.
34
What arguments can you make against the idea of a single language for all programming domains?
Greatly-increased complexity needing cost-expensive and maintenance-intensive compilers.
35
Name and explain another criterion by which languages can be judged (in addition to those discussed in this chapter).
One possibility is wordiness. In some languages, more text is required for simpler program statements.
36
What common programming language statement, in your opinion, is most detrimental to readability?
Unrestricted use of unconditional branching statements (like goto), because of issues in tracking program flow.
37
Java uses a right brace to mark the end of all compound statements. What are the arguments for and against this design?
The argument for using the right brace to close all compounds is simplicity/readability—a right brace always terminates a compound statement. The argument against it is that when you see a right brace in a program, the location of its matching left brace is not always obvious.
38
Many languages distinguish between uppercase and lowercase letters in user-defined names. What are the pros and cons of this design decision?
Pros: Increased Number of Possible Names Adherence to Conventions Cons: Potential for Errors Reduced Readability and Maintainability
39
What are the arguments for writing efficient programs even though hardware is relatively inexpensive?
Regardless of the cost of hardware, it is not free. Program scalability and maintenance is also an important and common concern of modern businesses which use software.
40
In your opinion, what major features would a perfect programming language include?
A language that maximizes readability, writability, and reliability and considers cost-effectiveness.
41
How do type declaration statements for simple variables affect the readability of a language, considering that some languages do not require them?
The absence of type declarations can improve readability by allowing variables' types to be determined at their usage. However, languages that mix implicit and explicit declarations require searching for declarations, reducing readability.
42
Some programming languages—for example, Pascal—have used the semicolon to separate statements, while Java uses it to terminate statements. Which of these, in your opinion, is most natural and least likely to result in syntax errors? Support your answer.
Using semicolons as terminators (Java) is generally clearer and less error-prone than using them as separators ( Pascal). Explicitly marks the end of a statement, reducing ambiguity. A standalone semicolon represents an empty statement without confusion. Makes termination more intuitive. Easier to read since the end of a statement naturally aligns with the idea of termination rather than separation.
43
Many contemporary languages allow two kinds of comments: one in which delimiters are used on both ends (multiple-line comments), and one in which a delimiter marks only the beginning of the comment (one line comments). Discuss the advantages and disadvantages of each of these with respect to our criteria.
Paired Delimiters for Comments: Advantage: Allows commenting out large sections of code. Disadvantage: Forgetting the closing delimiter can unintentionally remove code. Single Beginning Delimiters: Advantage: Prevents errors from missing a closing delimiter. Disadvantage: Requires repetition on each line, making it tedious and error-prone.
44
In what year was Plankalkül designed? In what year was that design published?
Designed in 1943-1945 Published in 1972 (27 years later)
45
What two common data structures were included in Plankalkül?
Arrays & Records (structs)
46
How were the pseudocodes of the early 1950s implemented?
Using interpreters.
47
Speedcoding was invented to overcome two significant shortcomings of the computer hardware of the early 1950s. What were they?
Lack of floating-point hardware Limited memory
48
Why was the slowness of interpretation of programs acceptable in the early 1950s?
The lack of floating-point hardware in the available computers.
49
What hardware capability that first appeared in the IBM 704 computer strongly affected the evolution of programming languages? Explain why.
Indexing and floating-point instructions in the hardware, heralded the end of the interpretive era, at least for scientific computation. The inclusion of floating-point hardware removed the hiding place for the cost of interpretation.
50
In what year was the Fortran design project begun?
May 1954.
51
What was the primary application area of computers at the time Fortran was designed?
Scientific programming
52
What was the source of all of the control flow statements of Fortran I?
IBM 704 instructions.
53
What was the most significant feature added to Fortran I to get Fortran II?
independent compilation of subroutines.
54
What control flow statements were added to Fortran IV to get Fortran 77?
Character string handling Logical loop-control statements If-, with an optional Else clause.
55
Which version of Fortran was the first to have any sort of dynamic variables?
Fortran 90 (dynamic arrays).
56
Which version of Fortran was the first to have character string handling?
Fortran 77
57
Why were linguists interested in artificial intelligence in the late 1950s?
Linguists were concerned with natural language processing.
58
Where was LISP developed? By whom?
John McCarthy at MIT in 1959.
59
In what way are Scheme and Common LISP opposites of each other?
Scheme → Static (scoping), Small & Semantically Simpler, used for teaching programming. (‘6S’) Common LISP → Complex and Large. Meant to be a commercial language. (‘2CL’)
60
What dialect of LISP is used for introductory programming courses at some universities?
Scheme
61
What two professional organizations together designed ALGOL 60?
GAMM (Society [GESELLSCHAFT] for Applied Mathematics and Mechanics) Gesellschaft für Angewandte Mathematik und Mechanik ACM (Association for Computing Machinery)
62
In what version of ALGOL did block structure appear?
ALGOL 60.
63
What missing language element of ALGOL 60 damaged its chances for widespread use?
Lack of input and output statements.
64
What language was designed to describe the syntax of ALGOL 60?
Backus-Naur Form (BNF)
65
On what language was COBOL based?
FLOW-MATIC
66
In what year did the COBOL design process begin?
Began in 1959
67
What data structure that appeared in COBOL originated with Plankalkül?
Hierarchical data structure (records).
68
What organization was most responsible for the early success of COBOL (in terms of extent of use)?
The Department of Defense (DoD)
69
What user group was the target of the first version of BASIC?
nonscience students at Dartmouth College.
70
Why was BASIC an important language in the early 1980s?
BASIC was beginner-friendly, easy to learn, especially for those who were not science-oriented Its smaller dialects can be implemented on computers with very small memories.
71
PL/I was designed to replace what two languages?
Fortran, COBOL
72
For what new line of computers was PL/I designed?
IBM System / 360 line of computers.
73
What features of SIMULA 67 are now important parts of some object-oriented languages?
Classes - SIMULA 67 introduced the class construct, a precursor to the abstract data types found in object-oriented languages Objects - Instances of classes can be created and are then the objects of the program Coroutines - It is not common in all OOP languages but this influenced modern concurrency and generator-based programming Data Abstraction - A data structure, in the form of a record, which includes subprograms that manipulate its data
74
What innovation of data structuring was introduced in ALGOL 68 but is often credited to Pascal?
User-defined data types
75
What design criterion was used extensively in ALGOL 68?
Orthogonality
76
What language introduced the case statement?
ALGOL-W
77
What operators in C were modeled on similar operators in ALGOL 68?
Assigning operators
78
What are two characteristics of C that make it less safe than Pascal?
Lack of complete type checking. Unsafe string manipulation.
79
What is a nonprocedural language?
a type of high-level programming language where the focus is on describing what needs to be done rather than how to do it.
80
What are the two kinds of statements that populate a Prolog database?
Facts statements - Define known truths or relationships in the database. Rule statements - Define logical rules that infer new facts based on existing ones.
81
What is the primary application area for which Ada was designed?
Embedded systems
82
What are the concurrent program units of Ada called?
Task
83
What Ada construct provides support for abstract data types?
Packages
84
What populates the Smalltalk world?
Objects
85
What three concepts are the basis for object-oriented programming?
Encapsulation, Inheritance, Polymorphism
86
Why does C++ include the features of C that are known to be unsafe?
to maintain backward compatibility
87
From what language does Objective-C borrow its syntax for method calls?
Smalltalk
88
What programming paradigm that nearly all recently designed languages support is not supported by Go?
Traditional object-oriented programming
89
What is the primary application for Objective-C?
MAC OS X / iPhone software
90
What language designer worked on both C and Go?
Ken Thompson
91
What do the Ada and COBOL languages have in common?
Designed for use by the Department of Defense, with an emphasis on readability and reliability, for mission-critical applications. They have strong typing and extensive modular-programming support.
92
What was the first application for Java?
For interactive television.
93
What characteristic of Java is most evident in JavaScript?
Similar syntax.
94
How does the typing system of PHP and JavaScript differ from that of Java?
PHP/JavaScript → dynamic typing, Java → strong typing
95
What array structure is included in C# but not in C, C++, or Java?
Rectangular arrays
96
What two languages was the original version of Perl meant to replace?
AWK and SHELL scripting (sh).
97
For what application area is JavaScript most widely used?
Web programming
98
What is the relationship between JavaScript and PHP, in terms of their use?
JS + PHP → scripting language used in web dev. JS → client-side (browser); handles user interactions, animations, and dynamic content updates. PHP → server-side, handling database interactions, authentication, and generating dynamic HTML before sending it to the client.
99
PHP’s primary data structure is a combination of what two data structures from other languages?
JS arrays + Perl's hashes
100
What data structure does Python use in place of arrays?
Lists and dictionaries
101
What characteristic does Ruby share with Smalltalk?
Everything is an object
102
What characteristic of Ruby’s arithmetic operators makes them unique among those of other languages?
They are methods of object
103
What data structures are built into Lua?
Tables
104
Is Lua normally compiled, purely interpreted, or impurely interpreted?
Impure.y interpreted
105
What feature of Delphi’s classes is included in C#?
Properties
106
What deficiency of the switch statement of C is addressed with the changes made by C# to that statement?
C’s switch falls through to the next case unless a break is used. C# requires an explicit break.
107
What is the primary platform on which C# is used?
Microsoft. Net platform
108
What are the inputs to an XSLT processor?
XML document and XSLT style sheet
109
What is the output of an XSLT processor?
Transformed XML document
110
What element of the JSTL is related to a subprogram?
action
111
To what is a JSP document converted by a JSP processor?
Converted to a servlet by a JSP processor
112
Where are servlets executed?
Web server
113
What features of Plankalkül do you think would have had the greatest influence on Fortran 0 if the Fortran designers had been familiar with Plankalkül?
Plankalkül included advanced data structure features such as arrays and records that could include nested records, and the assignment statement notation in Plankalkül, expression => variable, may have influenced the design of Fortran.
114
Which of the three original goals of the ALGOL design committee, in your opinion, was most difficult to achieve at that time?
Use a syntax close to standard mathematical notation for readability.
115
Make an educated guess as to the most common syntax error in LISP programs.
Unmatched parentheses are the most common mistake.
116
LISP began as a pure functional language but gradually acquired more and more imperative features. Why?
To increase its execution efficiency.
117
Describe in detail the three most important reasons, in your opinion, why ALGOL 60 did not become a very widely used language.
Excessive flexibility; languages with more-rigid structures were more accepted. Flexibility led to some inefficiency following programmers’ different ways of completing tasks. Its association with Backus-Naur Form alienated the language as strange and complicated. Lack of support from IBM, who was at the time the preeminent company for using computer languages.
118
Why, in your opinion, did COBOL allow long identifiers when Fortran and ALGOL did not?
COBOL required that managers without a background in programming should be able to read programs and English should be used as much as possible.
119
Outline the major motivation of IBM in developing PL/I.
To provide a single tool for computer centers that must support both scientific and commercial applications.
120
Was IBM’s assumption, on which it based its decision to develop PL/I, correct, given the history of computers and language developments since 1964?
IBM’s assumption was mostly incorrect. Commercial applications used languages designed for them, and the same applied to scientific applications.
121
Describe, in your own words, the concept of orthogonality in programming language design.
It is where language features are independent.
122
What is the primary reason why PL/I became more widely used than ALGOL 68?
Due largely to IBM’s promotional efforts and the problems of understanding and implementing ALGOL 68, which had fewer guide resources compared to IBM’s PL/I.
123
What are the arguments both for and against the idea of a typeless language?
FOR: flexibility for the programmer;. Any storage location can store any type value. This is useful for very low-level languages used for systems programming. AGAINST: type checking is impossible; it’s entirely the programmer's responsibility to ensure that expressions and assignments are correct.
124
Are there any logic programming languages other than Prolog?
Datalog, Mercury, Answer Set Programming (‘D.M.ASP”)
125
What is your opinion of the argument that languages that are too complex are too dangerous to use, and we should therefore keep all languages small and simple?
IF too complex: dangerous, may not be adopted. IF too simple: cannot scale, lacks power and flexibility to carry out complex tasks. SOLUTION: consider balance–provide necessary functionalities without too much complexity..
126
Do you think language design by committee is a good idea? Support your opinion.
Yes. With diverse POVs, areas of expertise, programming experience, and even spoken languages, committees can come together to create a language serving a wide range of users and domains.
127
Languages continually evolve. What sort of restrictions do you think are appropriate for changes in programming languages? Compare your answers with the evolution of Fortran.
A good deal of restraint must be used in revising programming languages.
128
Explain two reasons why pure interpretation is an acceptable implementation method for several recent scripting languages.
(1) when the amount of computation is small; processing time will be negligible. (2) When the amount of computation is relatively small and it is done in an interactive environment; processor is often idle because of the slow speed of human interactions.
129
Perl 6, when it arrives, will likely be a significantly enlarged language. Make an educated guess as to whether a language like Lua will also grow continuously over its lifetime. Support your answer.
Lua encouraged extensibility via libraries rather than expanding the language itself. This design philosophy makes Lua’s large-scale growth less likely.
130
Why, in your opinion, do new scripting languages appear more frequently than new compiled languages?
they are often smaller and simpler, and focused on more narrow applications
131
Give a brief general description of a markup/programming hybrid language.
These combine markup language features (used for structuring and presenting content) with programming constructs (used for logic and interactivity); they allow embedding scripts within markup to create dynamic content.