Next: About this document
Computer Science 3675
Summer 2000
Quiz 5
- Write a clearly legible T to the left of each of the
following that is true, and a clearly legible F to the left
of each that is false.
- Programs written in an object-oriented style are
generally organized according to types of data, while
programs written in a procedural style are generally
organized according to types of functions.
- In Java, an abstract class is a class that contains
at least one virtual function.
- In Java, an interface can only contain virtual (or abstract)
functions, and cannot contain any instance variables.
- Java allows multiple inheritance from classes.
- In Java, a class can implement more than one interface.
- Unification is a form of pattern matching. Which of
the following is not a characteristic of unification?
- Unification never changes the binding of a bound variable.
- Unification is symmetric; unifying A with B has
exactly the same effect as unifying B with A.
- Unification is very slow, and is only used rarely during
computations of logic programs.
- Unification can bind unbound variables.
- A cut in a backtracking program
- Removes backtrack control frames from the control stack.
- Adds a backtrack control frame to the control stack.
- Never succeeds when tried.
- Usually has very little effect on how a
program runs.
- In a logic programming goal, unbound variables
- are not allowed, since a goal must only produce true
or false.
- must remain unbound after the goal has been processed.
- are implicitly universally quantified, with the system
asked to prove the goal for all values of the variables.
- are implicitly existentially quantified, with the
system asked to find some values that satisfy the
desired conditions.
- Suppose that you know a list Y and a value A.
Using only the append predicate, list notation and the :: operator,
write a goal containing variables Y and A that
is satisfied just when Y is nonempty and the last member
of list Y is A. Do not define any new predicates for this.
- Write logic programming axioms (Horn clauses)
that define a predicate called allAre so that
allAre(X,A) is true just when X is a list all of whose
members are A. For example, allAre([3,3,3,3],3) is true, and
allAre([a,a],a) is true, but allAre([b,a], a) is false.
Note that allAre( ,2) is true.
- When an exception happens during execution of a program,
the exception manager must begin forcing functions to return,
and removing their frames from the run-time stack. How
does the exception manager know when to stop removing frames?
Next: About this document
Karl Abrahamson
Mon Jun 19 13:32:40 EDT 2000