KBP Chapter 16

Review Question

 

1. What are 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 compound term?

–  a functor, which is the function symbol that names the relation.

– an ordered list of parameters, which together represent an element of the relation.

3. What are the two modes in which a proposition can be stated ?
– one in which a proposition is defined to be true

– one in which that the proposition is something to be determined. Continue reading

KBP Chapter 15

Review Question

 

1. Define functional form, simple list, bound variable and referential transparency.
– Functional form : one that either takes one or more functions as parameters or yields a function as its result.
– Simple list : A list that does not include sublist.
– Bound variable : A bound variable is a variable which never changes in the expression after being bound to an actual parameter value at the time evaluation of the lambda expressions begin.
– Referential transparency : A state where execution of function always produces the same result when given the same parameters.

2. What does a lambda expression specify ?

– A lambda expression specifies the parameters and the mapping of a function.

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

–  atoms and lists. Continue reading

KBP Chapter 14

Review Question

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.

– Exception handler : a code unit which processes an exception.

– Raising an exception : When a event associated with an exception occurs

– Disabling an exception : Ignoring a certain hardware-detectable exceptions.

– Continuation : Control transfer to somewhere in the program outside of the handler code or program might terminate .

– Finalization : ability to complete some computation regardless of how subprogram execution terminates.

– Built-in exception : Exception that is not made by the user, but rather comes as default.

2. When is an exception thrown or raised ?

– An exception is raised when its associated event occurs. Continue reading

KBP Chapter 13

Review Question

 

1.   Three possible levels of concurrency in programs:
• instruction level (executing two or more machine instructions simultaneously).
• statement level (executing two or more high-level language statements simultaneously).
• unit level (executing two or more subprogram units simultaneously).

2. Describe the logical architecture of an SIMD computer.
– In an SIMD computer, each processor has its own local memory. One processor controls the operation of the other processors. Because all of the processors, except the controller, execute the same instruction at the same time, no synchronization is required in the software.

4. What level of program concurrency is best supported by SIMD computers ?
– Instruction concurrency level. Continue reading

KBP Chapter 12

Review Question

 

1. Name two functional languages that support object-oriented programming.
– C++ and Objective-c

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. Continue reading

KBP Chapter 11

Review Question

1. What are the two kinds of abstractions in programming languages ?

– Process Abstraction

– Data Abstraction

2. Define abstract data type .

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

5. What are the language design issues for abstract data types ?

– The form of the container for the interface to the type.

– Whether abstract data types can be parameterized.

– What access controls are provided and how such controls are specified. Continue reading

KBP Chapter 10

Review Question

1. What is the definition used in this chapter for “simple” subprograms ?

-Subprograms cannot be nested and all local variables are static.

2. Which of the caller of callee saves execution status information ?

-Either can save the execution status

3. What must be stored for the linkage to a subprogram ?

– Execution status information

4. What is the task of a linker?

– to put together the execution program. Continue reading

KBP Chapter 9

Review Question

 

1. What are three general characteristics of subprograms ?
– Has a single entry point in each subprograms.
– The calling program unit is suspended during the execution of the called subprogram, which implies that there is only one subprogram in execution at any given time.
– When the subprogram execution terminates,  the control always returns to the caller.

3. What is given in the header of a subprogram ?
– a special word.

5. What languages allow a variable number of parameters ?
– C,C++,Perl JavaScript, and Lua. Continue reading

KBP Chapter 7

Review Question

1. Define operator precedence and operator associativity.
– Operator precedence is a rule to define the order of   which operator should be performed first in mathematical expression, because each operator have different level.

– Operator associativity is a property that determines how operators of the same precedence are grouped in the absence of parentheses.

2. What is a ternary operator ?
Ternary operator is operator that takes three operands.

3.    What is a prefix operator?

Prefix operator is an operator that precede their operands, so the operator write first then the operands. Continue reading