Skip To Content

Athabasca University

Review Questions

  1. In your own words, describe generalization and specialization.
  2. Define and contrast the terms single inheritance and multiple inheritance.
  3. Give an example of multiple inheritance in a real-life situation.
  4. What is the function of the import statement?
  5. A and B are two classes. If A inherits properties from B, then A is a ___________ class of B, and B is a __________ class of A.
  6. How does inheritance contribute to software reusability?
  7. Distinguish between contract inheritance and implementation inheritance.
  8. Discuss the problem associated with multiple inheritance. How does Java overcome this problem, and what feature is provided in Java to achieve multiple inheritance? Discuss the limitation of this feature.
  9. What is the expected output of the following code?
    interface I {
    void x();
    void y();
    }
    
    class A implements I {
    A() {}
    public void w() {System.out.println("in A.w");}
    public void x() {System.out.println("in A.x");}
    public void y() {System.out.println("in A.y");}
    }
    
    class B extends A {
    B() {}
    
    public void y() {
    System.out.println("in B.y");
    }
    
    void z() {
    w();
    x();
    }
    
    static public void main(String args[]) {
    A aa = new A();
    B bb = new B();
    
    bb.z();
    bb.y();
    }
    }

     

  10. Discuss the two facilities required by programming languages to support polymorphism.
  11. How does polymorphism contribute to software maintainability?
  12. What is the difference between method overloading and overriding?
  13. What is a “HashMap”?
  14. What is a hash code, and how is it used with a “HashMap”?
  15. What are the advantages and disadvantages of “ArrayList” and “LinkedList”?
  16. What are the advantages and disadvantages of “TreeSet” and “HashSet”?
  17. What are the advantages and disadvantages of “TreeMap”, “HashMap”, and “HashTable”?
  18. How do you make a collection/map unmodifiable?
  19. Why are there unsupported operations in the collections?
  20. What are the four levels of access specification in Java?
  21. What is a compilation unit in Java?
  22. What is automatic downloading of classes?
  23. What is the naming convention for packages?
  24. What is the package caveat?
  25. What is “friendly” access?
  26. What is “public” access?
  27. What is “private” access?
  28. What is “protected” access?
  29. What is the convention for ordering variables by access level?
  30. What are two constraints of using the public access level?
  31. What are the two main reasons for access control?
  32. How does “protected” work with inheritance?
  33. What does the keyword “extend” accomplish?
  34. Why would a programmer write a clean-up method?
  35. What are two ways of setting a final primitive value?
  36. What is the difference between “static final” and “final”?
  37. What is the effect of final on objects?
  38. What is the advantage of using a blank final?
  39. How does a final argument function?
  40. What is an advantage of a final method?
  41. Why should one be cautious when using a final method?
  42. What is the ordering of events in initialization and class loading?
  43. What is the role of late binding in polymorphism?
  44. How is extensibility supported by polymorphism?
  45. What is the difference between overloading and overriding, and how can they be confused?
  46. What are abstract classes and abstract methods?
  47. What is the order of constructor calls for base and derived classes?
  48. What is the order of “finalize” for base and derived classes?
  49. How does an interface differ from an abstract class?
  50. How is multiple inheritance dealt with by interfaces?
  51. Can a class implement multiple interfaces?
  52. How does extend differ for interfaces?
  53. How do interfaces differ with regard to final variables?
  54. What is an inner class?
  55. What is the advantage of defining a class within a method or a scope?
  56. What access do inner classes have to the containing class variables and methods?
  57. How do inner classes create a situation that looks like multiple inheritance?
  58. What are two ways of initializing arrays?
  59. How do you implement “Comparable” when sorting an array?
  60. How do you implement “Comparator” when sorting an array?
  61. What are the two main concepts underlying the Java 2 collections library?
  62. What is the disadvantage of the collections library?
  63. How do you make a type-conscious “ArrayList” in Java?
  64. How do you use an interface to work with your implementation of the collections library?
  65. What is the advantage of an “ArrayList”?
  66. What are the two implementations of sets?
  67. What is an associative array?

Updated July 30 2020 by FST Course Production Staff