Software Engineering : A Practioner’s Approach. 7th Edition

Published March 10, 2014 by patriciaivanapurnomo


ISBN: 978 0 07 337597-7.

Author: Pressman, R.S.  (2010)

Click Here

View original post



Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

1. What are the three primary uses of symbolic logic in formal logic?
To express propositions, to express the relationships between propositions, and to describe how new propositions can be inferred from other propositions that are assumed to be true.

2. What are the two parts of a compound term?
Functor and ordered list of parameters.

3. What are two modes in which a proposition can be stated?
Propositions can be started in two modes : one in which the proposition is defined to be true and one in which the truth of the proposition is something that is to be determined.

5. What are antecedents? Consequents?
Antecedents are right side of a clausal form proposition. Consequent is left side of a clausal form propositions.

7. What are the forms of Horn clauses?
Horn clauses can be in only two forms : single atomic proposition on the left side or right side.

8. What is the basic concept of declarative semantics?
Basic concept of declarative semantics is there is a simple way to determine the meaning of each statement, and it does not depend on how the statement might be used to solve a problem.

11. What is an uninstantiated variable?
A variable that has not been assigned a value.

13. What is a conjunction?
Conjunctions contain multiple terms that are separated by logical AND operations.

1. ”All predicate calculus propositions can be algorithmically converted to clausal form”. Is this statement true or false?
This statement is true. Nilsson (1971) gives proof that this can be done, as well as a simple conversion algorithm for doing it.

2. Describe how a logic programming language is different from a general programming language.
Logical programming language uses a form of symbolic logic, the syntax of logic programming logic is remarkably different from that of the imperative and functional languages.

8. Critically comment on the following statement: “Logic programs are nonprocedural”.
It is true, because logical programs use lots of different processes based on its conditions. If a certain logical requirement is true, then a program will execute the corresponding process, instead of procedurally executing the statements.


Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

2. What does a lambda expression specify?
The predicate function is often given as a lambda expression, which in ML is defined exactly like a function, except with the fn reserved word, instead of fun, and of course the lambda expression is nameless.

3. What data types were parts of the original LISP?
Atoms and lists.

5. Explain why QUOTE is needed for a parameter that is a data list!
To avoid evaluating a parameter, it is first given as a parameter to the primitive function QUOTE, which simply returns it without change.

6. What is a simple list?
A list which membership of a given atom in a given list that does not include sublists.

7. What does the abbreviation REPL stand for?

11. What are the two forms of DEFINE?
The simplest form of DEFINE is one used to bind a name to the value of an expression. This form is (DEFINE symbol expression) The general form of such a DEFINE is (DEFINE (function_name parameters) (expression).

18. What is tail recursion? Why is it important to define functions that use recursion to specify repetition to be tail recursive?
A function is tail recursive if its recursive call is the last operation in the function. This means that the return value of the recursive call is the return value of the nonrecursive call to the function. It is important to specify repetition to be tail recursive because it is more efficient(increase the efficiency).

19. Why were imperative features added to most dialects of LISP?
LISP began as a pure functional language but soon acquired some important imperative features to increased its execution efficiency.

26. What is type inferencing, as used in ML?
Type inference refers to the automatic deduction of the type of an expression in a programming language. If some, but not all, type annotations are already present it is referred to as type reconstruction.

27. What is the use of the fn reserved word in ML?
The predicate function is often given as a lambda expression, which in ML is defined exactly like a function, except with the fn reserved word, instead of fun, and of course the lambda expression is nameless.

29. What is a curried function?
Curried function let new functions can be constructed from them by partial evaluation.

30. What does partial evaluation mean?
Partial evaluation means that the function is evaluated with actual parameters for one or more of the leftmost formal parameters.

32. What is the use of the evaluation environment table?
A table called the evaluation environment stores the names of all implicitly and explicitly declared identifiers in a program, along with their types. This is like a run-time symbol table.

33. Explain the process of currying!
The process of currying replaces a function with more than one parameter with a function with one parameter that returns a function that takes the other parameters of the initial function.

4. Refer to a book on Haskell programming and discuss the features of Haskell.
Haskell features lazy evaluation, pattern matching, list comprehension, type classes, and type polymorphism.

8. How is the functional operator pipeline (|>) used in F#?
The pipeline operator is a binary operator that sends the value of its left operand, which is an expression, t the last parameter of the function call, which is the right operand. It is used to chain together function calls while following the data being processed to each call.

9. What does the following Scheme function do?
(define ( y s lis)
(( null? lis) ‘ () )
((equal? s (car lis)) lis)
(else (y s (cdr lis)))

Y returns the given list with leading elements removed up to but not including the first occurrence of the first given parameter.


Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

2. When is an exception thrown or raised?
An exception is raised when its associated event occurs.

3. What are the advantages of having support for exception handling built in to a language?
Less clutter to detect errors, allowing a single number of handling to handle a number of events.

4. Give an example of hardware-detectable exceptions.
Division by zero

6. What is exception handling propagation in Ada?
Exception propagation allows an exception raised in one program unit to be handled in some other unit in its dynamic or static ancestry. This allows a single exception handler to be used for any number of different program units. This reuse can result in significant savings in development cost, program size, and program complexity.

9. What is the scope of exception handlers in Ada?
Exception handlers can be included in blocks or in the bodies of subprograms, packages, or tasks.

11. are they any predefined exceptions in Ada?

12. What is the use of Suppress pragma in Ada?
Disabling certain run-time checks that are parts of the built-in exceptions.

14. What is the name of all C++ exception handlers?
Try clause

30. In which version were assertions added to Java?
Assertions were added to Java in version 1.4.

31. What is the use of the assert statement?
The assert statement is used for defensive programming. A program may be written with many assert statements, which ensure that the program’s computation is on track to produce correct results.

32. What is event-driven programming?
Event-driven programming is a programming where parts of the program are executed at completely unpredictable times, often triggered by user interactions with the executing program.

33. What is the purpose of a Java JFrame?
The JFrame class defines the data and methods that are needed for frames. So, a class that uses a frame can be a subclass of JFrame. A JFrame has several layers, called panes.

34. What are the different forms of assert statement?
– Assert condition.
– Assert condition : expression.

36. Which package in java contains all the event related classes.
java.awt.event package.

1. What mechanism did early programming languages provide to detect or attempt to deal with errors?
Most of computer hardware system are capable of detecting certain run-time error conditions, such as floating-point overflow. Early programming languages were designed and implemented in such a way that the user program could neither detect nor attempt to deal with such errors. In these languages, the occurrence of such an error simply causes the program to be terminated and control to be transferred to the operating system. The typical operating system reaction to a run-time error is to display a diagnostic message, which may be meaningful and therefore useful, or highly cryptic. After displaying the message, the program is terminated.

2.Describe the approach for the detection of subscript range errors used in C and Java.
In C subscript ranges are not checked. Java compilers usually generate code to check the correctness of every subscript expression. If any exception generates, then an unchecked exception is thrown.

5. From a textbook on FORTRAN, determine how exception handling is done in FORTRAN programs.
For example, a Fortran “Read” statement can intercept inputerrors and end-of-file conditions, both of which are detected by the input device hardware. In both cases, the Read statement can specify the label of some statement in the user program that deals with the condition. In the case of the end-of-file, it is clear that the condition is not always considered an error. In most cases, it is nothing more than a signal that one kind of processing is completed and another kind must begin. In spite of the obvious difference between end-of-file and events that are always errors, such as a failed input process, Fortran handles both situations with the same mechanism.

7.In languages without exception-handling facilities, we could send an error-handling procedure as parameter to each procedure that can detect errors than must be handled. What disadvantage are there to this method?
There are several disadvantages of sending error handling subprograms to other subprograms. One is that it may be necessary to send several error handlers to some subprograms, greatly complicating both the writing and execution of calls. Another is that there is no method of propagating exceptions, meaning that they must all be handled locally. This complicates exception handling, because it requires more attention to handling in more places.

9. Write a comparative analysis of the throw clause and throws clause of Java.
Throw statement is used to retrieve the name of the class with the actual parameter, while the throws clause of Java specifies that exception class or any of its descendant exception classes can be thrown but no handled by the method.


Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

4. What level of program concurrency is best supported by SIMD computers?
Statement-level concurrency.

5. What level of program concurrency is best supported by MIMD computers?
Unit-level concurrency is best supported by MIMD computers.

8. What is the work of a scheduler?
Scheduler manages the sharing of processors among the tasks.

12. What is a heavyweight task? What is a lightweight task?
Heavy weight task executes in its own address space. Lightweight task all run in the same address space.

16. What is a task descriptor?
Task descriptor is a data structure that stores all of the relevant information about the execution state of a task.

17. In the context of language support for concurrency, what is a guard?
Guard is a linguistic device that allows the guarded code to be executed only when a specified condition is true.

21. What is a binary semaphore? What is a counting semaphore?
A binary semaphore is a semaphore that requires only a binary-valued counter. A counting semaphore is a synchronization object that can have an arbitrarily large number of states.

23. What advantage do monitors have over semaphores?
This solution can provide competition synchronization without semaphores by transferring responsibility for synchronization to the run-time system.

24. In what three common languages can monitors be implemented?
Ada, java, and C#.

34. What does the Java sleep method do?
The Java sleep method blocks the the thread.

35. What does the Java yield method do?
To make the thread is put immediately in the task-ready queue. Making it ready to run.

37. What does the Java interrupt method do?
Interrupt becomes one way to communicate to a thread that it should stop.

42. What kind of Java object is a monitor?
In Java, a monitor can be implemented in a class designed as an abstract data type, with the shared data being the type. Accesses to objects of the class are controlled by adding the synchronized modifier to the access methods.

44. What are the two methods used with Java Semaphore objects?
Acquired and release

55. What is Concurrent ML?
Concurrent ML is an extension to ML that includes a fform of threads and a form of synchronous message passing to support concurrency.

56. What is the use of the spawn primitive of CML?
The use of Spawn primitive of CML is to create a thread.

57. What is the use of subprograms BeginInvoke and EndInvoke in F#?
The use of subprograms BeginInvoke and Endinvoke in F# is to call threads asynchronously.

58. What is the use of the DISTRIBUTE and ALIGN specification of HPC?
The use of DISTRIBUTE and ALIGN specification of HPC is to provide information to the compiler on machines that do not share memory, that is, each processor has its own memory.

60. What is the type of an F# heap-allocated mutatable variable?
A mutable heap-allocated variable is of type ref.

1. Explain clearly why a race condition can create problems for a system.
Because two or more tasks are racing to use the shared resource and the behavior of the program depends on which task arrives first (and wins the race). The importance of competition synchronization should now be clear.

2. What is the best action a system can take when deadlock is detected?
– Interrupt (i.e. send a signal/exception to) all the threads holding the lock. They will have to be able to handle the resulting interrupt, though.
– Kill all the threads/processes involved. This is a drastic action, and it saves the rest of the system at the expense of the risk that some data will probably be lost by the program.

3. Busy waiting is a method whereby a task waits for a given event by continuously checking for that event to occur. What is the main problem with this approach?
The main problem would be the CPU resources that area allocated to the waiting for the task, if it were to be suspended, the CPU can then be used for other purposes.


Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

1. Name two functional languages that support object-oriented programming.
C++ and Java

2. What are the problems associated with programming using abstract data types?
– In nearly all cases, the features and capabilities of the existing type are not quite right for the new use.
– The type definitions are all independent and are at the same level.

3. What is the advantage of inheritance?
Inheritance offers a solution to both the modification problem posed by abstract data type reuse and the program organization problem. If a new abstract data type can inherit the data and functionality of some existing type, and is also allowed to modify some of those entities and add new entities, reuse is greatly facilitated without requiring changes to the reused abstract data type.

4.What is message protocol?
Message protocol is the entire collection of methods of an object.

5. What is an overriding method?
It is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes.

7. What is a dynamic dispatch?
A dynamic dispatch is a kind of polymorphism provided bu the dynamic bindong of messages to method definitions.

8.What is an abstract method? What is an abstract class?
An abstract method is an implemented method which all of descendant class should have and it is included in Building. An abstract class is a class that includes at least one abstract method.

11. What is the message protocol of an object?
The message protocol of an objects are all the methods.

12. From where are Smalltalk objects allocated?
Smalltalk objects are allocated from the heap and are referenced through reference variables, which are implicitly dereferenced.

15. What kind of inheritance, single or multiple, does Smalltalk support?
Smalltalk supports single inheritance; it does not allow multiple inheritance.

19. How are C++ heap-allocated objects deallocated?
C++ heap-allocated objects are deallocated using destructor.

29. Does Objective-C support multiple inheritance?
No Objective-C doesn’t support it. (It supports only single inheritance).

31. What is the root class in Objective-C?
The predefined root class named NS Object.

33. What is the purpose of an Objective-C category?
To permit the programmer to add methods to an existing class without the need to recompile that class or even have access to its source code.

34. What is the purpose of an Objective-C protocol?
To achievable either as an abstract multiply inherited base class in C++, or as an “interface”.

38. What is boxing?
Boxing is primitive values in Java 5.0+ which is implicitly coerced when they are put in object context. This coercion converts the primitive value to an object of the wrapper class of the primitive value’s type.

39. How are Java objects deallocated?
By implicitly calling a finalizemethod when the garbage collector is about to reclaim the storage occupied by the object.

1 . What important part of support for inheritance is missing in Java?
Java does not support the private and protected derivations of C++. One can surmise that the Java designers believed that subclasses should be subtypes, which they are not when private and protected derivations are supported. Thus, they did not include them.

7. What is one programming situation where multiple inheritance has a significant disadvantage over interfaces?
A situation when there are two classes derived from a common parent and those two derived class has one child.

10. Explain one advantage of inheritance.
One of the key benefits of inheritance is to minimize the amount of duplicate code in an application by sharing common code amongst several subclasses. Where equivalent code exists in two related classes, the hierarchy can usually be refactored to move the common code up to a mutual super class. This also tends to result in a better organization of code and smaller, simpler compilation units.

12. Compare inheritance and nested classes in C++. Which of these supports an is-a relationship?
Inheritance is where one class (child class) inherits the members of another class (parent class). Nested class is a class declared entirely within the body of another class or interface. Inheritance does.

13. Describe the mechanism of dynamic dispatch with an example in Java. Is it possible to dynamically dispatch the data members?
In C++, a method must be defined as virtual to allow dynamic binding. In Java, all method calls are dynamically bound unless the called method has been defined as final, in which case it cannot be overridden and all bindings are static. Static binding is also used if the method is static or private, both of which disallow overriding.

16. State why Java is said to be more pure object-oriented than C++.
Java is an object oriented language, which means that one of its core principles is inheritance. All classes (and hence the objects created from them) are derived from a parent. In this way, classes inherit variables, methods, and classes from their parent so that they do not have to redefine them. In Java’s case, the common parent of all classes is Object. This gives every class some basic functionality, such as the equals, toString, and wait methods. Besides uniformity, another advantage of inheritance is clear organization. Imagine if we could not guarantee the comparison of two objects with the equals method. Finally, a global parent class means that every class, no matter how specific, can be generalized into the parent’s type (Object o = new String()).

17. What are the different options for object destruction in Java?
Java have garbage collector, although it still have some issues, the other alternatives would be to use the finalize method.

20. Compare the way Smalltalk provides dynamic binding with that of C++.
While Smalltalk’s dynamic type binding provides somewhat more programming flexibility than the hybrid C++ language, it is far less efficient in the execution.

25. Study and explain private and public modifiers in C++. How do those modifiers differ in C#?
C++ includes both classes and structs, which are nearly identical constructs. The only difference is that the default access modifier for class is private, whereas for structs it is public. C# also has structs, but they are very different from those of C++. In C#, structs are, in a sense, lightweight classes. They can have constructors, properties, methods, and data fields and can implement interfaces but do not support inheritance.


Published June 28, 2013 by patriciaivanapurnomo

Lecture: Mr. Tri Djoko Wahjono (D0206)

1. What are the two kinds of abstraction in programming languages?
The two fundamental kinds of abstraction in contemporary programming languages are process abstraction and data abstraction.

2. Define abstract data types.
– the representation of objects of the type is hidden from the program units that use the type.
– the declarations of the type and the protocols of the operations on objects of the type.

3. What are the advantages of the two parts of the definition of abstract data type?
Information hiding, improved readability, and easier to manage.

5. What are the language design issues for abstract data types?
The first design issue for abstract data types is the form of the container for the interface to the type. The second design issue is whether abstract data types can be parameterized. The third design issue is what access controls are provided and how such controls are specified.

8. What is the difference between private and limited private types in Ada?
Private types in Ada, it has built-in operations for assignment and comparisons for equality and inequality. Limited private types in Ada, are described in the private section of a package specification, as are non pointer private types. Limited private types are declared to be limited private in the visible part of the package specification.

10. What is the use of the Ada with clause?
With clause makes the names defined in external packages visible.

11. What is the use of the Ada use clause?
Use clause eliminates the need for explicit qualification of the references to entities from the named package.

12. What is the fundamental difference between a C++ class and an Ada package?
C++ is have a few encapsulations. Ada packages are more generalize encapsulations that can define any number of types.

15. What is the purpose of a C++ destructor?
Destructors are often used as a debugging aid, in which case they simply display or print the values of some or all of the object’s data members before those members are deallocated. The name of a destructor is the class’s name, preceded by a tilde (~).

16. What are the legal return types of a destructor?
Neither constructors nor destructors have return types, and neither use return statements. Both constructors and destructors can be explicitly called.

21. What are initializers in Objective-C?
The initializers in Objective-C are constructors.

27. Where are all Java methods defined?
All Java methods are defined in a class.

30. What is a friend function? What is a friend class?
Friend function to allowed access to public, private, or protected data in that class.
Friend class can access the “private” and “protected” members of the class in which it is declared as a friend.

31. What is one reason Java does not have friend functions or friend classes?
Because java has less need for explicit friend declarations.

43. What is a C++ namespace, what is its purpose?
In general, a namespace is a container for a set of identifiers and allows the disambiguation of homonym identifiers residing in different namespaces. The purpose is to help programs manage the problem of global namespace.

8. What are the drawbacks of user-defined generic classes in Java 5.0?
Some drawbacks of user-defined generic classes in Java 5.0 are: for one thing, they cannot store primitives. Second, the elements cannot be indexed. Elements must be added to user-defined generic collections with the add method.

9. What happens if the constructor is absent in Java and C++?
It will be made automatically by the built-up in.

11. Why is the destructor of C# is rarely used?
Because C# uses garbage collection for most of its heap objects.

12. How are classes in Ruby made dynamic?
Classes in Ruby are dynamic in the sense that members can be added at any time. This is done by simply including additional class definitions that specify the new members.

15. Give one capability that Java 5.0 provides which C# 2005 does not.
One capability that Java 5.0 provides that C# 2005 does not is wildcard classes

19. Compare Java’s packages with Ruby’s modules.
In java encapsulation construct called package .Packages can contain more than one type definition, and the types in a package are partial friends of one another.
In ruby a encapsulation construct called module. Modules typically define collections of methods and constants. So, modules are convenient for encapsulating libraries of related methods and constants, whose names are in a separate namespace so there are no name conflicts with other names in a program that uses the module. Modules are unlike classes in that they cannot be instantiated or subclassed and do not define variables.