SCJP程序员认证考试

多选题Given the following code, which statements concerning the objects referenced through the member variables i, j and k are true, given that any thread may call the methods a, b and c at any time? ()  class Counter {  int v = 0;   synchronized void inc() 

题目
多选题
Given the following code, which statements concerning the objects referenced through the member variables i, j and k are true, given that any thread may call the methods a, b and c at any time? ()  class Counter {  int v = 0;   synchronized void inc() { v++; }   synchronized void dec() { v--; }   }   public class Q7ed5 {   Counter i;   Counter j;   Counter k;   public synchronized void a() {   i.inc();   System.out.println("a");   i.dec();  }   public synchronized void b() {   i.inc();  j.inc();  k.inc();   System.out.println("b");  i.dec();  j.dec(); k.dec();  }   public void c() {   k.inc();   System.out.println("c");   k.dec();   }   }
A

i.v is guaranteed always to be 0 or 1.

B

j.v is guaranteed always to be 0 or 1.

C

k.v is guaranteed always to be 0 or 1

D

j.v will always be greater than or equal to k.v at any give time.

E

k.v will always be greater than or equal to j.v at any give time.

参考答案和解析
正确答案: E,C
解析: 暂无解析
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

In HDLC Protocol, when Supervisory Frame's type code is '00'.About the following statements, which is correct.

A.Receive Ready

B.Receive not Ready

C.Reject

D.Selective Reject


正确答案:A

第2题:

Which of the following statements concerning intellectual property is wrong?()

  • A、Intellectual property is an intangible creation
  • B、Intellectual property in ludes patents,trademarks,copyrights,etc.
  • C、Intellectual property is a visible creation
  • D、There are some agreement sconcerning intellectual property under the WTO

正确答案:C

第3题:

All the following statements concerning the nature of language change is true except()

A language change is inevitable

B language change is abrupt

C language change is universal

D language change is extensive


答案:B

第4题:

多选题
Concerning the figure below, if a =b, which of the following statements must be true? (Indicate all such statements.)
A

c=d

B

l and k are parallel

C

m and l are perpendicular


正确答案: C,B
解析:
根据题目中的已知信息无法推断出各直线的关系,因此B、C均不正确;而由图示可知,c和d分别是a和b的补角,由于a=b,所以c=d,A项正确。

第5题:

Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?() 

  • A、 The declaration on line 2 does not allocate memory space for the variable myVect.
  • B、 The declaration on line 2 allocates memory space for a reference to a Vector object.
  • C、 The statement on line 2 creates an object of class Vector.
  • D、 The statement on line 3 creates an object of class Vector.
  • E、 The statement on line 3 allocates memory space for an object of class Vector.

正确答案:A,D,E

第6题:

Which statements concerning the switch construct are true?()  

  • A、All switch statements must have a default label.
  • B、There must be exactly one label for each code segment in a switch statement.
  • C、The keyword continue can never occur within the body of a switch statement.
  • D、No case label may follow a default label within a single switch statement.
  • E、A character literal can be used as a value for a case label.

正确答案:E

第7题:

If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()

  • A、10
  • B、30
  • C、17
  • D、16

正确答案:B

第8题:

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? ()

A.The application will crash.

B.The code on line 29 will be executed.

C.The code on line 5 of class A will execute.

D.The code on line 5 of class B will execute.

E.The exception will be propagated back to line 27.


参考答案:B, E

第9题:

单选题
Which of the following statements concerning energy is correct?()
A

Energy can be created or destroyed

B

Energy may not be transformed

C

The total quantity of energy in the universe is always the same

D

None of the above


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

第10题:

单选题
If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()
A

10

B

30

C

17

D

16


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

更多相关问题