Pada kesempatan kali ini saya akan menjawab soal-soal yang ada dalam buku "CONCEPTS OF Programming Languages (TENTH EDITION)" - ROBERT W. SEBESTA. Chapter 1 Preliminaries
Review Question
11. Question : What primitive control statement is used to build more complicated control statements in languages that lack them ?
Answer : The selection statement plus GOTO is used to build more complicated control statements such as FOR loop.
12. Question : What construct of programing language provides process abstraction ?
Answer : Subprograms
13. Question : What does it mean for a program to be reliable ?
Answer : Program is said to be reliable if it performs to its specifications under all conditions.
14. Question : Why is type checking the parameters of a subprogram important ?
Answer : It can lead to lots of hard to debug errors. One example of how failure to type check, at either compile time or runtime, has led to countless program errors is the use of subprogram parameters in the original C language
15. Question : What is aliasing ?
Answer : Aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program
Problem Set
11. Question : Describe some design trade-offs between efficiency and safety in some language you know ?
Answer : C today is what assembly language was 10 or 15 years ago. It's the language you use when efficiency or low level access to hardware really matters to you. You can, of course, still use assembly language today. But optimizing C/C++ compilers are so good today, that they can often trump hand coded assembly language.
So C is very fast, and very good for low level, hardware level access. Do you need those features? Let's assume you aren't writing device drivers, so you don't need hardware access. It's all about speed.
12. Question : In your opinion, what major features would a perfect programming language include ?
Answer : High-level of abstraction with low-level efficiency. Such languages already exist, but none are "perfect" in every situation. That's one of the reasons we have so many languages at our disposal. It would be impractical to combine them into a single language, you simply choose the best tool for the job at hand.
13. Question : Was the first high-level programming language you learned implemented with a pure interpreter, a hybrid implementation system, or a compiler ? (You may have to research this.)
Answer : The programming language is C. It was implemented with a compiler.
14. Question : Describe the advantages and disadvantages of some programming environment you have used ?
Answer : C++ - Best suited for general purpose and low level programming.
Advantages: Extremely fast, works very well for GUI programming on a computer. Good language to write operating systems, drivers, and platform dependent applications with. Good language to learn to program with. Good language for engineers.
Disadvantages: Although it is platform independent, it is mostly used for platform specific applications. A library set is usually chosen that locks you into a single platform or operating system. Overly complex for very large high level programs. Overly complex and difficult to debug when used for web applications. Marketable skills are low level programming, vendor software, and video games, making it difficult to find jobs unless you have are very advanced in a target area.
VB - Used mainly to modify and complement the Microsoft product line.
Advantages: Extremely easy to use, even for people who are not computer programmers. Allows the typical computer user to modify MS Office applications to suite their needs. Works very well on a Microsoft intranet to complement the network shares and permissions. Can be used for low level programming on Microsoft computers. A marketable skill set. 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.
15. Question : How do type declaration statements for simple variables affect the readability of a language, considering that some languages do not require them ?
Answer : 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.
Tidak ada komentar:
Posting Komentar