Assignment #1
Due
2 oct
2014
Pengajar : Tri Djoko Wahjono, Ir, M.Sc.
Review
Question :
11. What primitive control statement is used to
build more
complicated control statements i 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 :
Sub Program
13. What does it mean for a program to be reliable?
Answer :
It’s mean a program can performs to its
specifications under
all conditions.
14. Why is type checking the parameters of a
subprogram important?
Answer :
Because
it can lead to lots of hard to debug errors.
15. What is aliasing?
Answer :
aliasing is
having two or more distinct names that can be used to
access the same memory cell.
Problem Set :
11. Describe some design trade-offs between
efficiency and safety in
some language you know.
Answer :
In C language an element will continue in check so even if no
exception is made, it will break the C language itself would be safer
but the process is much longer because it continue to repeat and it’s
make c
language take more time to process it.
12. In your opinion, what major features would a
perfect programming
language include?
Answer :
In my opinion Syntax, documentation, and error
message are the
most important features in a
perfect programming language.
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
that 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 :
C
Language Advantages :
C
Language has list of advantages due to this it is very much popular language
around the world and best suitable for the programmer to learn at the fist
stage of the programming.
(1). Procedure Oriented Language
C
Language is procedure oriented language, Here user creates procedures or
functions to execute their task.
(2). Lots of Libraries
C
Language provides lots of functions which consist of system generated functions
and user defined functions.
(3). Speed of Compilation
C
compiler produces machine code very fast compared to other language compiler. C
compiler can compile around 1000 lines of code in a seconds or two. One more
benefit of the C Compiler is that it also optimize the code for faster
execution.
(4). Easy to Learn (Syntax is near to English
Language)
C
Language syntax is very easy to understand. It uses keyword like if, else,
goto, switch, goto, main, etc. This kind of keyword we all are using in our day
to day life to convey meaning or to get some decisions.
5. Portable
C
Language setup is around 3-5 MB. So you can carry this language in your Floppy
Drive or Pen Drive. Its very easy to install and operate, Again its output is
exe file which can be executed in any computer without any other framework /
software.
C
Language Disadvantages
Every
coin has two sides, as C Language has also some disadvantages. C Language has
not any major disadvantages but some features is missing in the C Language,
obviously that's why C Language is very much powerful now.
(1). Object Oriented Programming Features (OOPS)
Object
Oriented Programming Features is missing in C Language, You have to develop
your program using procedure oriented language only.
(2). Run Time Type Checking is Not Available
In
C Language there is no provision for run time type checking, for example i am
passing float value while receiving parameter is of integer type then value
will be changed, it will not give any kind of error message.
(3). Namespace Feature
C
does not provides namespace features, so you can't able to use the same
variable name again in one scope. If namespace features is available then you
can able to reuse the same variable name.
(4). Constructor and Destructor is not available
C
does not provides object oriented features, so it don't have Constructor and
Destructor features. Constructor and Destructor is used to construct object and
destroy object.
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.
Tidak ada komentar:
Posting Komentar