Concepts of Programming Languages – Chapter 1 – Preliminaries

Review Questions:

6. In what language is most of UNIX written?

UNIX operating system is written almost entirely in C (ISO, 1999), which has made it relatively easy to port, or move, to different machines.

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

Example of lack of orthogonality in C is although C has two kinds of structured data types, arrays, and records (structs), records can be returned from functions but arrays cannot. A member of a structure ca be any data type except void or a structure of the same type. An array element can be any data type except void or a function. Parameters are passed by value, unless they re arrays, in which case they are, in effect, passed by reference ( because the appearance of an array name without a subscript in a C program is interpreted to be the address of the array’s first element). As an example of context dependence, consider the C expression

A + B

This expression often means that the values of a and b are fetched and added together. However, if a happens to be a pointer, it affects the value of b. For example, if a points to a float value that occupies four bytes, then the value of b must be scaled, in this case multiplied by 4, before it is added to a. Therefore, the type of a affects the treatment of the value of b. The context of b affects its meaning.

13. What does it mean for a program to be reliable?

A program is said to be reliable if it performs to its specifications under all conditions. It is including the:

-Type checking. Simply testing for type errors in a given program, either by the compiler or during program execution.

-Exception handling. Ability of a program to intercept run-time errors(as well as other unusual conditions detectable by the program), take corrective measures, and then continue is an obvious aid to readability,

-Aliasing. Having two or more distinct names that can be used to access the same memory cell. Others languages greatly restrict aliasing to increase their reliability.

15. What is aliasing?

Aliasing is having two or more distinct names that can be used to access the same memory cell. Others languages greatly restrict aliasing to increase their reliability.

16. What is exception handling?

Exception handling is ability of a program to intercept run-time errors(as well as other unusual conditions detectable by the program), take corrective measures, and then continue is an obvious aid to readability,

17. Why is readability important to writability?

Because most of the language characteristic that affect readability also affects writability. This follows directly from the fact that the process of writing a program requires the programmer frequently to reread the part of the program that is already written.

29. What is a hybrid implementation system?

Hybrid Implementation System is a compromise between compilers and pure interpreters; they translate high-level language programs to an intermediate language designed to allow easy interpretation.

30. What are the advantages of using Borland JBuilder?

The advantages of Borland JBuilder is the programming environment provided that provides ant integrated compiler, editor, debugger, and file system for Java development, where all four are accessed through a grapahical interface. JBuilder is also a complex and powerful system for creating Java software.

Problem Set

1. Do you believe that solving a problem in a particular algorithmic step requires programming languages skills? Support your opinion.

I believe that solving a problem in a particular algorithmic step requires programming language skills because by using programming language skill we can solve the problem itself easier and more efficient by the features included in the programming language.

2. Who is said to be the first programmer in human history? Use the Internet for help.

Augusta Ada King, Countess of Lovelace (10 December 1815 – 27 November 1852), born Augusta Ada Byron and now commonly known as Ada Lovelace, was an English mathematician and writer chiefly known for her work on Charles Babbage‘s early mechanical general-purpose computer, the Analytical Engine. Her notes on the engine include what is recognized as the first algorithm intended to be processed by a machine. Because of this, she is often considered the world’s first computer programmer.

4. In what way do the languages for scientific applications differ from the languages for business applications? Support your view.

Scientific applications uses relative simple data structure, but required large numbers of floating point arithmetic computations. The most common data structures were arrays and matrices; the most common control structures were counting loops and selections. Rather than business applications, it is characterized by facilities for producing elaborate reports, precise ways of describing and storing decimal numbers and character data, and the ability to specify decimal arithmetic operations. Also scientific is usually used for a specific measurement that scientist does rather than a business application that is purposed for business needs.

5. In what way do the languages for artificial intelligence differ from the languages for web software? Support your view.

Artificial Intelligence is a broad area of computer application characterized by the use of symbolic rather than numeric computations. Symbolic computations means that symbols, consisting of names rather than numbers, are manipulated. Also, symbolic computation is more conveniently done with linked list of data rather than arrays. This kind of programing sometimes requires more flexibility than other programming domains. It is different with web software that is supported by an electric collection of languages, ranging from markup languages, such as HTML, which is not a programming language, to general-purpose programing language. It is clear enough that from the point view of needs, we have already been able to determine that the needs of its each need is different.

6. Which characteristic of programming languages do you think are the most important and why?

I think the most important characteristics of programming languages are writability and readability. Because two of them are the key we can understand to learn programming languages. Moreover both of them scope others characteristic too including the orthogonality and simplicity. Eventually other characteristics are important too.

9. Explain how orthogonality in programming language is closely related to simplicity.

Orthogonality is closely related to simplicity because the more orthogonal the design of a language, the fewer exceptions the languages rules require. Fewer exceptions mean a higher degree of regularity in the design, which makes the language easy to learn, read, and understand.

12.Can we call any programming language complete, in your opinion? Why or why not?

We can’t call any programming language complete because every programming language is created for different needs changing and developing through times. Therefore, a programming language is never said complete so they will have to renew / update or even programmers may have to create a new programming languages.

17. Some programming languages-for example, SQL-use “=” to check the equality of two expressions, while C uses it to assign values to variable. Which of those, in your opinion, is most natural and least likely to result in syntax errors? Support your answer.

I think C is more natural and least likely to result in syntax error. Because the use of “=” as the equality of expression is usually used in the if-statement, instead we often do assigning value rather than comparing equality, hence we use “=” to assign value.

Leave a comment