Concept of Programming Language Chapter: 6

REVIEW QUESTIONS

1.   What is a descriptor?

      A descriptor is the collection of the attributes of a variable. In an implementation, a descriptor is an area of memory that stores the attributes of a variable.

2.   What are the advantages and disadvantages of decimal data type?

        Advantage: accuracy of decimal values.

        Disadvantages: limited range since no exponents are allowed, and its representation wastes memory.

4.   Describe the three string length options.

  • Static length string, is the string length option which its length can be static and set when the string is created.
  • Limited dynamic length strings, is the string length option which allow strings to have varying length up to a declared and fixed maximum set by variable’s definition.
  • Dynamic length strings, is the string length option which allow strings to have varying length with no maximum, as in JavaScript, Perl, and the standard C++ library.This option requires the overhead of dynamic storage allocation and deallocation but provides maximum flexibility.

5.   Define ordinal enumeration and subrange types

  • An ordinal type is one in which the range of possible values can be easily associated with the set of positive integers.  In Java, for example, the primitive ordinal types are integer, char, and boolean.
  • An enumeration type is one in which all of the possible values, which are named constants, are provided in the definition. Enumeration types provide a way of defining and grouping collections of name constants, which are called enumeration constants. An example in C#:
    enum days {Mon, Tue, Wed, Thu, Fri, Sat, Sun};
  • A subrange type is a contiguous subsequence of an ordinal type. For example, p. 264
    12 .. 14 is a subrange of integer type.

8.   What are the design issues for arrays?

  • What types are legal for subscripts?
  • Are subscripting expressions in element references range checked?
  • When are subscript ranges bound?
  • When does array allocation take place?
  • Are ragged or rectangular multidimensioned arrays allowed, or both?
  • Can arrays be initialized when they have their storage allocated?
  • What kinds of slices are allowed, if any?

10.  What happens when a nonexistent element of an array is referenced in Perl?

         A reference to a nonexistent element in Perl yields undef, but no error is reported.

12.  What languages support negative subscripts?

        C++, Ruby, and Lua support negative subscripts.

21.  What is the purpose of level numbers in COBOL records?

        The level numbers in COBOL records are used to establish a hierarchical structure of related records.

32.  What are the design issues for unions?

  • Should type checking be required?  Note that any such type checking must be dynamic.
  • Should unions be embedded in records?

 36.  What are the two common problems with pointers?

         One common problem with pointers is the dangling pointer, or dangling reference which is a pointer that contains the address of a heap-dynamic variable that has been deallocated. The common problem is a lost heap-dynamic variable which is an allocated heap-dynamic variable that is not longer accessible to the user program, i.e. it hasn’t a pointer. Such variables are called garbage because they are unusable.

38.  What is a C++ reference type, and what is its common use?

        C++ includes a special kind of pointer type, called a reference type.  It is used primarily for the formal parameters in function definitions.  A C++ reference type variable is a constant pointer that is always implicitly dereferenced.

 39.  Why are reference variables in C++ better than pointers for formal parameters?

Because a C++ reference type variable is a constant, it must be initialized with the address of some variable in its definition, and after initialization a reference type variable can never be set to reference any other variable.

48.  What languages have no type coercions?

Languages that have no type coercions are ML and F#.

50.  What is name type equivalence?

Name type equivalence means that two variables have equivalent types if they are defined either in the same declaration or in declarations that use the same type name.

 

PROBLEM SET 

2.   How are negative integers stored in memory?

A negative integer could be stored in sign-magnitude notation, in which the sign bit is set to indicate negative and the remainder of the bit string represents the absolute value of the number. Sign-magnitude notation, however, does not lend itself to computer arithmetic. Most computers now use a notation called twos complement to store negative integers, which is convenient for addition and subtraction.

7.   Compare the pointer and reference type variable in C++.

  • A pointer can be re-assigned any number of times while a reference can not be reassigned after initialization.
  • A pointer can point to NULL while reference can never point to NULL
  • You can’t take the address of a reference like you can with pointers
  • There’s no “reference arithmetics” (but you can take the address of an object pointed by a reference and do pointer arithmetics on it as in &obj + 5).

8.   What are the differences between the reference type variable of C++ and those of Java?

A C++ reference type variable is a constant pointer that is always implicitly dereferenced. Because a C++ reference type variable is a constant, it must be initialized with the address of some variable in its definition, and after initialization a reference type variable can never be set to reference any other variable. Unlike C++ reference variables, Java reference variables can be assigned to refer to different class instances; they are not constants.

19.  Any type with typedef is type equivalent to its parent type. How does the use of typedef differ in C and C++?

Typedef in C and C++ does not introduce a new type; it simply defines a new name for an existing type. So, any type defined with typedef is type equivalent to its parent type. One exception to C using name type equivalence for structures, enumerations, and unions is if two structures, enumerations, or unions are defined in different files, in which case structural type equivalence is used. This is a loophole in the name type equivalence rule to allow equivalence of structures, enumerations, and unions that are defined in different files. C++ is like C except there is no exception for structures and unions defined in different files.

21.  In what way is dynamic type checking better than static type checking?

Dynamic type checking is better than static type checking when user want to make sure (at runtime) that the pointers are of the correct type. With dynamic_cast, if the pointer is not of the right type, at runtime, it will return 0 instead.

 

Concept of Programming Language Chapter: 5

REVIEW QUESTIONS

1.   What are the design issues for names?

The design issues for names are:

  • Are  names case sensitive?
  • Are the special words of the language reserved words or keywords?

3.   In what way are reserved words better than keywords?

A reserved word is a special word of a programming language that cannot be used as a name. As a language design choice, reserved words are better than keywords because the ability to redefine keywords can be confusing.

5.   Which category of C++ reference variables is always aliases?

Two pointer variables are aliases when they point to the same memory location. When a C++ pointer is set to point at a named variable, the pointer, when dereferenced, and the variable’s name are aliases.

10.  What are the advantages and disadvantages of implicit declarations?

   Advantages: Simple in naming conventions. In this case, the compiler or interpreter binds a variable to a type based on the syntactic form of the variable’s name.

 Disadvantages: Although they are a minor convenience to programmers, implicit declarations can be detrimental to reliability because they prevent the compilation process from detecting some typographical and programmer errors.

15.  What is the general problem with static scoping?

  • In most cases it allows more access to both variables and subprograms than is necessary. It is simply too crude a tool for concisely specifying such restrictions.
  • A problem related to program evolution. Software is highly dynamic—programs that are used regularly continually change. These changes often result in restructuring, thereby destroying the initial structure that restricted variable and subprogram access.

16. What is the referencing environment of a statement?

       The referencing environment of a statement is the collection of all variables that are visible in the statement. The referencing environment of a statement in a static-scoped language is the variables declared in its local scope plus the collection of all variables of its ancestor scopes that are visible.

 

PROBLEM SET

1.   Decide which of the following identifier names is valid in C language. Support your decision.

_Student : this is VALID. Because the first word is not number, C allow underscore to be used in identifier.

int : this NOT VALID. Because int in C is a data type (integer), so identifier can not use the same name as data type.

Student: this is VALID. Because C language allow uppercase in identifer. But, note that it is case sensitive.

123Student: this is NOT VALID. Because C language does not allow number to become the first letter in identifier. It won’t recognized the identifier if it begin with numbers.

Student123: this is VALID. C language allow numbers to be used as identifier as long as not at the first letter.

4.   Why is the type declaration of a variable necessary? What is the value range of the int type variable in Java?

The type declaration of a variable is necessary because, in a program it documented information about its data, which provides clues about the program’s behavior.

The value range of the int type variable in Java is 32 bits (4 bytes).

7.   Assume the following JavaScript program was interpreted using static-scoping rules. What value of x is displayed in function sub1? Under dynamic-scoping rules, what value of x is displayed in function sub1?

var x;
function sub1() {
document.write(“x = ” + x + “<br />”);
}
function sub2() {
        var x;
x = 10;
sub1();
}
x = 5;
sub2();

Answer: 

Static-scoping rules: x = 5

Dynamic-scoping rules: x = 10

Concept of Programming Language Chapter: 3

REVIEW QUESTIONS

2.  Who are language descriptions for?
     Language descriptions are for programmers and Programming language implementors.

5.  What is the difference between a sentence and a sentential form?
     a. A sentence contains only terminal symbols but a sentential form can contain some non-terminal symbols
     b. Sentential forms are a subset of sentences but the converse is not true
     c. Sentential forms have no handles but a sentence does.

7.  What three extentions are common to most EBNFs?
     a. The first of these denotes an optional part of an RHS, which is delimited by brackets.
     b. The second extension is the use of braces in an RHS to indicate that the enclosed part can be repeated indefinitely or left out altogether.
     c. The second extension is the use of braces in an RHS to indicate that the enclosed part can be repeated indefinitely or left out altogether.

8.  Distinguish between static and dynamic semantics.
     The static semantics of a language is only indirectly related to the meaning of programs during execution; rather, it has to do with the legal forms of programs
(syntax rather than semantics). Many static semantic rules of a language state its type constraints. Static semantics is so named because the analysis required to
check these specifications can be done at compile time.
     Dynamic semantics is the meaning of the expression, statements, and program units of a programming language.  

12. What is the primary use of attribute grammars?
      An attribute grammar is a device used to describe more of the structure of a programming language than can be described with a context-free grammar. It is also
used to specify how attribute values are computed.

14. Why can machine language not be used to define statements in operational semantics?
      Machine language can not be used to define statements in operational semantics because of some problems. First, the individual steps in the execution of machine
language and the resulting changes to the state of the machine are too small and too numerous. Second, the storage of a real computer is too large and complex.

15. Describe the two levels of uses of operational semantics.
      At the highest level, the interest is in the final result of the execution of a complete program. This is sometimes called natural operational semantics.
      At the lowest level, operational semantics can be used to determine the precise meaning of a program through an examination of the complete sequence of state
changes that occur when the program is executed. This use is sometimes called structural operational semantics.

21. When a grammar rule said to be left recursive?
      A grammar rule is 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.
      A = B + C * A

29. Give the difference between total correctness and partial correctness.
      If loop termination can be shown, the axiomatic description of the loop is called total correctness. If the other conditions can be met but termination is not
guaranteed, it is called partial correctnes.

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.
     A syntax error refers to an error in the syntax of a sequence of characters or tokens that is intended to be written in a particular programming language.
     Example of syntax error:
     In java this is error
     System.out.println(Hello World);
     The correct syntax is System.out.println(“Hello World”);
     Semantic Error is a logical error. It is due to wrong logical statements. Semantics is the interpretations of and meanings derived from the sentence transmission
and understanding of the message. Semantics errors are Logical, while Syntax errors are code errors.
     Example of Semantic Error:
     int average(int a, int b)
     {
       return a + b / 2; /* should be (a + b) / 2 */
     }
     It compiles and runs but does not give the right answer.

3.  Rewrite the BNF of example 3.4 to represent operator – and operator / instead of operator + and operator *.
     <expr> -> <expr> * <term> | <term>

     <term> = <factor> + <term> | <factor>

     <factor> -> (<expr>) | <id>

9.  Modify the grammar of Example 3.4 to add a unary minus operator that has higher precedence than either + or *.

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

12. Consider the following grammar:

      <S> -> a <S> c <B> | <A> | b

      <A> -> c<A> | c

      <B> -> d | <A>   

   Which of the following sentences are in the language generated by this grammar?     

   a) abbccd
   b) acccbda
   c) accbcbccc
   d) acddaccd
   e) acccdc

  No one of the following statements are generated.

18. What is a fully attributed parse tree?
      A parse tree of an attribute grammar is the parse tree based on its underlying BNF grammar, with a possibly empty set of attribute values attached to each node. If
all the attribute values in a parse tree have been computed, the tree is said to be fully attributed.

17. Convert the following EBNF to BNF:

      S -> A { b A}

      A -> a [ b ] A

     Answer:   

     S -> A | A B

     B -> b A | b A B

     A -> a A | a b A

19. Write an attribute grammar whose BNF basis is that of Example 3.6 in Section 3.4.5 but whose language rules are as follows: Data types cannot be mixed in expressions, but assignment statements need not have the same types on both sides of the assignment operator.

    Replace the second semantic rule with:

    <var>[2].env <- <expr>.env

    <var>[3].env <- <expr>.env

    <expr>.actual_type <- <var>[2].actual_type

    predicate: <var>[2].actual_type == <var>[3].actual_type

23. Compute the weakest precondition for each of the following assignment statements and postconditions:
      (a) a = 2 * (b – 1) – 1 {a > 0}
           2 * (b – 1) – 1 > 0
           2 * b – 2 – 1 > 0
           2 * b > 3
           b > 3 / 2
      (b) b = (c + 10) / 3 {b > 6}
           (c + 10) / 3 > 6
            c + 10 > 18
            c > 8
      (c) a = a + 2 * b – 1 {a > 1}
           a + 2 * b – 1 > 1
           2 * b > 2 – a
           b > 1 – a / 2
      (d) x = 2 * y + x – 1 {x > 11}
           2 * y + x – 1 > 11
           2 * y + x > 12

24. Compute the weakest precondition for each of the following sequences of assignment statements and their postconditions:
      (a) a = 2 * b + 1
           b = a – 3
           {b < 0}
           a – 3 < 0 -> a < 3
           2 * b + 1 < 3 -> 2 * b < 2 -> b < 1

          The weakest precondition is {b < 1}

    (b) a = 3 * (2 * b + a);

         b = 2 * a – 1
         {b > 5}
         2 * a – 1 > 5 
         2 * a > 6
         a > 3
         3 * (2 * b + a) > 3
         3 * (2 * b + a) > 3
         (2 * b + a) > 1
         (2 * b) > 1 – a
         b > (1 – a)/2
         The weakest precondition is {b >(1 – a)/2}

25. Compute the weakest precondition for each of the following selection constructs and their postconditions:

     (a) if (a = = b)
              b = 2 * a + 1
          else
              b = 2 * a;
          {b > 1}
              2 * a + 1 > 1 -> 2 * a > 0 -> a > 0
              2 * a > 1 -> a > 1/2
          The weakest precondition is {a > 1/2}

     (b) if (x < y)
              x = x + 1
          else
              x = 3 * x
         {x < 0}
              x + 1 < 0
                    x < -1

             3 * x < 0
                  x < 0
            The weakest precondition is {x < 0}
    (c) if (x  > y)
             y = 2 * x + 1
         else
             y = 3 * x – 1;
         {y > 3}
            2 * x + 1 > 3
                  2 * x > 2
                        x > 1

             3 * x – 1 > 3
                  3 * x > 4
                       x > 4/3
         The weakest precondition is {x > 4/3}

Concept of Programming Language Chapter: 2

REVIEW QUESTIONS

1. In what year was Plankalkül designed? In what year was that design published?
Plankalkül was designed by Konrad Zuse between 1943 and 1945.That designed was published in 1972.
3. What does Plankalkul mean?
Plankalkul means program calculus.
5. What is the number of bits in a single word of the UNIVAC I’s memory? How are the bits grouped?
The words of the UNIVAC I’s memory had 72 bits, grouped as 12 six-bit bytes.
7. Who developed the Speedcoding system for the IBM 701?
The Speedcoding system developed by John Backus for the IBM 701
8. Who developed Short Code? Why is Short Code called automatic programming?
Short Code was developed by John Mauchly in 1949 for the BINAC computer. Short code is called automatic programming because Short Code was not translated to machine code; rather, it was implemented with a pure interpreter. It clearly simplified the programming process, but at the expense of execution time. Short Code interpretation was approximately 50 times slower than machine code.
10. What was the most significant feature added to Fortran I to get Fortran II?
It fixed many of the bugs in the Fortran I compilation system and added some significant features to the language, the most important being the independent compilation of subroutines.
13. Which version of Fortran was the first to have character string handling?
Fortran 77 was the first to have character string handling.
24. What data structure that appeared in COBOL originated with Plankalkul?
Data structure that appeared in COBOL and originated with Plankalkul is hierarchical data structures(records).
28. Why was BASIC an important language in the early 1980s?
Because, it was easy for beginners to learn, especially those who were not science oriented, and its smaller dialects can be implemented on computers with very small memories.
33. What language introduced the case statement?
ALGOL-W introduced the case statement.
37. What are two kinds of statements that populate a Prolog database?
Two kinds of statements that populate a Prolog database are facts and rules.
38. What is the primary application area for which Ada was designed?
Ada is widely used in both commercial and defense avionics, air traffic control, and rail transportation, as well as in other areas.
52. What array structure is included in C# but not in C, C++, or Java?
Rectangular arrays are included in C#, but not in C, C++, or Java.
54. For what application area is JavaScript most widely used?
JavaScript is most widely used in Web browsers.
60. How does Java provide storage deallocation?
Java uses implicit storage deallocation for its objects, often called garbage
collection. This frees the programmer from needing to delete objects explicitly when they are no longer needed. Programs written in languages that do not have garbage collection often suffer from what is sometimes called memory leakage, which means that storage is allocated but never deallocated. This can obviously lead to eventual depletion of all available storage.
65. What are the inputs to an XSLT processor?
The inputs to an XSLT processor are an XML data document and an XSLT document (which is also in the form of an XML document).
66. What is the output of an XSLT processor?
The output of an XSLT processor could be in HTML or plain text.

PROBLEM SET

3. Write a short history of the Fortran 0, Fortran I, Fortran II, and Fortran IV systems.
Fortran 0 is the first version of Fortran. Fortran 0 was modified during the implementation period, which began in January 1955 and continued until the release of the compiler in April 1957. The implemented language, which we call Fortran I, is described in the first Fortran Programmer’s Reference Manual, published in October 1956 (IBM, 1956).
Fortran I included input/output formatting, variable names of up to six characters, user-defined subroutines, although they could not be separately compiled, the If selection statement, and the Do loop statement. There were no data-typing statements in the Fortran I language. Variables whose names began with I, J, K, L, M, and N were implicitly integer type, and all others were implicitly floating-point.
Fortran II compiler was distributed in the spring of 1958. It fixed many of the bugs in the Fortran I compilation system and added some significant features to the language, the most important being the independent compilation of subroutines.
Fortran IV became one of the most widely used programming languages of its time.It evolved over the period 1960 to 1962 and was standardized as Fortran 66 (ANSI, 1966), although that name was rarely used. Fortran IV was an improvement over Fortran II in many ways. Among its most important additions were explicit type declarations for variables, a logical If construct, and the capability of passing subprograms as parameters to other subprograms.

6. Make an educated guess as to the most common syntax error in C programs.
The most common syntax error in C programs are missing the (;) semicolon at the end of statement, missing “&” when using scanf, send the wrong paramater when using function, missing specific library when using specific function, missing () or missing {}, etc.

10. Outline the major developments in ALGOL 60.
• The concept of block structure was introduced. This allowed the programmer to localize parts of programs by introducing new data environments, or scopes.
• Two different means of passing parameters to subprograms were allowed: pass by value and pass by name.
• Procedures were allowed to be recursive. The ALGOL 58 description was unclear on this issue. Note that although this recursion was new for the imperative languages, LISP had already provided recursive functions in 1959.
• Stack-dynamic arrays were allowed. A stack-dynamic array is one for which the subscript range or ranges are specified by variables, so that the size of the array is set at the time storage is allocated to the array, which happens when the declaration is reached during execution.
13. What is the primary reason why C became more widely used than Fortran?
Reasons why C became more widely use than Fortran:
• Efficient compilers are universally available for all the main architechtures in use, and a good public compiler also exists (gcc). C compilers often come free with machines, while Fortran 90 compilers must be purchased, and often expensive.
• C is very broad in scope, and is more powerful of Fortran 90 in some areas, such as pointers, and manipulations of strings of characters.
• Acquired coding experience can be directly used outside the scientific world : C is very common in commercial world.

14. What are the arguments both for and against the idea of a typeless language?
Arguments for the idea:
Flexibility, Brevity of syntax. It places stricter controls on what objects can receive and send, so making it easier to enforce design strategies throughout the application. When there are errors in types, there can be picked up during precompilation or in the IDE.
Arguments against the idea:
Without type checking, there is no means to verify the integrity of the data without executing the application. The syntax of typed languages can be viewed as overly long or verbose. Typed languages aren’t as flexible as untyped languages, as data structures need to be cast to the correct type before another object can receive them. It is also said that by using typed languages, the compiler spends less time dynamically typing objects and so executes faster. However, this point is a grey area and that the main area of argument is how these language differences play out when designing applications where more then a few people are working on the code.

15. Are there any nonprocedural programming language other than prolog?
Yes, there are Fortran, C++, COBOL, Algol.
16. What is your opinion of the argument that languages that are too complex are too dangerous to use, and we should therefore keep all languages small and simple?
Languages are too complex are too dangerous to use because of its meaning itself. Ambiguous languages can cause trouble and misunderstanding among people.    So, we must keep it small and simple to avoid ambiguation and misunderstanding.
25. Give a brief general description of the Java servlet.
A servlet is a Java programming language class used to extend the capabilities of a server. Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers, so they can be thought of as Java Applets that run on servers instead of in web browsers. These kinds of servlets are the Java counterpart to non-Java dynamic Web content technologies such as PHP and ASP.NET.

Concept of Programming Language Chapter: 1

REVIEW QUESTIONS

3.   What programming language has dominated scientific computing over the past 50 years?

Programming language that has dominated scientific computing over the past 50 years is FORTRAN. Fortran is the early high-level programming language. For some scientific applications, efficiency is the primary concern, and at 1950s and 1960s there are no subsequent language that is significantly better than Fortran. That’s why Fortran is still used.

4.   What programming language has dominated business applications over the past 50 years?

Programming language that has dominated business applications over the past 50 years is COBOL. The first successful high-level language for business was COBOL (ISO/IEC, 2002), the initial version of which appeared in 1960.

5.   What programming language has dominated artificial intelligence over the past 50 years?

Artificial intelligence (AI) is a broad area of computer applications characterized by the use of symbolic rather than numeric computations. Symbolic computation means that symbols, consisting of names rather than numbers, are manipulated.

Programming language that has dominated artificial intelligence over the past 50 years is the functional language LISP (McCarthy et al., 1965), which appeared in 1959. Most All applications developed prior to 1990 were written in LISP or one of its close relatives.

9.   What is one example of a lack of orthogonality in the design of C?

One example of a lack of orthogonality in the design of C: in a programming language that supports pointers, it should be possible to define a pointer to point to any specific type defined in the language. However, if pointers are not allowed to point to arrays, many potentially useful user-defined data structures cannot be defined.

13.   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. Reliability including Type Checking, Exception Handling, Aliasing, Readability and Writability.

15.   What is aliasing?

Aliasing is having two or more distinct names that can be used to access the same memory cell. It is now widely accepted that aliasing is a dangerous feature in a programming language. Most programming languages allow some kind of aliasing—for example, two pointers set to point to the same variable, which is possible in most languages.

16.   What is exception handling?

Exception handling is the ability of a program to intercept run-time errors (as well as other unusual conditions detectable by the program), take corrective measures, and then continue.

27.   What role does the symbol table play in a compiler?

The symbol table serves as a database for the compilation process. The primary contents of the symbol table are the type and attribute information of each user-defined name in the program.

28.   What is the utility of byte code?

Byte code, provides portability to any machine that has a byte code interpreter and an associated run-time system.

29.   What is a hybrid implementation system?

Some language implementation systems are a compromise between compilers and pure interpreters; they translate high-level language programs to an intermediate language designed to allow easy interpretation. This method is faster than pure interpretation because the source language statements are decoded only once. Such implementations are called hybrid implementation systems.

PROBLEM SET

1.   Do you believe that solving a problem in a particular algorithmic step requires programming language skills? Support your opinion.

I don’t think so. Because, the first step to create a program is make the algorithm and after that the programmer choose what kind of language they will use to execute their program. So, programming language skills are used when a problem in a particular algorithmic step has been solved.

2.   Who is said to be the first programmer in human history? Use the internet help for help.

Augusta Ada King, Countess of Lovelace, now commonly known as Ada Lovelace, was an English mathematician and writer chiefly known for her work on Charles Babbage’s early mechanical general-purpose computer, the Analytical Engine. 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 often considered the world’s first computer programmer.

3.   What are the disadvantages of multiple programming languages?

The disadvantages of multiple programming languages are the different syntax and the efficiency of the programming language. When the programmer is facing a task to create a program, it is not impossible when the programmer mistaking syntax design of a programming language to another programming language. And sometimes there is program when more efficient to be written in specific programming language.

4.   In what way do the languages for scientific application differ from the languages for business applications? Support your view.

The scientific applications used relatively simple data structures, but required large numbers of floating-point arithmetic computations. Business languages are characterized by facilities for producing elaborate reports, precise ways of describing and storing decimal numbers and character data, and the ability to specify decimal arithmetic operations.

5.   In what way do the languages for artificial intelligence differ from the language for web software? Support your review.

Artificial intelligence (AI) is a broad area of computer applications characterized by the use of symbolic rather than numeric computations. Symbolic computation means that symbols, consisting of names rather than numbers, are manipulated. Web software is supported by an eclectic collection of languages, ranging from markup languages, such as HTML, which is not a programming language, to general-purpose programming languages, such as Java. Because of the pervasive need for dynamic Web content, some computation capability is often included in the technology of content presentation.

9.   Explain how orthogonality in a programming language is closely related to simplicity?

Orthogonality is closely related to simplicity: The more orthogonal the design of a language, the fewer exceptions the language rules require. Fewer exceptions mean a higher degree of regularity in the design, which makes the language easier to learn, read, and understand. Anyone who has learned a significant part of the English language can testify to the difficulty of learning its many rule exceptions (for example, i before e except after c).

Exercise Chapter 15

I.   True/False

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

II.   Multiple choice

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

III.  Matching

  1. E
  2. D
  3. J
  4. G
  5. H
  6. B
  7. F
  8. i
  9. A
  10. C

IV.    Short Answer

1.   Advantage of attending trade school  is time savings. Students often complete trade school programs in a shorter time than college and university programs. Factors you should consider when selecting a trade school is  ask the advisor if the trade school has an articulation agreement with a nearby college or university. An articulation agreement ensures that if you transfer to a college or university, you will receive credit for most of the courses taken at your current school.

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

Some ways you can keep 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, also read one or more computer industry publications regularly or visit news, blogs, wikis, or technical Web sites.

3.   About choosing the certification it is best if you choose the one that meet your interest, goal, and especially that has immediate benefits for your current job.

Four options for preparing certification:

  • Self-study: Flexible self-study programs help professionals prepare for certification at their own pace and supplement other training methods.
  • Online training classes: Online training allows students to set their own pace in an interactive environment and combines the technological advantages of computer-based training with the connectivity of the Internet or a company’s intranet.
  • Instructor-led training: Instructor-led training is available in a variety of forms, including seminars, which typically are held for several days during a week; boot camps, which immerse students in intensive course work for up to two weeks; and academicstyle classes, which span a period of several weeks or months.
  • Web resources: The certification sponsor’s Web site generally contains descriptions of the available certifications, with FAQs and links to authorized training and testing centers.

4.   The focus of programmer or developer certification is training programs that prepare applicants 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).

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 certifications vary in scope from a narrow focus with an emphasis on the repair of a specific device to an integrated hardware solution that addresses a company’s current and future computing needs. People who might be interested in hardware certification are Cable installation technicians, Computer repair technicians, Corporate trainers, Help desk specialists, IT consultants, System engineers and administrators

 

Exercise chapter 14

I.   True/False

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

II.   Multiple Choice

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

III.   Matching

  1. H
  2. F
  3. B
  4. E
  5. D
  6. G
  7. A
  8. J
  9. i
  10. C

IV.  Short Answer

1.   Responsibilities of managers:  coordinating and controlling an organization’s resources.

 Four activities that managers perform to coordinate resources:

  • Planning
  • Organizing
  • Leading
  • Controlling

2.   A Content Management System (CMS) is an information system that is a combination of databases, software, and procedures that organizes and allows access to various forms of documents and other files, including images and multimedia content.

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. For example, an employee working during the day in California could use computing power in a Paris network system located in an office that is closed for the evening.  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.

 Why companies use them?  Because,  as the demand for computing resources increases, companies may find that using outside computing resources is more economical than building new computing capacity internally.

4.   Five types of e-commerce:

  • E-Retail, also called e-tail, occurs when retailers use the Web to sell their products and services.
  • Finance.  Online banking allows users to pay bills from their computer or mobile device, that is, transfer money electronically from their account to a payee’s account such as the electric company or telephone company.
  • Travel The Web: provides many travel-related services. If you need directions, you simply enter a starting point and destination, and many Web sites provide detailed directions along with a map. Users can make airline reservations and reserve a hotel or car.
  • Entertainment and Media:  Music, videos, news, sporting events, and 3-D multiplayer games are a growing
    part of the Web’s future. Newsprint on the Web is not replacing the newspaper, but enhancing it and reaching different populations.
  • Health: Many Web sites provide up-to-date medical, fitness, nutrition, or exercise information. Some Web sites offer the capability to listen in on health-related seminars and discussion.

5.   A backup plan contains copies of data worth saving. For a backup plan to be successful, the organization must back up all critical resources. Also, additional people, including possibly nonemployees, must be trained in the backup and recovery procedures because organization personnel could be injured in a disaster.

Exercise Chapter 13

I.   True/False

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

II.   Multiple Choice

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

III.   Matching

  1. G
  2. D
  3. J
  4. i
  5. C
  6. E
  7. A
  8. H
  9. B
  10. F

IV. Short Answer

  1. How Compiler is different from a Interpreter:  A compiler is a separate program that converts the entire source program into machine language before executing it. The machine language version that results from compiling the 3GL is called the object code or object program. The compiler stores the object code on storage media for execution later. Whereas,  An interpreter, by contrast, translates and executes one statement at a time. An interpreter reads a code statement, converts it to one or more machine language instructions, and then executes those machine language instructions.

 The advantage of an interpreter is  that when it finds errors, it displays feedback immediately. The programmer can correct any errors before the interpreter translates the next line of code.  The disadvantage is that interpreted programs do not run as fast as compiled programs. This is because an interpreter must translate the source program to machine language each time the program executes.

2.  A major benefit of OOP is the ability to reuse and modify existing objects. For example, once a programmer creates an Employee object, it is available for use by any other existing or future program.

How RAD is used for developing software:  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. Users begin working with sections of the program as they are completed. An important concept in RAD is the use of prebuilt components.

3.   An IDE (integrated development environment) includes tools for building graphical user interfaces, an editor for entering program code, a compiler and/or interpreter, and a  debugger (to remove errors, which is discussed later in the chapter).

Programming languages in the Visual Studio suite:

  • Visual Basic is a programming language that allows programmers easily to build complex task-oriented object-based pro grams.
  • Visual C++ is a programming language based on C++.
  • Visual C# is a programming language that combines programming elements of C++ with an easier, rapid development environment.

4.   XML separates the Web page content from its format, allowing the Web browser to display the contents of a Web page in a form appropriate for the display device. For example, a smart phone, a PDA, and a notebook computer all could display the same XML page or use different formats or sections of the XML page.

Two applications of XML:

  • RSS 2.0, which stands for Really Simple Syndication
  • ATOM, which are specifications that content aggregators use to distribute content to subscribers.

5.  Two activities performed by the programmer when documenting a solution:

  • Review the program code: first, programmers review the program for any dead code and remove it. Dead code is any program instructions that a program never executes.  Next, programmers should run the program one final time to verify it still works.
  • Review all the documentation: After reviewing the program code, the programmer gives the program and all of its documentation to the systems analyst. The documentation includes all charts, solution algorithms, test data, and program code listings that contain global and internal comments.
     Proper documentation is important because  Proper documentation greatly reduces the amount of time a new programmer spends learning about existing programs.

Exercise chapter 12

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

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

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

IV.    Short Answer
1. System development is a set of activities used to build an information system.
 Five phases of the system development life cycle (SDLC):
  a. Planning
• Review project requests
• Prioritize project requests
• Allocate resources
• Form project development team
   b. Analysis
• Conduct preliminary investigation
• Perform detailed analysis activities: Study current system, determine user requirements, and recommend solution.
c. Design
• Acquire hardware and software, if necessary
• Develop details of system
d. Implementation
• Develop programs, if necessary
• Install and test new system
• Train users
• Convert to new system
e. Operation, Support, and Security
• Perform maintenance activities
• Monitor system performance
• Assess system security

2. Four types of feasibility:
a. Operational feasibility measures how well the proposed information system will work. Will the users like the new
system? Will they use it?
b. Schedule feasibility measures whether the established deadlines for the project are reasonable.
c. Technical feasibility measures whether the organization has or can obtain the hardware, software, and people needed
to deliver and then support the proposed information system.
d. Economic feasibility, also called cost/benefit feasibility, measures whether the lifetime benefits of the proposed
information system will be greater than its lifetime costs.
Six techniques used to gather data and information: review documen tation, observe, survey, interview, conduct joint-
application design sessions, and research.

3. The UML (Unified Modeling Language) has been adopted as a standard notation for object modeling and development. The
UML is a graphical tool that enables analysts to document a system. It consists of many inter related diagrams. Each diagram
conveys a view of the system. UML is used to specify, visualize, modify, construct and document the artifacts of an object-
oriented software-intensive system under development.
 How a use case diagram different from a class diagram:
A use case diagram graphically shows how actors interact with the information system. An actor is a user or otherentity
such as a program. The function that the actor can perform is called the use case. Thus, a use case diagram shows actors and
their use cases. Whereas, a class diagram graphically shows classes and subclasses in a system.

4. Three major activities of the operation, support, and security phase:
a. Perform maintenance activities
b. Monitor system performance
c. Assess system security
Type of maintenance activity:
a. Post-implementation system review, is to discover whether the information system is performing according to the
users’ expectations.
b. Corrective maintenance, which is the process of diagnosing and correcting errors in an information system.
c. Adaptive maintenance is the process of including new features or capabilities in an information system.
d. Performance monitoring is to determine whether the system is inefficient or unstable at any point.
e. Perfective maintenance, investigate solutions to make the information system more efficient and reliable.

5. A computer security plan summarizes in writing all of the safeguards that are in place to protect an organization’s
information assets. The goal of a computer security plan is to match an appropriate level of safeguards against the
identified risks.
Three things a computer security plan should do:
a. Identify all information assets of an organization, including hardware, software, documentation, procedures, people,
data, facilities, and supplies.
b. Identify all security risks that may cause an information asset loss. Rank risks from most likely to least likely to
occur. Place an estimated value on each risk, including lost business. For example, what is the estimated loss if customers
cannot access computers for one hour, one day, or one week?
c. For each risk, identify the safeguards that exist to detect, prevent, and recover from a loss.

 

Exercise Chapter 11

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

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

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

IV. Short Answer
1. How antivirus programs detect and identify a virus:
– By looking for virus signatures. A virus signature, also called a virus definition, is a known specific pattern of
virus code.
– By inoculate existing program files. To inoculate a program file, the antivirus program records information such as
the file size
and file creation date in a separate inoculation file. The antivirus program then uses this information to detect if a virus
tam pers with the data describing the inoculated program file.
A virus hoax is an e-mail message that warns users of a nonexistent virus or other malware.

2. ENERGY STAR program: The United States Department of Energy (DOE) and the United States Environmental Protection Agency
(EPA)developed the ENERGY STAR program to help reduce the amount of electricity used by computers and related devices. This
program encourages manufacturers to create energy- efficient devices that require little power when they are not in use. For
example, many devices switch to sleep or power save mode after a specified number of inactive minutes or hours.
Users should handle obsolete computers by Recycling and refurbishing old equipment that are much safer alternatives for
the environment.

3. Information privacy refers to the right of individuals and companies to deny or restrict the collection and use of
information about them.
Five ways to safeguard your personal information:
– Fill in only necessary information on rebate, warranty, and registration forms.
– Do not preprint your telephone number or Social Security number on personal checks.
– Have an unlisted or unpublished telephone number.
– If Caller ID is available in your area, find out how to block your number from displaying on the receiver’s system.
– Do not write your telephone number on charge or credit receipts.

4. Two methods for avoiding phishing attacks are:
– If you receive an e-mail message that looks legitimate and requests you update credit card numbers, Social Security
numbers, bank account numbers, passwords, or other private information, the FTC recommends you visit the Web site directly to
determine if the request is valid.
– Never click a link in an e-mail message; instead, retype the Web address in your browser.
How clickjacking works: With clickjacking, an object that can be clicked on a Web site, such as a button, image, or
link, contains a malicious program. When a user clicks the disguised object, a variety of nefarious events may occur. For
example, the user may be redirected to a phony Web site that requests personal information, or a virus may download to the
computer.

5. Many businesses use content filtering to limit employees’ Web access. These businesses argue that employees are
unproductive when visiting inappropriate or objectionable Web sites. Some schools, libraries, and parents use content
filtering to restrict access to minors.
Rating system used for content filtering: a rating system of the Internet Content Rating Association (ICRA), which is
similar to those used for movies and videos. Major Web sites such as Yahoo!, AOL, and MSN use the rating system established
by the ICRA. If content at the Web site goes beyond the rating limits set in the Web browser software, a user cannot access
the Web site. Concerned parents can set the rating limits and prevent these limits from being changed by using a password.