Minggu, 28 September 2014

ASSIGNMENT I

Lecture:Tri Djoko Wahjono,Ir.,M.Sc.(D0206)

Class:LM01

ASSIGNMENT I

REVIEW QUESTION I


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


A: The selection statement plus GOTO is used to build more complicated control statements such as FOR loop.


12. Q: What construct of programing language provides process abstraction?


A:Subprograms

13. Q: 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.


14. Q: Why is type checking the parameters of a subprogram important?


A: 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. Q: What is aliasing?

A : aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program


PROBLEM SET I


11. Q: Describe some design trade-offs between efficiency and safety in some language you know


A: C today is what assembly language was 10 or 15 years ago. It's the language used when efficiency or low level access to hardware really matters. We 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. Java (and other modern, safe languages like C#) are slower than C.

12 Q: In your opinion, what major features would a perfect programming language include?

A:
  • Maintainability
You are either writing code, or you are fixing it. That’s (roughly) the life of a programmer. Now this encompasses several bits. One is simply the ease of writing new code. If your language provides an easy way to write good, solid code the first time then you hopefully minimize the amount of time spent maintaining it. This is typically a balance of verbosity; type systems requiring more code and effort for the tradeoff of maintainability of having the compiler do some low-level sanity checks for you.

  • Performance
But no matter how easy a programming language makes it to write new code and later debug it, none of it is worth anything if the language is too slow. This is when flexibility is sacrificed, which can often mean sacrificing maintainability in terms of how much extra work is required to accomplish the same thing in a slower language. You can statically declare everything in your language as much as you want, but if all you can do is integer math and array usage (e.g. a Turing machine), you are not exactly going to be productive.


13 Q: 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.)


A:C languange

14 Q:Describe the advantages and disadvantages of some programming environment you have used.

A:

Advantages of C language
  • 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.
  • That leads to a second advantage that C has which is its application in Firmware programming (hardware). That is due to its ability to use/work with assembly and communicate directly with controllers, processors and other devices.
  • 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 of C Language:
  • 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 runtime checking in C language.
  • There is no strict type checking (for example: we can pass an integer value for the floating data type). 
  • C doesn't have the concept of namespace.
  • C doesn't have the concept of constructors and destructors.

15.Q: How do type declaration statements for simple variables affect the readability of a language, considering that some languages do not require them?

A:
  • for structural languange such as C, variable will be easy to read when recode or when fixing the program,because variable listed on the top of the codes.
  • otherwise for modern programming languange such as php declaration not needed,you can use variable anywhere you need it













0 komentar:

Posting Komentar