PROBLEM SET CHAPTER 1 (PROGRAMMING LANGUAGE CONCEPT)

14. Describe the advantages and disadvantages of some programming environment you have used. - VB - Advantages: Extremely easy to use, even for people who are not computer programmers. Can be used for low level programming on Microsoft computers. Excellent for writing little programs and pieces of programs. Disadvantages: Completely locks you into using the Microsoft product line. Not a true Object oriented language although it claims to be. VB .Net is an object oriented language. Becomes overly complex and difficult to manage on very large programs. Advantages: Speed of the resulting application. C source code can be optimized much more than higher level languages because the language set is relatively small and very efficient. C programming language is very easier to learn. The main advantages of C language is that there is not much vocabulary to learn, and that the programmer can arrange for the program is very fast. - C - Advantage: C programming language is very easier to learn. The main advantages of C language is that there is not much vocabulary to learn, and that the programmer can arrange for the program is very fast. Disadvantages: C does not have OOPS feature that's why C++ is developed. If you know any other modern programming language then you already know its disadvantages. There is no strict type checking (for example: we can pass an integer value for the floating data type). 15. How do type declaration statements for simple variables affect the readability of a language, considering that some languages do not require them? The use of type declaration statements for simple scalar variables may have very little effect on the readability of programs. If a language has no type declarations at all, it may be an aid to readability, because regardless of where a variable is seen in the program text, its type can be determined without looking elsewhere. Unfortunately, most languages that allow implicitly declared variables also include explicit declarations. In a program in such a language, the declaration of a variable must be found before the reader can determine the type of that variable when it is used in the program. 16. Write an evaluation of some programming language you know, using the criteria described in this chapter. Readability Java has some issues with simplicity with respect to readability. There is feature multiplicity in Java as shown in the textbook, example count=count + 1, count ++, count +=1 and ++count. Control statements in Java have higher readibility than BASIC and Fortran because they can use more complex conditionals like for loops Writability Java has a fair bit of orthogonality in that its primitive constructs can be used in various different ways Reliability Java uses a type checker at compile time which virtually eliminate most of the type errors during run time 17. 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. I personally feel that Pascal's usage of the semicolon to separate statement is rather counterintuitive but possibly it's because I learned the usage of the semicolon to terminate statement in C before I learned Pascal. Java consistency is more intuitive than the sructure of Pascal, it's easier to remember not to put a semi colon after a right brace than it is to have watch out for not putting it after each statement. 18. 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. The main disadvantage of using paired delimiters for comments is that it results in diminished reliability. It is easy to inadvertently leave off the final delimiter, which extends the comment to the end of the next comment, effectively removing code from the program. The advantage of paired delimiters is that you can comment out areas of a program. The disadvantage of using only beginning delimiters is that they must be repeated on every line of a block of comments. This can be tedious and therefore errorprone. The advantage is that you cannot make the mistake of forgetting the closing delimiter.

REVIEW QUESTION CHAPTER 1 (PROGRAMMING LANGUAGE CONCEPT)

16. What is exception handling? Exception halding is the ability of a program to intercept run-time errors and other unusual conditions detectable by the program and take corrective measures then continue which is an obvious aid to reliability. 17. Why is readability important to writability? Readability is important to writability because programs that are difficult to read will be difficult to be written or modified. 18. How is the cost of compilers for a given language related to the design of that language? The cost of compilers for a given language is related to the design of it because a languange that requires many run-time type checks will prohibit fast code execution, regardless of the quality of the compiler. 19.What have been the strongest influences on programming language design over the past 50 years? Von Neumann architecture 20. What is the name of the category of programming languages whose structure is dictated by the von Neumann computer architecture? Imperative Language 21. What two programming language deficiencies were discovered as a result of the research in software development in the 1970s? Incompleteness of type checking and inadequacy of control statements (GOTO statements) 22. What are the three fundamental features of an object-oriented program- ming language? Encapsulation, Inheritance, and Polymorphism 23. What language was the first to support the three fundamental features of object-oriented programming? Smalltalk 24. What is an example of two language design criteria that are in direct conflict with each other? Reliability and cost of execution