No Late Submissions Accepted
Assignment: #assessment1 Due: 05/07/2017 Points: 3

Exercises 0-6 use the following:

      public class A { ... }
      public final class B { ...}
      public class C { ... }
      public class D { ... }
      public abstract class E { ... }
      public class F extends A { ... }
      public interface Aable { ... }

      None of the classes implement public String toString() {}.

0) No or Yes:  class A extends Object

1) class A extends B   does not compile. Why?

2) class A extends C, D   does not compile. Why?

3) E e = new E();   does not compile. Why?

4) class A extends Aable   does not compile. Why?

5) System.out.println(new F()) prints: F@6bc7c054   Why?

6) If public String toString() {return "A";} is added to class A,
   then System.out.println(new F()); would print what?


7) Briefly explain the primary problem with respect to using an array of Objects (Object[]) to implement a linked-list of Objects. 8) Who is considered the father of the Java programming language? 9) If a Binary Search Tree is built using the inputs M G T D X P J A Z, then who is the parent of P? 10) Record the post-order traversal for the following binary tree. 87 / \ / \ 84 103 / \ / \ 68 86 90 109 / \ / \ 32 74 88 97 / \ 70 80 11) Record the total number of swaps that occur when the following code snippet is executed. /* * adds an int to an array using insertion sort */ static void insertionSort(int[] b, int x) { ... } int[] a = new a[4]; insertionSort(a, 3); insertionSort(a, 1); insertionSort(a, 5); insertionSort(a, 2); 12) No or Yes: Linear search is O(n) and binary search is O(log(n)). Given a sorted array binary search will always be faster than linear search. Briefly justify your anwer. 13) Write (infix) expression (2 * 100) + 51 in postfix notation.