多选题Which three changes should be made to adapt this class to be used safely by multiple threads?()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare th

题目
多选题
Which three changes should be made to adapt this class to be used safely by multiple threads?()
A

declare reset() using the synchronized keyword

B

declare getName() using the synchronized keyword

C

declare getCount() using the synchronized keyword

D

declare the constructor using the synchronized keyword

E

declare increment() using the synchronized keyword


相似考题
更多“多选题Which three changes should be made to adapt this class to be used safely by multiple threads?()Adeclare reset() using the synchronized keywordBdeclare getName() using the synchronized keywordCdeclare getCount() using the synchronized keywordDdeclare th”相关问题
  • 第1题:

    Which of the following commands should be used to assure that a dump can be forced using the reset button on a system without a key switch?()

    • A、sysdumpdev -k 
    • B、sysdumpdev -L 
    • C、sysdumpdev -K 
    • D、sysdumpdev -P

    正确答案:C

  • 第2题:

    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

  • 第3题:

    public class NamedCounter {  private final String name;  private int count;  public NamedCounter(String name) { this.name = name; }  public String getName() { return name; }  public void increment() { coount++; }  public int getCount() { return count; } public void reset() { count = 0; } }  Which three changes should be made to adapt this class to be used safely by multiple threads? ()

    • A、 declare reset() using the synchronized keyword
    • B、 declare getName() using the synchronized keyword
    • C、 declare getCount() using the synchronized keyword
    • D、 declare the constructor using the synchronized keyword
    • E、 declare increment() using the synchronized keyword

    正确答案:A,C,E

  • 第4题:

    public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i<5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()

    • A、 Move the line 12 print statement into the foo() method.
    • B、 Change line 7 to public synchronized void go() {.
    • C、 Change the variable declaration on line 3 to private volatile int x;.
    • D、 Wrap the code inside the foo() method with a synchronized( this ) block.
    • E、 Wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.

    正确答案:A,D

  • 第5题:

    Which two statements are true?()

    • A、It is possible for more than two threads to deadlock at once.
    • B、The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.
    • C、Deadlocked threads release once their sleep() method’s sleep duration has expired.
    • D、Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.
    • E、It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.
    • F、If a piece of code is capable of deadlocking, you cannot eliminate the possibility ofdeadlocking by insertinginvocations of Thread.yield().

    正确答案:A,F

  • 第6题:

    多选题
    public class NamedCounter {  private final String name;  private int count;  public NamedCounter(String name) { this.name = name; }  public String getName() { return name; }  public void increment() { coount++; }  public int getCount() { return count; } public void reset() { count = 0; } }  Which three changes should be made to adapt this class to be used safely by multiple threads? ()
    A

    declare reset() using the synchronized keyword

    B

    declare getName() using the synchronized keyword

    C

    declare getCount() using the synchronized keyword

    D

    declare the constructor using the synchronized keyword

    E

    declare increment() using the synchronized keyword


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

  • 第7题:

    多选题
    Which two statements are true?()
    A

    It is possible for more than two threads to deadlock at once.

    B

    The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.

    C

    Deadlocked threads release once their sleep() method's sleep duration has expired.

    D

    Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.

    E

    It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.

    F

    If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().


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

  • 第8题:

    多选题
    Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()
    A

    When using versions of Java technology earlier than 5.0.

    B

    When sharing a StringBuffer among multiple threads.

    C

    When using the java.io class StringBufferInputStream.

    D

    When you plan to reuse the StringBuffer to build more than one string.


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

  • 第9题:

    多选题
    Which three protocols should be explicitly managed by using a CoPP policy on an Internet border router?()
    A

    SMTP

    B

    ICMP

    C

    BGP

    D

    SSH

    E

    RTP

    F

    BitTorrent

    G

    VTP


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

  • 第10题:

    多选题
    Which three changes should be made to adapt this class to be used safely by multiple threads?()
    A

    declare reset() using the synchronized keyword

    B

    declare getName() using the synchronized keyword

    C

    declare getCount() using the synchronized keyword

    D

    declare the constructor using the synchronized keyword

    E

    declare increment() using the synchronized keyword


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

  • 第11题:

    Due to a recent change in government regulations, Company.com needs to create two  independent but synchronized copies of their data. These copies must be contained in separate storage device a minimum of 100 km apart. The customer has capacity in two systems that meet the criteria, one with SSA disk and the other is FAStT.  What facility can be used to manage this issue?()

    • A、 Two independent copies of the data can be created and synchronized using the "HACMP/XD://HAGeo"
    • B、 The existing disks can be incorporated a single storage unit using the optional product "HACMP/XD://PPRC"
    • C、 AIX can create a mirrored logical volume across the two systems that would be accessible from either system
    • D、 AIX can use the multi path IO subsystem to spread the information across the devices and keep the copies separated

    正确答案:A

  • 第12题:

    Which three will compile and run without exception?()

    • A、private synchronized Object o;
    • B、void go(){   synchronized(){/* code here */}
    • C、public synchronized void go(){/* code here */}
    • D、private synchronized(this) void go(){/* code here */}
    • E、void go(){   synchronized(Object.class){/* code here */}
    • F、void go(){   Object o = new Object();   synchronized(o){/* code here */}

    正确答案:C,E,F

  • 第13题:

    public class SyncTest {  private int x;  private int y;  public synchronized void setX (int i) (x=1;)  public synchronized void setY (int i) (y=1;)  public synchronized void setXY(int 1)(set X(i); setY(i);)  public synchronized Boolean check() (return x !=y;)  }  Under which conditions will check () return true when called from a different class?

    • A、 Check() can never return true.
    • B、 Check() can return true when setXY is called by multiple threads.
    • C、 Check() can return true when multiple threads call setX and setY separately.
    • D、 Check() can only return true if SyncTest is changed to allow x and y to be set separately.

    正确答案:A

  • 第14题:

    Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()

    • A、When using versions of Java technology earlier than 5.0.
    • B、When sharing a StringBuffer among multiple threads.
    • C、When using the java.io class StringBufferInputStream.
    • D、When you plan to reuse the StringBuffer to build more than one string.

    正确答案:A,B

  • 第15题:

    Which two statements are true?()

    • A、It is possible for more than two threads to deadlock at once.
    • B、The JVM implementation guarantees that multiple threads cannot enter into a deadlocked state.
    • C、Deadlocked threads release once their sleep() method's sleep duration has expired.
    • D、Deadlocking can occur only when the wait(), notify(), and notifyAll() methods are used incorrectly.
    • E、It is possible for a single-threaded application to deadlock if synchronized blocks are used incorrectly.
    • F、If a piece of code is capable of deadlocking, you cannot eliminate the possibility of deadlocking by inserting invocations of Thread.yield().

    正确答案:A,F

  • 第16题:

    多选题
    Which three will compile and run without exception?()
    A

    private synchronized Object o;

    B

    void go() {synchronized() { /* code here */ }

    C

    public synchronized void go() { /* code here */ }

    D

    private synchronized(this) void go() { /* code here */ }

    E

    void go() {synchronized(Object.class) { /* code here */ }

    F

    void go() {Object o = new Object();synchronized(o) { /* code here */ }


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

  • 第17题:

    多选题
    What two things happen when the CRS Publisher Database on an HRDB expansion server fails?()
    A

    All call processing immediately begins using the CRS Subscriber Database.

    B

    Calls in queue are dropped.

    C

    Agent calls are dropped.

    D

    Agents are automatically logged out.

    E

    CRS configuration changes are blocked until the CRS Publisher Database is restored and synchronized with the CRS Subscriber Database.

    F

    Configuration changes are buffered until the CRS Publisher Database is restored.


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

  • 第18题:

    多选题
    public class TestFive {  private int x;  public void foo() {  int current = x;  x = current + 1;  }  public void go() {  for(int i=0;i<5;i++) {  new Thread() {  public void run() {  foo();  System.out.print(x + “, “);  } }.start();  }}}  Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()
    A

    Move the line 12 print statement into the foo() method.

    B

    Change line 7 to public synchronized void go() {.

    C

    Change the variable declaration on line 3 to private volatile int x;.

    D

    Wrap the code inside the foo() method with a synchronized( this ) block.

    E

    Wrap the for loop code inside the go() method with a synchronized block synchronized(this) { // for loop code here }.


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

  • 第19题:

    单选题
    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.


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