- Briefly describe your computer programming experience.
- What are "command line arguments"? Describe the command line argument mechanism in the context of Java programming.
- As a Java language construct, what is a Java interface?
- What is an event, in the context of programming interactive systems in Java?
- How, in Java, have we been arranging to place more than one component in a region of a container governed by a boarder layout manager, when technically speaking only one component is permitted per region?
- Suppose you are asked to define a class which implements an interface. What three main things do you have to do in order to complete your task of defining the class.
- Define a recursive method called »one« to print the number »1« "forever" (until the system activation stack is exhausted).
For example:
one()
would produce
1
1
1
1
1
.
.
.
- Suppose that a is a String array variable which is bound to some value. Furthermore, suppose that this array of character strings is completely filled.
- Using a for statement write the contents of the array one element per line, from the beginning of the array to the end of the array.
- Using a for statement write the contents of the array one element per line, from the end of the array to the beginning of the array.
- Create an array called rev containing the elements of a in reverse order.
- Suppose that »String« variable »s« is bound to some string. Write fragment of Java code which displays each token of the string, one token per line. (Tokens are separated by "white space".)
For example, if s is bound to "today is the ninth class of the course" then the output would be:
today
is
the
ninth
class
of
the
course
- Suppose that s is a String array variable which is bound to some value. Furthermore, suppose that this array of character strings is completely filled.
- Write a Java statement to print the first element of the array.
- Write a Java statement to print the number of elements in the array.
- Write a Java statement to print the last element of the array.
- Write a Java statement to print the length of the first element in the array.
- Write a sequence of Java statements to create an array called len containing the lengths of the character string elements of array s.
- What is a linear list? Precisely define the concept.
- Which representation is more efficient with respect to the insertion/deletion operators of a linear list?
- sequential
- linked
Which representation is more efficient with respect to the referencing an element in a given position of a linear list?
- sequential
- linked
- Write a loop to display 25 random integers between 0 and 99, inclusive, to the standard output stream. (Hint: Use Math.random() from java.util which returns a real number between 0.0 and 1.0.)
- Write a fragment of code to create a NumericLinearList containing 25 random integers between 0 and 99 (represented as Double values). (Hint: Create the empty list and then repeatedly add a new number to the list with, for example, the addE method.)
- What is the value of the following postfix aritmetic expression?
40.0 5.0 6.0 * - 3.0 2.0 / +
- Does the Clay language have any variables?
- As a concept within the realm of data structures, what is a node?
- Draw a tree of height three with four interior nodes and five leaf nodes.
- Beginning with an initially empby binary tree, construct a binary tree according to the following "directions":
- add JAVA according to ""
- add PASCAL according to "R"
- add LISP according to "RL"
- add SML according to "RR"
- add APL according to "L"
- add ALGOL according to "LL"
- add SIMULA according to "RRL"
- add PROLOG according to "RRLL"
- add C++ according to "LR"
- add BASIC according to "LRL"
- What is the maximum number of nodes in a binary tree of height 1?
- What is the maximum number of nodes in a binary tree of height 2?
- What is the maximum number of nodes in a binary tree of height 3?
- What is the maximum number of nodes in a binary tree of height 4?
- What is the maximum number of nodes in a binary tree of height N?
- Interpret the following array as a complete binary tree according to the usual procedure.
a[1] 18
a[2] 74
a[3] 66
a[4] 91
a[5] 34
a[6] 81
a[7] 52
a[8] 21
a[9] 77
a[10] 23
a[11] 10
a[12] 83
a[13] 46
- Draw a picture of the tree.
- Suppose the list of numbers is to be sorted with heapsort. Draw the initial heap that would be created in the first phase of the heap sort algorithm.
- Write down the list of numbers as they appear in the array just after the initial heap is constructed.
- Add the following words, in the order given, to an initially empty hash table consisting of 15 buckets, each containing exactly one slot. When overflow occurs, simply try the next available slot. Use "length of word" as the hash function.
- Monday
- Tudesday
- Wednesday
- Thursday
- Friday
- Saturday
- Sunday
Draw a picture of the hash table once these strings have been added.