Sunday, July 6, 2008

SCJP: Garbage Collection

  1. All Java objects are created on ____ (heap/stack).
    Ans: heap
  2. A private method may be overridden by a private, friendly, ____ , or public method.
    Ans: protected
  3. A ____ class may not be sub classed.
    Ans: final
  4. An ___ class provides a way to defer implementation to subclasses.
    Ans: abstract
  5. Following is the correct declaration of method in java.
    Ans: False
  6. The following lines of code inside a method are valid(i.e will compile):
    final MyCar myCar =new MyCar(“BMW”);
    myCar=new Car(“Merc”);
    Ans: False
  7. In java a “protected” variable is more accessible than a default variable(variable with no access modifier).
    Ans: True
  8. A constant variable in java is marked ___.
    Ans: final
  9. A ___ variable is not stored as part of its object’s persistent state
    Ans: transient
  10. The “native” modifier applies only to methods while “volatile” applies only to variables.
    Ans: True

No comments: