niusouti.com

多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo( )method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used

题目
多选题
Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo( )method, which two statements are true?()
A

The class implements java.lang.Comparable.

B

The class implements java.util.Comparator.

C

The interface used to implement sorting allows this class to define only one sort sequence.

D

The interface used to implement sorting allows this class to define many different sort sequences.


相似考题
更多“多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo( )method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used ”相关问题
  • 第1题:

    Which two demonstrate an “is a” relationship?()   

    • A、 public interface Person { }  public class Employee extends Person { }
    • B、 public interface Shape { }  public class Employee extends Shape { }
    • C、 public interface Color { }  public class Employee extends Color { }
    • D、 public class Species { }  public class Animal (private Species species;)
    • E、 interface Component { }  Class Container implements Component ( Private Component[ ] children;  )

    正确答案:D,E

  • 第2题:

    Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()

    • A、The class implements java.lang.Comparable.
    • B、The class implements java.util.Comparator.
    • C、The interface used to implement sorting allows this class to define only one sort sequence.
    • D、The interface used to implement sorting allows this class to define many different sort sequences.

    正确答案:A,C

  • 第3题:

    class A {  }  class Alpha {  private A myA = new A();  void dolt( A a ) {  a = null;  }  void tryIt() {  dolt( myA );  }  }  Which two statements are correct?()  

    • A、 There are no instanced of A that will become eligible for garbage collection.
    • B、 Explicitly setting myA to null marks that instance to be eligible for garbage collection.
    • C、 Any call on tryIt() causes the private instance of A to be marked for garbage collection.
    • D、 Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.

    正确答案:B,D

  • 第4题:

    Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()

    • A、The class implements java.lang.Comparable.
    • B、The class implements java.util.Comparator.
    • C、The interface used to implement sorting allows this class to define only one sort sequence.
    • D、The interface used to implement sorting allows this class to define many different sort sequences.

    正确答案:A,C

  • 第5题:

    You work as an application developer at Certkiller .com. You are developing a collection class named ClientCollection, which is to be used for storing the names of Certkiller .com’s clients that are situated in various geographical areas. These client names are represented by the Client class. You are planning to create a method named SortClients in the ClientCollection class to arrange Client objects in ascending order. You need to ensure that the appropriate interface is implemented by the Client class to allow sorting.What interface should be used?()

    • A、 IDictionary
    • B、 IComparable
    • C、 IComparer
    • D、 IEqualityComparer

    正确答案:B

  • 第6题:

    多选题
    Which of the following statements are true?()
    A

    The equals() method determines if reference values refer to the same object.

    B

    The == operator determines if the contents and type of two separate objects match.

    C

    The equals() method returns true only when the contents of two objects match.

    D

    The class File overrides equals() to return true if the contents and type of two separate objects        match.


    正确答案: A,D
    解析: 严格来说这个问题的答案是不确定的,因为equals()方法是可以被重载的,但是按照java语言的本意来说:如果没有重写(override)新类的equals(),则该方法和 == 操作符一样在两个变量指向同一对象时返回真,但是java推荐的是使用equals()方法来判断两个对象的内容是否一样,就像String类的equals()方法所做的那样:判定两个String对象的内容是否相同,而==操作符返回true的唯一条件是两个变量指向同一对象。从这个意义上来说选择给定的答案。从更严格的意义来说正确答案应该只有D。

  • 第7题:

    多选题
    Given: 10. interface Jumper { public void jump(); } ...   20. class Animal {} ...   30. class Dog extends Animal {   31. Tail tail;   32. }   ...   40. class Beagle extends Dog implements Jumper{   41. public void jump() {}  42. }   ...   50. class Cat implements Jumper{   51. public void jump() {}   52. }. Which three are true?()
    A

    Cat is-a Jumper

    B

    Cat is-a Animal

    C

    Dog is-a Jumper

    D

    Dog is-a Animal

    E

    Beagle has-a Jumper

    F

    Cat has-a Animal

    G

    Beagle has-a Tail


    正确答案: F,B
    解析: 暂无解析

  • 第8题:

    多选题
    You are defining a class named MyClass that contains several child objects. MyClass contains a method named ProcessChildren that performs actions on the child objects.MyClass objects will be serializable.You need to ensure that the ProcessChildren method is executed after the MyClass object and all its child objects are reconstructed. Which two actions should you perform?()
    A

    Apply the OnDeserializing attribute to the ProcessChildren method.

    B

    Specify that MyClass implements the IDeserializationCallback interface.

    C

    Specify that MyClass inherits from the ObjectManager class.

    D

    Apply the OnSerialized attribute to the ProcessChildren method.

    E

    Create a GetObjectData method that calls ProcessChildren.

    F

    Create an OnDeserialization method that calls ProcessChildren.


    正确答案: A,B
    解析: 暂无解析

  • 第9题:

    多选题
    Which the two demonstrate an “is a” relationship?()
    A

    public interface Person {}  Public class Employee extends Person {}

    B

    public interface Shape {}  public interface Rectangle extends Shape {}

    C

    public interface Color {}  public class Shape { private Color color; }

    D

    public class Species {}  public class Animal { private Species species; }

    E

    interface Component {} Class Container implements Component {private Component [] children;


    正确答案: A,C
    解析: 暂无解析

  • 第10题:

    多选题
    Which two statements are true about the hashCode method?()
    A

    The hashCode method for a given class can be used to test for object equality and object inequality for that class.

    B

    The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.

    C

    The hashCode method for a given class can be used to test for object inequality, but NOT objecte quality, for that class.

    D

    The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.

    E

    The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.


    正确答案: E,D
    解析: 暂无解析

  • 第11题:

    多选题
    Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()
    A

    The class implements java.lang.Comparable.

    B

    The class implements java.util.Comparator.

    C

    The interface used to implement sorting allows this class to define only one sort sequence.

    D

    The interface used to implement sorting allows this class to define many different sort sequences.


    正确答案: C,D
    解析: 暂无解析

  • 第12题:

    多选题
    Under what two circumstances is the set JspBody method NOT called in a tag class that implements the Simple Tag interface? ()
    A

    The tag is invoked without a body.

    B

    The doTAb method throws an exception.

    C

    The  element has the value empty.

    D

    The tag is called with the attribute skip-body=true


    正确答案: D,A
    解析: 暂无解析

  • 第13题:

    Which of the following statements are true?() 

    • A、 The equals() method determines if reference values refer to the same object.
    • B、 The == operator determines if the contents and type of two separate objects match.
    • C、 The equals() method returns true only when the contents of two objects match.
    • D、 The class File overrides equals() to return true if the contents and type of two separate objects        match.

    正确答案:A,D

  • 第14题:

    You want to create a filter for your web application and your filter will implement javax.servlet.Filter. Which two statements are true?()

    • A、Your filter class must implement an init method and a destroy method.
    • B、Your filter class must also implement javax.servlet.FilterChain.
    • C、When your filter chains to the next filter, it should pass the same arguments it received in its doFiltermethod.
    • D、The method that your filter invokes on the object it received that implements javax.servlet.FilterChaincan invoke either another filter or a servlet.
    • E、Your filter class must implement a doFilter method that takes, among other things, anHTTPServletRequest object and an HTTPServletResponse object.

    正确答案:A,D

  • 第15题:

    Which statement is true?()

    • A、A class’s finalize() method CANNOT be invoked explicitly.
    • B、super.finalize() is called implicitly by any overriding finalize() method.
    • C、The finalize() method for a given object is called no more than once by the garbage collector.
    • D、The order in which finalize() is called on two objects is based on the order in which the two objects became finalizable.

    正确答案:C

  • 第16题:

    Which two statements are true about the hashCode method?()

    • A、The hashCode method for a given class can be used to test for object equality and object inequality for that class.
    • B、The hashCode method is used by the java.util.SortedSet collection class to order the elements within that set.
    • C、The hashCode method for a given class can be used to test for object inequality, but NOT objecte quality, for that class.
    • D、The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.
    • E、The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.

    正确答案:C,E

  • 第17题:

    You are defining a class named MyClass that contains several child objects. MyClass contains a method named ProcessChildren that performs actions on the child objects.MyClass objects will be serializable.You need to ensure that the ProcessChildren method is executed after the MyClass object and all its child objects are reconstructed. Which two actions should you perform?()

    • A、Apply the OnDeserializing attribute to the ProcessChildren method.
    • B、Specify that MyClass implements the IDeserializationCallback interface.
    • C、Specify that MyClass inherits from the ObjectManager class.
    • D、Apply the OnSerialized attribute to the ProcessChildren method.
    • E、Create a GetObjectData method that calls ProcessChildren.
    • F、Create an OnDeserialization method that calls ProcessChildren.

    正确答案:B,F

  • 第18题:

    多选题
    Whitch two statements are true regarding the role of the Routing Engine (RE)? ()
    A

    The RE controls and monitors the chassis

    B

    The RE manages the Packet Forwarding Engine (PFE)

    C

    The RE receives a copy of the forwarding table from the forwarding plane

    D

    The RE implements class of service (COS)


    正确答案: D,B
    解析: 暂无解析

  • 第19题:

    多选题
    Which two demonstrate an “is a” relationship?()
    A

    public interface Person { }  public class Employee extends Person { }

    B

    public interface Shape { }  public class Employee extends Shape { }

    C

    public interface Color { }  public class Employee extends Color { }

    D

    public class Species { }  public class Animal (private Species species;)

    E

    interface Component { }  Class Container implements Component ( Private Component[ ] children;  )


    正确答案: E,B
    解析: 暂无解析

  • 第20题:

    多选题
    Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()
    A

    The class implements java.lang.Comparable.

    B

    The class implements java.util.Comparator.

    C

    The interface used to implement sorting allows this class to define only one sort sequence.

    D

    The interface used to implement sorting allows this class to define many different sort sequences.


    正确答案: D,A
    解析: 暂无解析

  • 第21题:

    多选题
    class A {  }  class Alpha {  private A myA = new A();  void dolt( A a ) {  a = null;  }  void tryIt() {  dolt( myA );  }  }  Which two statements are correct?()
    A

    There are no instanced of A that will become eligible for garbage collection.

    B

    Explicitly setting myA to null marks that instance to be eligible for garbage collection.

    C

    Any call on tryIt() causes the private instance of A to be marked for garbage collection.

    D

    Private instances of A become eligible for garbage collection when instances of Alpha become eligible for garbage collection.


    正确答案: A,D
    解析: 暂无解析

  • 第22题:

    多选题
    Which two statements are true regarding the role of the Routing Engine (RE)?()
    A

    The RE controls and monitors the chassis.

    B

    The RE manages the Packet Forwarding Engine (PFE).

    C

    The RE receives a copy of the forwarding table from the forwarding plane.

    D

    The RE implements class of service (COS).


    正确答案: B,A
    解析: 暂无解析

  • 第23题:

    单选题
    You work as an application developer at Certkiller .com. You are developing a collection class named ClientCollection, which is to be used for storing the names of Certkiller .com’s clients that are situated in various geographical areas. These client names are represented by the Client class. You are planning to create a method named SortClients in the ClientCollection class to arrange Client objects in ascending order. You need to ensure that the appropriate interface is implemented by the Client class to allow sorting.What interface should be used?()
    A

     IDictionary

    B

     IComparable

    C

     IComparer

    D

     IEqualityComparer


    正确答案: D
    解析: 暂无解析

  • 第24题:

    多选题
    Which two statements are true regarding the creation of a default constructor?()
    A

    The default constructor initializes method variables.

    B

    The default constructor invokes the no-parameter constructor of the superclass.

    C

    The default constructor initializes the instance variables declared in the class.

    D

    If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a default constructor.

    E

    The compiler creates a default constructor only when there are no other constructors for the class.


    正确答案: E,B
    解析: 暂无解析