Nama : Aditya Isnugraha
Class : LM01
NIM : 1801419606
Assignment from Tri Djoko Wahjono
CHAPTER 1
- REVIEW QUESTIONS
11. 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. What construct of a programming language provides process
abstraction?
Answer :
Subprograms
13. What does it mean for a program to be reliable?
Answer :
A program is said to be reliable if it performs to its specifications under all conditions.
14. Why is type checking the parameters of a subprogram important?
Answer : It can lead to lots of hard to debug errors.
15. What is aliasing?
Answer : 2 or more distinct names that can be used to access the same memory cell.
Assignment 2
- PROBLEM SET
11. Describe some design trade-offs between efficiency and safety in some
language you know.
Answer : C 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.
12. 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. 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 : My first high-level programming language I learned is C++ which is implemented with visual C++ and it is a compiler.
14. Describe the advantages and disadvantages of some programming environment
you have used.
Answer :The advantages of VB are the ease of learning - the syntax is simpler than other languages (although it can be argued that C has more flexibility). The visual environment is excellent (although that's common to all the visual languages). It's widely used and, therefore, well understood.
Disadvantages compared with C: C has better declaration of arrays - its possible to initialise an array of structures in C at declaration time; this is impossible in VB.
15. 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.