mulmed project!

21 Apr

storyboard

page.1
sb2

page.2
sb1

Bina Nusantara University

Advertisements

bab 16

29 Jun

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

7. What are the forms of Horn clauses?

They have either a single atomic proposition on the left side or an empty left side.

8. What is the basic concept of declarative semantics?

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

9. What does it mean for a language to be nonprocedural?

nonprocedural means that the characteristics of
the solution are given but the complete process
of getting the solution is not.

11. What is an uninstantiated variable?

A variable that doesn’t have a value is said to
be “uninstantiated”

13. What is a conjunction?

Conjunctions contain multiple terms that are separated by logical AND
operations.

PROBLEM SET

5. Write the following English conditional statements as Prolog headed
Horn clauses:
a. If Fred is the father of Mike, then Fred is an ancestor of Mike.
b. If Mike is the father of Joe and Mike is the father
of Mary, then Mary is the sister of Joe.
c. If Mike is the brother of Fred and Fred is the
father of Mary, then Mike is the uncle of Mary.

a. ancestor(fred,mike) C father(fred,mike)
b. sister(mary,joe) C father(mike,joe) ^ father(mike,mary)
c. uncle(mike,mary) C brother(mike,fred) ^ father(fred,mary)

10. Find a good source of information on Skolem normal form and write a
brief but clear explanation of it.

skolem normal form is where a variable is replaced with a function of another variable
for the the sake of making the statement more simple.

bab 15

29 Jun

1. Define functional form, simple list, bound variable, and referential transparency.
a.functional form, is one that either takes one or more functions as parameters or
yields a function as its result, or both
b.bound variables have several valuable applications in programming
c.referential transparency is the execution of a function always produces the same
result when given the same parameters

2. What does a lambda expression specify?
parameters and the mapping of a function

3. What data types were parts of the original LISP?
original LISP is typeless language

4. In what common data structure are LISP lists normally stored?
list structure

5. Explain why QUOTE is needed for a parameter that is a data list.
To avoid evaluating a parameter

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

7. What does the abbreviation REPL stand for?
read-evaluate-print loops

8. What are the three parameters to IF?
a predicate expression, a then expression, and an else expression

9. What are the differences between =, EQ?, EQV?, and EQUAL?
EQ? ->works for symbolic atoms but does not necessarily work for numeric atoms
EQV? ->which works on both numeric and symbolic atoms
EQUAL?->works on any pair of expressions, not just lists

11. What are the two forms of DEFINE?
a.(DEFINE symbol expression)
b.(DEFINE (square number) (* number number))

problem set

susah pak gak ngerti.. nanti saya cari..

bab 14

29 Jun

1. Define exception, exception handler, raising an exception, disabling an exception,
continuation, finalization, and built-in exception.

exception: any unusual event, erroneous or not, that is detectable by either hardware or
software and that may require special processing.

The special processing that may be required when an exception is detected
is called exception handling. This processing is done by a code unit or segment
called an exception handler. An exception is raised when its associated
event occurs.

After an exception handler executes, either control can transfer
to somewhere in the program outside of the handler code or
program execution can simply terminate. We term this the question
of control continuation after handler execution, or simply
continuation.

In some situations, it is necessary to complete some computation
regardless of how subprogram execution terminates. The ability to specify such
a computation is called finalization.

built-in exception : the name explain pretty much. it’s an exception, and it’s built-in.
built-in in the language.

2. What are the two alternatives for designing continuation?
first, it can catch the exception and throw
an exception that is listed in its own throws clause.
second, it could declare
the exception in its own throws clause and not handle it, which effectively
propagates the exception to an enclosing try clause, if there is one, or to the
method’s caller, if there is no enclosing try clause.

3. What are the advantages of having support for exception handling built
in to a language?
-time efficient
-less error

8. Where does execution continue after an exception is handled in Ada?
memory

27. Can you disable a Java exception?
yes.

28. What is the purpose of the Java finally clause?
to end an continuation

29. What advantage do language-defined assertions have over simple ifwrite
constructs?
time efficient & less error prone

32. What is event-driven programming?
a programming paradigm in which the flow of the program is determined by events

33. What is the purpose of a Java JFrame?
34. What is the purpose of a Java JPanel?
1. JPanel serves as a general purpose container,
while JFrame is a window commonly used for stand-alone
applications, like a warning window, or a notification window.

2. JPanel represents an area used for more complex operations or applications.

3. In JPanel, one panel can hold many operations,
while in JFrame, it can have inner frames for a different purpose.

bab 13

29 Jun

1. What are the three possible levels of concurrency in programs?
instruction, statement, or subprogram level

2. Describe the logical architecture of an SIMD computer.
each processor has its own local memory. One processor controls the operation of
the other processors

3. Describe the logical architecture of an MIMD computer.
Each processor in an MIMD computer executes its own instruction stream. MIMD
computers can appear in two distinct configurations: distributed and shared memory
systems

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

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

6. Describe the logical architecture of a vector processor.
Single-Instruction Multiple-Data (SIMD)

7. What is the difference between physical and logical concurrency?
Physical ->The most natural category of concurrency is that in which, assuming that
more than one processor is available, several program units from the
same program literally execute simultaneously
Logical ->A slight relaxation of this concept of concurrency allows the programmer
and the application software to assume that there are multiple
processors providing actual concurrency, when in fact the actual
execution of programs is taking place in interleaved fashion on a single
processor

8. What is a thread of control in a program?
sequence of program points reached as control flows through the program

9. Why are coroutines called quasi-concurrent?
Because they have a single thread of control

10. What is a multithreaded program?
A program designed to have more than one thread of control

11. What are four reasons for studying language support for concurrency?
The first reason is the speed of execution of programs on machines with multiple
processors.
The second reason is that even when a machine has just one processor, a
program written to use concurrent execution can be faster than the same program
written for sequential (nonconcurrent) execution.
The third reason is that concurrency provides a different method of conceptualizing
program solutions to problems.
The fourth reason for using concurrency is to program applications that
are distributed over several machines, either locally or through the Internet.

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

14. What kind of tasks do not require any kind of synchronization?
disjoint

15. Describe the five different states in which a task can be.
1. New: A task is in the new state when it has been created but has not yet
begun its execution.
2. Ready: A ready task is ready to run but is not currently running. Either
it has not been given processor time by the scheduler, or it had run
previously but was blocked in one of the ways described in Paragraph 4
of this subsection. Tasks that are ready to run are stored in a queue
that is often called the task ready queue.
3. Running: A running task is one that is currently executing; that is, it has
a processor and its code is being executed.
4. Blocked: A task that is blocked has been running, but that execution was
interrupted by one of several different events, the most common of
which is an input or output operation. In addition to input and output,
some languages provide operations for the user program to specify that
a task is to be blocked.
5. Dead: A dead task is no longer active in any sense. A task dies when

Problem Set

1. Explain clearly why competition synchronization is not a problem
in a programming environment that supports coroutines but not
concurrency.
Competition synchronization prevents two tasks from accessing a shared
data structure at exactly the same time—a situation that could destroy the
integrity of that shared data.

2. What is the best action a system can take when deadlock is detected?
Debug it

bab 12

29 Jun

1. Describe the three characteristic features of object-oriented languages.
inheritance : abilities to derive a data member to another class.
polymorphism : including overiding and overloading.
encapsulation : abilities to make ADT.

2. What is the difference between a class variable and an instance variable?
class variable have an access modifier, usually private.
instance variable doesn’t have an access modifier.

3. What is multiple inheritance?
a class which is derived from multiple class.

4. What is a polymorphic variable?
it have an abstract data type

5. What is an overriding method?
a method which is existing in both base & derived class, with a different parameter
in the derived class. the one in derived class is called the overiding one.

6. Describe a situation where dynamic binding is a great advantage over its absence.
when it is not clear how much data there are.

7. What is a virtual method?
a method that binded in the run time. when needed.

8. What is an abstract method? What is an abstract class?
abstract method is a method with no body,
abstract class is a class containing abstract method

10. What is a nesting class?
The class in which the new class is nested is called the nesting class.

11. What is the message protocol of an object?
The entire collection of methods of an object is called the message protocol

24. What is a friend function in C++ ?
a function that can accessed by it friend class.

25. What is a pure virtual function in C++ ?
an abstract virtual method

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

problem set

10. Explain one disadvantage of inheritance.
it kinda raise an objection to the rule data member being a private member.

11. Explain the advantages and disadvantages of having all values in a
language be objects.
advantages: it will be flexible.
disadvantages: it will be too time consuming

12. What exactly does it mean for a subclass to have an is-a relationship with
its parent class?
the base class is an abstract class for it derived class.

13. Describe the issue of how closely the parameters of an overriding
method must match those of the method it overrides.
it must be exactly the same order, type, amount of parameter.

16. What is the primary reason why all Java objects have a common ancestor?
so the classes object can be accessed by the base class object when passed by
reference in a function.

17. What is the purpose of the finalize clause in Java?
A finalize method is implicitly called when the garbage collector is about
to reclaim the storage occupied by the object.

18. What would be gained if Java allowed stack-dynamic objects, as well as
heap-dynamic objects? What would be the disadvantage of having both?
the disadvantages is another garbage collecting code is needed for two dynamic object

bab 11

29 Jun

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

2. Define abstract data type.
a data structure, in the form of a record, but which includes subprograms that
manipulate its data

3. What are the advantages of the two parts of the definition of abstract data type?
The advantage of having the implementation of
the type and its operations in different syntactic units is that it increases the
program’s modularity and it is a clear separation of design and implementation.

4. What are the language design requirements for a language that supports abstract
data types?
object oriented program language design

10. What is the use of the Ada with clause?
11. What is the use of the Ada use clause?
The with clause makes the names defined in external packages
visible; in this case Ada.Text_IO, which provides functions for input and
output of text. The use clause eliminates the need for explicit qualification
of the references to entities from the named package.

13. From where are C++ objects allocated?
stack.

15. What is the purpose of a C++ constructor?
to allocate memories for object.

25. From where are Java class instances allocated?
heap.

26. Why does Java not have destructors?
because java has its own built in garbage collecting program.

30. What is a friend function? What is a friend class?
function with keyword friend, which can be access from friend class
class with keyword class.

34. Explain the three reasons accessors to private types are better than making
the types public.
-reliability
-hidden
-can only be accessed from its own class

problem set

12. Why are destructors rarely used in Java but essential in C++?
because java has its own built in garbage collecting program.
and C++ doesn’t have any built in garbage collecting program, so destructors
serve as garbage collecting program.