Tuesday, March 26, 2013

KBP - Chapter 3

Review Question

1. Define syntax and semantics.

   Syntax is the form of its expressions, statements, and program units.
   Semantics is the meaning of those expressions, statements, and program unit.

2. Who are language descriptions for?

   For Language Recognizers and Language Generators.

5. What is the difference between a sentence and a sentential form?

   A sentence is the string of a language, while sentential form is each of the strings in derivation.

21. When is a grammar rule said to be left recursive?

    When a grammar rule has its LHS also appearing at the beginning of its RHS.

22. Give an example of an ambiguous grammar.

    Example :

       <assign> -> <id> = <expr>

       <id> -> A|B|C
       <expr> -> <expr> + <expr>
                | <expr * <expr>
                | (<expr>)
                | <id>

28. What is the use of the wp function? Why it is called a predicate transformer?

    Wp fuction is the least restrictive precondition that will guarantee the validity of the associated postcondition.
    It's called predicate transformer because it takes a predicate, or assertion, as a parameter and returns another predicate.

29. Give the difference between total correctness and partial correctness.

    Total correctness is the loop that can be shown, while partial correctness is the other condition that can be met, but termination is not guaranteed.

_______________________________________________________________________
Problem Set


1. Syntax error and semantic error are two types of compilation error.
    Explain the difference between the two in a program with examples.
    
    Syntax error --> struct Abc
                            {
                                int value;
                                char name[100];
                            }
                note : it should be like this :
                           struct Abc
                          {
                               int value;
                               char name[100];
                          };

    Semantic error --> for(int i=0;i<5;i--)
                                  {
                                        printf("Hey!"); printf("\n");
                                  }
                note : it should be like this :
                               for(int i=0;i<5;i++)
                               {
                                     printf("Hey!"); printf("\n");
                               }

3. Rewrite the BNF of Example 3.4 to represent operator – and operator / instead of operator + and operator *.
    <assign>-> <id> = expr
<id> -> A| B| C
<expr>-> <expr> -<term>
|<term>
<term>-> <term> / <factor>
| <factor>
<factor> -> (<expr>)
|<id>

6. Using the grammar in example 3.2, show a parse tree for each of the following statements:
   a).    =
         /   \
       a      *
             /   \
           *       a
         /   \
       b      +
             /   \
           c      a
         
   b).    =
         /   \
        b     *
             /   \
           +      c
          / \
        a    *
            /  \
          c     b

   c).    =
         /   \
        a     +
             /  \
            *    a
          /  \
        b     c

7. Using the grammar in example 3.4, show a parse tree for each of the following statements:
   a). A = (A*B)+C

<assign>-><id>=<expr>
<id>->A|B|C
<expr>-><id>+<expr>
|<term>
<term>-><term>*<factor>
|<factor>
<factor>->(<expr>)
|<id>

   b). A=B*C+A
<assign>-><id>=<expr>
<expr>-><expr>+<id>
|<term>
<term>-><term>*<factor>
|<factor>
<factor> -> (<expr>)
|<id>

   c). A = A + (B*C)
<assign>-><id>=<expr>
<expr>-><id>+<expr>
|<term>
<term>-><term>*<factor>
|<factor>
<factor>->(<expr>)
|<id>

   d). A = B*(C+(A*B))
<assign>-><id>=<expr>
<expr>-><id>*<expr>
|<term>
<term>-><term>+<factor>
|<factor>
<factor>-><id>*<id>
|<id>

13. Write a grammar for the language consisting of strings that have n copies of the letter a followed by double the number of copies of the letter b, where n >0. For example the strings abb, aabbbb, and aaabbbbbb are in the language but, a, aabb, ba, and aaabb are not.

    S-> aSb |ab 


18. What is a fully attributed parse tree?
    The tree is said to be fully attributed if all the attribute in a parse tree have been computed.

24. Compute the weakest precondition for each of the following sequences of assignment statements and their postcondition:
    a). b=a-3 --> b<0
        a-3<0 --> a<3

        a=2*b+1 --> a<3
        2*b+1<3 --> 2*b<2 --> b<1

    b). b=2*a-1 --> b>5
        2*a-1>5 --> 2*a>6 --> a>3

        a=3*(2*b+a) --> a>3
        3*(2*b+a)>3 --> 6*b+3*a>3 --> divided by 3 --> 2*b+a>1 --> b>(1-a)/2

Monday, March 11, 2013

KBP - Chapter 2

Review Questions

2. Its mixed one-dimensional and two-dimensional layout, which has puzzled many readers of the original document.
3. Plankalkul means "plan kalkulus" which means "formal system for planning".
5. The num of bits in a single word of the UNIVAC I's memory is 72 bits, and grouped as 12 six-bit bytes.
7.The speedcoding system developed by John Backus for the IBM 701.
8.The shortcode was developed by John Mauchly in 1949. Shortcode called automatic programming because it was implemented with a pure interpreter, not translated to machine code.
10. The most significant feature added to Fortran I to get Fortran II is Independent-compilation capability.
11. Logical loop statements and IF with an optional ELSE were added to Fortarn IV to get Fortran 77.
12. Fortran 90 was the first to have any sort of dynamic variables.
13. FOrtran 77 was the first to have character string handling.
16. Common LISP allows for static scoping and dynamic scoping, Scheme only uses static scooping. Scheme is relatively small while Common LISP is large and complex.
17. Scheme dialect is used to intriductory programming courses at some universities.
18. Two professional organizations together designed ALGOL 60 were ACM and GAMM.
20. Algol 58 introduced code blocks and the begin and end pairs for delimiting them, Algol 60 was the first language that implementing nested functions definitions with lexical scope.
21. BNF language was designed to describe the syntax of ALGOL 60.
22. On flow-matic language was COBOL based.
46. The primary application for Objectives-C is MacOS/iOS - iPhone.
49. A programming language for embedded consumer electronic devices was the first application for Java.


___________________________________________________
Problem Set

1. Logical data type and logical boolean expression, with this, we can create simple version of the complex compile, and link processes of earlier compilers.
6. Undefined escape sequences in literal strings. The backslash character can be used in literal strings and characters:
    - to escape various characters
    - to introduce an escape sequence representing a character
8. First, it is an interpreter type of language and focused on ease of use at the expense of system resources. Second, the running-time of a program that was written with the help of Speedcoding was usually ten to twenty times that of machine code.
7. Because that language continue to evolve from time to time.
9. It is to shorten the initialization of a variable.
12. Procedural programming is a classic programming where the program language is used to tell the computer exactly what to do, step by step. Non-procedural programming is where you tell the computer what you want, then the computer figures out how to get it. The incorporation of procedural and non-procedural features is used to overcome the lack of computer's knowledge to figure out some procedures by itself efficiently.
13. The reasons why C is more popular than Fortran are C is very broad in scope and C is very common in commercial world.
15. Yes, they are  : 

    - Fortran
    - C++
    - COBOL
    - Algol

Sunday, March 3, 2013

KBP - Chapter 1

Review Questions

6. Unix usually written in the C language, with some small snippets of assembler code for low level bootstraps.

13. To be reliable, a program must perform its intended functions and operations in a system's environment, without experiencing failure.


14. Because it's considered very important for reliability.


15. Aliasing is the process of sublimate curves and other lines become jagged, it's because of the file is not high enough to represent a smooth curve.


16. Exception handling is the process of responding to the occurance during the computation, often changing the normal flow of program execution.


17. Because readability affects reliability in both writing and maintenance phases of the life cycle.


20. The name of the category of programming languages whose structure is dictated by Von Neumann is Imperative Languages.


21. Two programming language were discovered as a a result of the research of software development in 1970s are top-down design and stepwise refinement.


25. Three methods of implementing a programming language : Compilation, Pure Interpretation, Hybrid Implementation Sysytems.


28. Byte code provides portalbility to any machine that has a byte codeinterpreter and an associated run-time system.


29. Hybrid implementation systems is the source language statements are decoded only once.

___________________________________________________
Problem Set

2. Ada Lovelace is said to be the first programmer in human history.Her notes on the engine include what is recognized as the first algorithm intended to be processed by a machine. Because of this, she is considered the world's first computer programmer.

3. Java’s thread model is low-level and error-prone, and the language’s stated objective to hide machine details is an obstacle for low-level and real-time applications where such details are intrinsic to the problem.


4. The scientific applications used relatively simple data structures, but requires large number of floating-point arithmetic computations.
   While the business languages are characterized by facilities for producing elaborate reports, precise ways of describing and storing decimal numbers and character data.


5. Artificial Intelligence is a broad area of computer applications characterized by the use of symbolic rather than numeric. Requires more flexibility than other programming domains.
   While the Web Software is an eclectic collection of languages, ranging from markup languages, such as HTML(not a programming language) and to general-purpose programming languages(Java).


15. C++ programming languages uses preprocessor directive while Java is not using preprocessor directive.
Advantage : save time when calling a lot of function.
Disadvantage : the problem is the size of the program. The pre-processor will replace all the macros in the program by its real definition prior to the compilation process of the program.

Thursday, January 17, 2013

PTI - Chapter 15

True/False
1. T
2. F
3. T
4. T
5. F
6. F
7. T
8. T
9. T
10.T
 
Multiple Choice
1. A
2. C
3. C
4. A
5. D
6. B
7. D
8. B

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

Short Answer
1. This is a great opportunity for one to work with his or her hands. Many people have more of a mechanical aptitude than an intellectual aptitude.

    Factors should you consider when selecting a trade school :
     - Find out of the hours of instruction meet or exceed the minimum requirements to get a job
     - Make sure they are current with industry standards
     - Get feedback from other sources
     -  Compare the price of tuition
     -  Make sure this is what you want to do

2. The benefit of professional growth and continuing education is staying aware of new products and services in the computer industry because technology changes so rapidly.

    Some ways can be kept up-to-date about industry trends and technologies are participate in professional growth and continuing education activities such as workshops, seminars, conferences, conventions, and trade shows.


3. It depends on your personal strengths and goals. For people who are hands-on, the more vendor specific certifications might be more appropriate.

     Preparation for a certification exam requires experience or special classes, many of which are offered by trade schools, community colleges, and adult education centers. After certification requirements are met, proficiency in an area is acknowledged with a certificate.

4.  Training programs that prepare applications for the certification test. Other types of certification are beneficial to those interested in programmer / developer certification are Certified Software Development Associate (CSDA), Certified Software Development Professional (CSDP), IBM Certified Solution Developer, Microsoft Certified Professional Developer (MCPD), Sun Certified Enterprise Architect (SCEA), Sun Certified Java Developer (SCJD), Sun Certified Java Programmer (SCJP), and Sun Certified Mobile Application Developer (SCMAD).

    Those people who might be interested in programmer / developer certification are Java programmers, Mobile application developers, Oracle database managers, Programming consultants, SQL programmers, Web software developers, XML developers.

5. Hardware certification is the process through which computer hardware is tested to ensure it is compatible with specific software packages, and operates as intended in critical situations.

    The people who may be interested in hardware certification :
     - cable installation technicians
     - computer repair technicians
     - corporate trainers
     - help desk specialist
     - IT consultants


PTI - Chapter 14

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

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 Answer
1. A manager is responsible for supervising and providing direction to a variety of job tasks such as operation procedures and large projects. 

   Four activities of manager :
    - executive management
    - middle managemnet
    - operational management
    - nonmanagement employees

2. A contente management system is a computer program that allows publishing, editing, and modifying content as well as maintenance from a central interface.

   A content management system includes information about the files and data, called metadata.

3. Two types of virtualization :
    - Server virtualization provides the capability to divide a physical server logically into many virtual servers.
    - Storage virtualization provides the capability to create a single logical storage device from many physical storage devices.

    Cloud computing is an Internet service that provides computing needs to computer users.
     - Some cloud computing services automatically add more network and server capacity to a company’s Web site as demand for services of the Web site increases.

    Grid computing combines many servers and/or personal computers on a network, such as the Internet, to act as one large computer.
     - Grid computing often is used in research environments, such as climate research and life science problems.

4. - E-retail : occurs when retailers use the web to sell their products.
    - Finance : allow users to pay their bills through the mobile device, can transfer monet electronically.
    - Travel : to make easy people to search some directions, also provide detailed directions along with a map.
    - Entertainment and Media 
    - Health

5. - the location of backup data, supllies, and equipment
    - the personnel responsible for gathering backup resources and transporting them to the alternate computer facility
    - a schedule indicating the order in which, and approximate time by which, each application should be up and running

    For a backup plan to be successful, the organization must back up all critical resources. Must be trained in the backup and recovery procedures.

Wednesday, January 16, 2013

PTI - Chapter 13

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

Multiple Choice
1. B
2. C
3. C
4. A
5. A
6. C
7. D
8. B

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

Short Answer
1. A compiler is a computer program that transforms source code written in programming language into another computer language.
    An interpreter is a computer program that executes performs, instructions written in a programming language.
   
   The advantage of an interpreter : Interpreters are useful for program development when execution speed is not important. As the interpreter is in command of the execution process debugging features can be build in. 
   The disadvantage of an interpreter :  Interpreters normally translate and execute programs line by line, converting each program statement into a sequence of machine code instructions and executing these instructions without retaining the translated version. 

2.  Major benefit of OOP :
     - software objects model real world objects, so the complexity is reduced and the program structure is very clear
     - each object forms a separate entity whose internal workings are decoupled from
other parts of the system


    RAD (rapid application development) is a method of developing software, in which a programmer writes and implements a program in segments instead of waiting until the entire program is completed.

3. A code editor, a compiler, a debugger, and a graphical user interface (GUI) builder is included in an integrated development environment.

    The programming languages in the Visual Studio suite is any programming language that lets users create programs by manipulating program elements graphically rather than by specifying them textually.


4. XML is used in many aspects of web development, often to simplify data storage and sharing.
    
    Two applications of XML : 
     - RSS 2.0 : stands for really simple syndication
     - ATOM : specificator that content aggregators use to distribute content to subscribers.

5. In documenting the solution, the programmer performs two activities :
       1. review the program code
       2. review all the documentation


    Proper documentation greatly reduces the amount of time a new programmer spends learning about existing programs.


Tuesday, January 15, 2013

PTI - Chapter 12

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

Multiple Choice
1. A
2. B
3. C
4. A
5. C
6. D
7. A
8. D

Matching
1. D
2. E
3. A
4. B
5. I
6. G
7. F
8. J
9. C
10. K


Short Answer
1. Systems development is the process of defining, designing, testing, and implementing a new software application or program.

   Investigation :  During this stage, business opportunities and problems are identified, and information technology solutions are discussed.
   System Analysis : This step involves breaking down the system in different pieces to analyze the situation, analyzing project goals, breaking down what needs to be created and attempting to engage users so that definite requirements can be defined.
   Design : In systems design the design functions and operations are described in detail, including screen layouts, business rules, process diagrams and other documentation.
   Testing : The code is tested at various levels in software testing. Unit, system and user acceptance testings are often performed.
   Operations and Maintenance : Maintaining the system is an important aspect of SDLC. As key personnel change positions in the organization, new changes will be implemented, which will require system.

2. Operational feasibility reviews the willingness of the organization to support the proposed system. This is probably the most difficult of the feasibilities to gauge. It measures how well the information system will work.
   Schedule feasibility a rough estimate of the project schedule is required to determine if it would be feasible to complete the systems project within a required timeframe. Measures whether the established deadlinea for the project are reasonable.
   Technical feasibility considers the technical requirements of the proposed project. Measures whether the organization has or can obtain the hardware, software, and people needed to deliver.
   Economic feasibility will review the expected costs to see if they are in-line with the projected budget or if the project has an acceptable return on investment. measures whether the lifetime benefits of the proposed information system will be greater than its lifetime costs.
  
   Six techniques to gather data and information : review documentation, observe, survey, interview, conduct join-app design sessions, and research.

3. Unified Modeling Language combines techniques from data modeling (entity relationship diagrams), business modeling (work flows), object modeling, and component modeling. It can be used with all processes, throughout the software development life cycle, and across different implementation technologies.

   A class diagram in the Unified Modeling Language is a type of static structure diagram that describes the structure of a system by showing the system's classes.
   Meanwhile, a case diagram is used at a higher level than within software engineering, often representing missions or stakeholder goals.

4. Perform maintenance activities : fix the errors to improve a system's operation.
   Monitor system performance : the system must investigate solutions to make the informations more reliable.
   Assess system security : to ensure that necessary security controls are integrated into the design and implementation of a project.

5. A computer security plan is to summarize in writting all of the safeguards.
  
   _ identify all information assets of an organization
   _ identify al security risks that may cause the lost of information asset
   _ identify the safeguards that exist to detect, prevent, and recover from a loss