多选题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”相关问题
  • 第1题:

    Router R1, a branch router, connects to the Internet using DSL. Some traffic flows through a GRE and IPsec tunnel, over the DSL connection, destined for an Enterprise network. Which of the following answers best describes the router's logic that tells the router, for a given packet, to apply GRE encapsulation to the packet?()

    • A、When the packet received on the LAN interface is permitted by the ACL listed on the tunnel greacl command under the incoming interface
    • B、When routing the packet, matching a route whose outgoing interface is the GRE tunnel interface
    • C、When routing the packet, matching a route whose outgoing interface is the IPsec tunnel interface
    • D、When permitted by an ACL that was referenced in the associated crypto map

    正确答案:B

  • 第2题:

    Which statement is true for the class java.util.HashSet? () 

    • A、 The elements in the collection are ordered.
    • B、 The collection is guaranteed to be immutable.
    • C、 The elements in the collection are guaranteed to be unique.
    • D、 The elements in the collection are accessed using a unique key.
    • E、 The elements in the collections are guaranteed to be synchronized.

    正确答案:C

  • 第3题:

    1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()  

    • A、 After line 5.
    • B、 After line 9.
    • C、 After the start() method completes.
    • D、 When the takeDemo() method completes.
    • E、 When the instance running this code is made eligible for garbage collection.

    正确答案:E

  • 第4题:

    Given a correctly compiled class whose source code is:  package com.sun.sjcp;  public class Commander {  public static void main(String[] args) {  // more code here  }  }  Assume that the class file is located in /foo/com/sun/sjcp/, the current directory is /foo/, and that the classpath contains “.“ (current directory). Which command line correctly runs Commander?() 

    • A、 java Commander
    • B、 java com. sim. sjcp.Commander
    • C、 java com/sun/sjcp/Commander
    • D、 java -cp com.sun.sjcp Commander
    • E、 java -cp com/sun/sjcp Commander

    正确答案:B

  • 第5题:

    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

  • 第6题:

    You are creating a Windows Communication Foundation (WCF) service. The service endpoints change frequently. On the service, you add a new ServiceDiscoveryBehavior to the Behaviors collection of the ServiceHost Description property. You need to ensure that client applications can communicate with the service and discover changes to the service endpoints. What should you do?()

    • A、Add a new ServiceDiscoveryBehavior to the Behaviors collection in the client application.
    • B、Add a new AnnouncementClient to the Behaviors collection in the client application.
    • C、Use the FindCriteria class and the UdpDiscoveryEndpoint class to set up the binding in the client application.
    • D、Use the DiscoveryProxy class and the EndpointDiscoveryMetadata class to set up the binding in the client application.

    正确答案:C

  • 第7题:

    Which property of the ListView class is used to get/set the name of the data field whose value exclusively identifes every data row of a ListView when the ClientIDMode property is set to Predictable?()

    • A、LoadViewStateByID
    • B、UniqueID
    • C、ClientIDMode
    • D、ClientIDRowSuffix

    正确答案:D

  • 第8题:

    单选题
    Sentence 6 (reproduced below) can best be revised in what way?Reynolds found out that when he was Lisa, it is a second-class world to be a woman looking for a job.
    A

    (As it is now)

    B

    When he was Lisa, Reynolds found that it was a second-class existence for a woman seeking work in the world.

    C

    Although as Lisa, Reynolds felt it is a second-class world to be a woman looking for a job.

    D

    Reynolds as Lisa experienced the second-class world of female job applicants.

    E

    In Reynolds’s opinion, he felt as Lisa that it is a second-class world for female job applicants.


    正确答案: B
    解析:
    A项不正确,因为句子中的动词时态不一致。B项不恰当。D项没有错误。E项“opinion”和“felt”造成累赘,且两个动词的时态不一致,故选D项。

  • 第9题:

    多选题
    Given: 3.class MyServlet extends HttpServlet { 4.public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException,IOException { 5.// servlet code here ... 26.} 27.} If the DD contains a single security constraint associated with MyServlet and its only  tagsand  tags are:GETPUT Admin Which four requests would be allowed by the container?()
    A

    A user whose role is Admin can perform a PUT.

    B

    A user whose role is Admin can perform a GET.

    C

    A user whose role is Admin can perform a POST.

    D

    A user whose role is Member can perform a PUT.

    E

    A user whose role is Member can perform a POST.

    F

    A user whose role is Member can perform a GET.


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

  • 第10题:

    单选题
    1. class Test {  2. private Demo d;  3. void start() {  4. d = new Demo();  5. this.takeDemo(d); 6. }  7.   8. void takeDemo(Demo demo) {  9. demo = null;  10. demo = new Demo(); 11. }  12. }  When is the Demo object, created on line 3, eligible for garbage collection?()
    A

     After line 5.

    B

     After line 9.

    C

     After the start() method completes.

    D

     When the takeDemo() method completes.

    E

     When the instance running this code is made eligible for garbage collection.


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

  • 第11题:

    多选题
    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
    解析: 暂无解析

  • 第12题:

    多选题
    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 theelements within that set.

    C

    The hashCode method for a given class can be used to test for object inequality, but NOT object equality, 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,B
    解析: 暂无解析

  • 第13题:

    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 theelements within that set.
    • C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, 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

  • 第14题:

    You work as an application developer at Certkiller .com. Certkiller .com has been hired by a small local private school to develop a class library that will be used in an application named ManageAttendance for the purpose of managing student records.You are responsible for developing this class library. Certkiller .com has instructed you to create a collection in the application to store learners’ results. The school has informed you that they currently only have seven learners, but that this value will triple in the following year. Due to the limited resources, you need to ensure that the collection you create consumes a minimum amount of resources. What should you use to create the collection?()

    • A、 The HybridDictionary collection class.
    • B、 The HashTable collection class.
    • C、 The ListDictionary collection class.
    • D、 The StringCollection collection class.

    正确答案:A

  • 第15题:

    Which statements concerning the methods notify() and notifyAll() are true?  

    • A、Instances of class Thread have a method called notify().
    • B、A call to the method notify() will wake the thread that currently owns the monitor of the object.
    • C、The method notify() is synchronized.
    • D、The method notifyAll() is defined in class Thread.
    • E、When there is more than one thread waiting to obtain the monitor of an object, there is no way to be     sure which thread will be notified by the notify() method.

    正确答案:A,E

  • 第16题:

    Given the following code:     public class Person{     int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1]);     }     }  Which statement is correct?() 

    • A、 When compilation some error will occur.
    • B、 It is correct when compilation but will cause error when running.
    • C、 The output is zero.
    • D、 The output is null.

    正确答案:A

  • 第17题:

    When an ASM instance receives a SHUTDOWN NORMAL command,what command does it pass on to all database instances that rely on the ASM instances disk groups?()

    • A、 TRANSACTIONAL
    • B、 IMMEDIATE
    • C、 ABORT
    • D、 NORMAL

    正确答案:C

  • 第18题:

    You work as an application developer at Certkiller .com. Certkiller .com has been contracted to develop an application for the local bank.You have been given the responsibility of creating this application and need to store each transaction record, which is identified using a complex transaction identifier,in memory. The bank informs you that the total amount of transaction records could reach 200 per day. To achieve this, you decide to utilize one of the existing collection classes in the .NET 2.0 class library. You need to ensure that you the collection class you select is the most efficient one for storing transaction records.What should you do?()

    • A、 Select the ListDictionary collection class.
    • B、 Select the HashTable collection class.
    • C、 Select the Queue collection class.
    • D、 Select the StringCollection collection class.

    正确答案:B

  • 第19题:

    You work as an application developer at Certkiller .com. You have recently created a custom collection class named ShoppingList for a local supermarket. This custom class will include ShoppinItem objects that have the public properties listed below. * Name * AisleNumber * OnDiscount You are required to enable users of your class to iterate through the ShoppingList collection, and to list each product name and aisle number using the foreach statement.You need to achieve this by declaring the appropriate code.What code should you use?()

    • A、 public class ShoppingList : ICollection {// Class implementation }
    • B、 public class ShoppingList : IEnumerator, IEnumerable {// Class implementation }
    • C、 public class ShoppingList : Ilist {// Class implementation }
    • D、 public class ShoppingList : Enum {// Class implementation }

    正确答案:B

  • 第20题:

    单选题
    Given the following code:     public class Person{ static int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1];)     }     }  Which statement is correct?()
    A

     When compilation some error will occur.

    B

     It is correct when compilation but will cause error when running.

    C

     The output is zero.

    D

     The output is null.


    正确答案: C
    解析:  int型数组是类对象,它在类被加载时完成初始化,在前面题目中已经有叙述,由于是原始数据类型int,其初始值为0。

  • 第21题:

    单选题
    Given: When the doSomething method is called, after which line does the Object created in line 5 become available for garbage collection?()
    A

    Line 5

    B

    Line 6

    C

    Line 7

    D

    Line 8

    E

    Line 9

    F

    Line 10


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

  • 第22题:

    单选题
    Which statement is true for the class java.util.ArrayList?()
    A

     The elements in the collection are ordered.

    B

     The collection is guaranteed to be immutable.

    C

     The elements in the collection are guaranteed to be unique.

    D

     The elements in the collection are accessed using a unique key.

    E

     The elements in the collections are guaranteed to be synchronized.


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

  • 第23题:

    单选题
    Given the following code:     public class Person{     int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1]);     }     }  Which statement is correct?()
    A

     When compilation some error will occur.

    B

     It is correct when compilation but will cause error when running.

    C

     The output is zero.

    D

     The output is null.


    正确答案: B
    解析: 实例变量在类的一个实例构造时完成初始化,而且在类的静态方法中不能直接访问类的非静态成员而只能访问类成员(像上题中一样),类的普通方法可以访问类的所有成员和方法,而静态方法只能访问类的静态成员和方法,因为静态方法属于类,而普通方法及成员变量属于类的实例,类方法(静态方法)不能使用属于某个不确定的类的实例的方法和变量,在静态方法里面没有隐含的this,而普通方法有。