Monday, March 25, 2013

Answers of Chapter 3 "Concept of Programming Language"


1. Syntax is the form of programming language's expressions, statements, and program units. Semantics is the meaning of those expressions, statements, and program units
2. Language descriptions is for programming language implementors
3. The general operation of language generator is as same as when a button is pushed and certain languages are generated
4. The general operation of language recognizers is it will scan whether inputted string is inside certain language. If it is, it will accept the string.
5. Sentences are string of a language. Sentential form is each strings in the derivation of each string in sequence.
6.
7. Three common extensions of EBNF : optional part of RHS is delimited by brackets, the enclosed part can be repeated indefinitely or left out left alltogether.
8. static semantics is only indirectly related to the meaning of programs during execution. Dynamic semantics is not universally accepted in notation.
9. Predicates function as boolean expression on the union of the attribute set and a set of literal attribute values
10. Synthesized attributes are used to pass semantic information up a parse tree while inherited attributes pass smenatic information down and acroos a tree
11. the parse tree is evaluated based on its underlying BNF grammar, wit a possibility of having empty set of attributes values attached to each node.
12. Attribute grammars are used to describe more of the structure of a programming language than can be described with a context-free grammar.

Problem Set
1. Example of syntax error in C programming language : while boolean_expr  -> no brackets before and after the boolean expression.
Example of semantics error in C programming language : while (angka) {}  -> but, the variable 'angka' is never defined by user before

2. a. class { }
    b. ( ) ;
    c. switch ( ) { case : }
    d. union { };
    e. float ;

3. -> =
    -> A|B|C
    -> +
                 |
    -> *
                 |
    -> ( )
                    |

4.
5.
6. a.   -> =
          -> A|B|C
          -> +
                       |   * ( )
                       |  ( )
                       |
    b.   -> =
          -> A|B|C
          -> +
                       |   *
                       |  ( )
                       |  < id> *
                       |   +

    c.   -> =
          -> A|B|C
          -> * ( )
                       |   +
                       |  ( )
                       |
15.  expression -> var {(+ | -) var}
16. expr -> expr {(+ | *) expr}
21. a. do{                                            loop: expr1;
          expr1                                         if(expr==0) goto out;
          }while(expr2);                            else goto loop;
                                                            out : ...
     b. expr1;
         loop : if expr2 ==0 goto out
         ...
         expr3;
         goto loop
         out : ...
     c. if expr1==0 then expr2;
         else expr3;
     d. expr1;
         loop : if expr2 ==0 goto out
         ...
         expr3;
         goto loop
         out : ...
     e. if expr1 == 1 then expr2;
        else if expr2 == 1 then expr3;;
        else if expr3 == 1 then expr4;
        ...

Monday, March 4, 2013

Answers of Concepts of Programming Languages Chapter 2

A. Review Questions
1.      Plankalkul was designed in 1945 and published in 1972.
2.      One of most interesting features of Zuse’s programs is the inclusion of mathematical expressions showing the current relationships between program variables.
3.      Plankalkul means program calculus.
4.      Two significant shortcomings in 1950’s that was overcome by Speedcoding were lacking of floating-point arithmetic operations and lacking of indexing of some sort to allow the convenient use of arrays.
5.      Words of UNIVAC I’s memory had 72 bits, grouped as 12 six-bit bytes.
6.      -
7.      John Backus invented the Speedcoding for IBM 701.
8.      Short code was developed by John Mauchly. It was called automatic programming because it simplified the programming process although spent more execution time.
9.      -
10.   The most significant feature added to Fortran I to get Fortran II is the independent compilation of subroutines.
11.   Character string handling, logical loop control statement and an if without an optional else clause were added to Fortran IV to get Fortran 77.
12.   Fortran 90 is the first version of Fortran which support dynamic variables.
13.   The first version of Fortran supporting character string handling is Fortran 77.
14.   Because they were concerned with natural language processing, when in 1950’s, there are only computers with computation based on numeric data in arrays.
15.   -
16.   Scheme is characterized by its small size and its exclusive use of static scoping, while Common LISP is characterized by its large and complex language, but has pure LISP basis and allowance to both static scoping and dynamic scoping.
17.   Scheme is mostly used for courses in functional programming.
18.   Association for Computing Machinery (ACM) and German acronym for Society for Applied Mathematics and Mechanics (GAMM) are the two companies which started to design ALGOL 60

B. Problem Set

1.      The significant feature on Fortran IV that will be a great influence on Java is the ability to pass subprograms as parameters to other subprograms. In Java, it is impossible to write stand-alone subprograms which cause it is hard to connect between subprograms.
2.      Short Code is capable of making multiplication without multiplication code needed, just put two operands side-by-side. Besides, it also uses pure interpreter to run itself. Comparing to a contemporary programmable hand calculator, surely Short Code will do the calculations slower than the calculator because Short Code uses interpreter. Short Code offers simpler syntax to do multiplication, however.
3.      -
4.      -
5.      I think to reach the efficiency of hand-coded program was quite hard at that time, because we only had computer with small memories in past. In computer with small memories, it was hard to create a fast compiler of hand-coded program, especially when the program is typed quite long, which obviously will consume the efficiency of time.
6.      -
7.      -
8.      -
9.      Because in that day, scientist often used the variable I,J,K to refer to their integer in their work in science. Moreover, Fortran was built for scientific application, therefore, in order to give more comforts to users (scientists), it allows those variables.
10.   The most important new developments of ALGOL 60 are:
a.      The concept of block structure was introduced
b.      Two different means of passing parameters to subprograms were allowed : pass by value and pass by name
c.      Procedures were allowed to be recursive
d.      Stack-dynamic arrays were allowed
11.   The assumption is correct because in that 1970’s, PL/I is widely used for both business and scientific applications although it suffers a lot in previous years and afterwards.
12.   A
13.   Because C was part of widely used UNIX operating system
14.   When we user typeless language, it requires us to be sharper in using the variables because all variable can contain different data types. At the same time, it also delivers simplicity of the code writing.
15.   Yes there are some nonprocedural languages other than Prolog, for example, Visual Basic, SQL.
16.   To some extent I agree to that argument, but to some extent, I also don’t agree. Too complex language is too hard to be written, that’s why there is higher possibility for a bug to occur. That’s why simple and small language is preferred. However, with complex language, it means other people are having hard time as well to understand the code which made the code to be safer to use.
17.   There is no language that can fulfills all requirements of its users, because in order to build that language, large number of memory is needed while today’s computer is not so advanced yet (although it is advancing). Furthermore, more and more needs of computer are appearing, which also means more and more requirements to be fulfilled by a language which never makes a language to be perfect.
18.   I think restriction in efficiency is important to language development. In any language development, building a more efficient language than before is crucial since it will consume less memory which will support the green computing as well. Furthermore, by having efficiency, it is lighter, so it will reach more users.
19.   -
20.   Features of Fortran :
a.      Supports dynamic arrays, records, pointers, multiple selection statement, modules
b.      String handling
c.      Capability of passing subprograms as parameters to other subprograms
d.      Forall construct iteration made
Features of C:
·        Supports dynamic pointers, multiple selection statement
·        String handling
·        Capability of passing subprograms as parameters to other subprograms
Features of BASIC:
·        Easy to learn
·        Small in size
·        Supports graphical user interface
21.   -
22.   -
23.   Lua certainly will attract more and more users to use it because it is now being used rapidly in gaming industry, which is very fast in development right now. Furthermore, it has great similarities with other famous languages, like Java, PHP, Scheme. Those similarities will make it to be more easy to be used from user with different background. In addition, although user who is going to use this language doesn’t have any background of programming language, this can be a good start point too because it has many same features with other languages.
24.   Because in today, scripting language, especially Javascript, is widely used in World Wide Web. As we can see today, internet has been a must need to every people to get information. To get advantage of this development, more and more scripting language is developed in order to fulfill user’s expectation, as well as to attract them to get more profits.
25.   Servlet is an instance of a Java class that resides on and is executed on a Web server system for form processing purpose and database access purpose. The execution of servlet is requested by a markup document displayed by Web browser. Then the request is processed by servlet container in the Web server. Lastly, the output of it is returned to the Web browser again. 

Answers of Concepts Programming Languages Chapter 1

A. Review Questions
1.      Because by studying programming design, he/she will get the following benefits :
a.      Increased capacity to express ideas
b.      Improved background for choosing appropriate language
c.      Increased ability to learn new languages
d.      Better understanding of the significance of implementation
e.      Better use of languages that are already known
f.       Overall advancement of computing
2.        -
3.      Fortran
4.      COBOL
5.      LISP
6.      C
7.      - 
8.      - 
9.      One of the example of orthogonality lack in C language is the expression of “a + b”, where a happens to be a pointer. When the addition wanted to be done, the value of b needs to be multiplied by 4 at first. Therefore, the type of a determines the treatment to b.
10.   Program which built based on orthogonality is ALGOL 68, although it causes unnecessary complexity because of the large number of orthogonalities it has.
11.    -
12.   In contemporary programming language design, we can find the abstraction support because abstraction is the key concept in that programming language design.
13.   A reliable program is a program which can performs to its specifications under all conditions.
14.   Because if we don’t type check the parameters in the subprogram, it will led to countless program error and the function/subprogram only will produce nonsense product.
15.   Aliasing is when we have two or more pointers pointing to the same address/memory cell.
16.   Exception handling is the facility included in programming languages to intercept run-time errors, take corrective measures, and continue the program.
17.   Programs that are difficult to read is also difficult to write and to modify
18.    -
19.   In the past 50 years, programming language design has been influenced by von Neumann architecture.
20.   The programming language used in von Neumann architecture is imperative languages.
21.   Two major programming language deficiencies identified in 1970’s were incompleteness of type checking and inadequacy of control statements.
22.   Three fundamental features of object-oriented programming are data abstraction, inheritance and dynamic method binding.
23.   The first object oriented programming program is Smalltalk.
24.   An example of two languages which in direct conflict with each other is between object-oriented programming and procedure-oriented programming.
25.   Three general methods of implementing programming language are compilation, pure interpretation, and hybrid implementation systems.
26.   Compiler does faster job in executing program because it will translate the whole code first and then compile it.
27.   Symbol table serves as a database for the compilation process in compiler. Symbol table contains the type and attribute information of each user-defined name in the program.
28.   Byte code provides the portability to any machine that has a byte code interpreter and an associated run-time system.
29.   Hybrid implementation system is the combination of compiler and interpreter. It translates the high-level language to an intermediate language designed to allow easy interpretation and then the source language statements are decoded once.
30.   By using Borland JBuilder, we have a complex and powerful system for creating Java software

B. Problem Set
1.    I don’t think that to solve a problem in a particular algorithmic step, we need to learn programming language because the key to solve the problem relies on our logic. Although we learned or not learned about any programming languages, but we have the understanding on the way to solve it and can think logically, the problem can be solved.
2.    The first programmer in human history is Ada Lovelace.
4.    Scientific applications concern about the efficiency of the program and there are also quite many applications designed for this purpose. While in business application, less application was made because it requires certain programming language, in this case is the COBOL language. In business application, the precision of the result is the main concern.
5.    In Artificial Intelligence (AI) application, it uses symbolic computations, where symbols are manipulated. It also requires more flexibility than other programming domains. While in web software, programming languages are not widely needed. Scripts and markup languages are the basic languages used in web software.
6.    I think simplicity of a programming language is the most important thing because by having simplicity in a language, it enhances the chance of a person to understand that language faster while more and more programming languages appear. By having great simplicity, more programmers will use that language and more people understand about the code written in that language.
7.    The advantages of using semicolon in Java: it enhances the readability of the program since it makes it clear where a statement ends. It also will make the programmer to adapt faster in other programming languages using this same feature, like C, C++, PHP, etc.
        The disadvantages of using semicolon in Java: it requires more check whether there is semicolon in the end of every statement. It also needs to differentiate between statement and not statement.
8.    Pros: it shortens the length of the codes needed especially for the processes needed repeatedly. It also will help in debugging when errors happen because the code has been separated.
        Cons: it requires more type-checking. It adds more complexity to the language. 

Tuesday, February 26, 2013

Link for C++ How to Program 7th Edition

I heard that people are finding 7th edition, rather than 8th one. Below I give the link :) Enjoy! :D
Click here !

Link for C++ How to Program 8th Edition

I found that many people searching for this book and luckily I found a link to download e-book of it.
Kindly click here if you want to download the e-book :)

Thursday, January 17, 2013

Answers of Chapter 15 "Discovering Computers 2011 : Living in a Digital World"


True/False
1. True
2. False
3. True
4. True
5. True
6. False
7. True
8. True
9. True
10. False

Multiple Choice
1.a
2.c
3.c
4.a
5.d
6.b
7.a
8.b

Matching
1.e
2.d
3.j
4.g
5.h
6.b
7.f
8.i
9.a
10.c

Short Answers
1. The advantage of attending trade school is time saving in learning something, because in trade school, they teach focusly on what you choose.
We should consider curricula, laboratory facilities, instructors, and the types of jobs the school's graduates have obtained, before attending the trade school.

2. Participating in professional growth and continuing study, we can get specific information of equipment, software, services, and issues affecting the computer industry.
The ways to keep knowing the growth of industry trends and technologies are professional organizations
and personal networks, professional growth and continuing education activities, computer publications and Web sites, and certification

3. The how-to when choosing certification :
(1) see again your career goals and interests
(2) assess your background knowledge and experiences
(3) find the best certification that suites you

The four options when preparing certification:
(1) self study : study by yourself using all medias available right now
(2) online trainning classes : allows users to interact and study in the online class using the Internet facility
(3) Instructor-led training : the training held by a instructor through different types of seminars, trainings
(4) web resources : study from the links given that will help you understand more about the material

4. The programmer/developer certification mainly focuses on the ability of the programmer to code / make a program. Other type of certification that may be beneficial too is in networking and Web design certification.

People who might interested in programmer/developer certification :
• Java programmers
• Mobile application developers
• Oracle database managers
• Programming consultants
• SQL programmers
• Web software developers
• XML developers

5. Hardware certifications test whether the candidates have the ability to repair certain hardware and also to identify the computing needs of a company while the at same time, introducing the solution for the needs.

People who might interested in programmer/developer certification:
• Cable installation technicians
• Computer repair technicians
• Corporate trainers
• Help desk specialists
• IT consultants
• System engineers and administrators

Answers of Chapter 14 "Discovering Computers 2011 : Living in a Digital World"


True/False
1. True
2. False
3. True
4. True
5. False
6. False
7. True
8. True
9. True
10. True

Multiple Choice

1.c
2.b
3.a
4.b
5.a
6.d
7.a
8.d


Matching
1.h
2.f
3.b
4.e
5.d
6.g
7.a
8.j
9.i
10.c


Short Answers
1. Managers's responsibilities are in coordinating and controlling the resources of an organization.
The activities done by manager to coordinate the resources of an organization : planning, organizing, leading, controlling.

2. CMS is an information system that combines databases, softwares, and procedures that allow users to access to many forms of files.
Types of content that may be processed by CMS : images, multimetida datas, security controls, metadata.

3. Server virtualization : can divide physical servers to many virtual servers, and storage virtualization : can combine many physical storage devices into single logical storage.
Cloud computing is a service using Internet to give computer needs to users. Grid computing is the networking, which combines many servers and/or PC into one large computer.

4. E-retail, finance, travel, health, and entertainment and health.
E-retail : occurs when users want to sell their product online. Health : websites providing up-to-date medicines, health information, exercises to the world. Travel : websites allowing users to know how-to reach certain places from their current place, or to book a flight.

5. Backup plan should contain the location of alternate computer facility in case of the organization's event normal location is destroyed.

The aspects contributing to the success of a backup plan : backing up all important resources, numbers of people trained in the backup and recovery procedures.