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


相似考题
更多“Given the following code, which statements concerning the ob”相关问题
  • 第1题:

    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

  • 第2题:

    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

  • 第3题:

    多选题
    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项正确。

  • 第4题:

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

    Cargoes are any type of goods transported by any type of ships

    B

    Cargoes are goods transported in bulk

    C

    Cargoes usually include goods transported in bulk and in containers

    D

    Cargoes are usually packaged in containers


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

  • 第5题:

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

    Special tools are required for lapping or grinding

    B

    It is impossible to throttle flow with a butterfly valve

    C

    To close the valve, it is only necessary to turn the handle a quarter of a turn

    D

    The butterfly valve should never be used in a freshwater system


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

  • 第6题:

    多选题
    Given the following class, which statements can be inserted at position 1 without causing the code to fail compilation?()   public class Q6db8 {   int a;   int b = 0;   static int c;   public void m() {   int d;   int e = 0;   // Position 1   }   }
    A

    a++;

    B

    b++;

    C

    c++;

    D

    d++;

    E

    e++;


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

  • 第7题:

    单选题
    Which of the following statements is true concerning centrifugal pumps?()
    A

    They are particularly suited for pumping high viscosity fluids

    B

    They are started with the discharge valve opened

    C

    The flow of liquid is developed by imparting energy due to the rotation of an impeller

    D

    They are always mounted in a horizontal position


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

  • 第8题:

    单选题
    Which of the following statements is true concerning any evaporator?()
    A

    High conductivity of the distillate indicates distillate salinity is excessive

    B

    Increasing the absolute pressure of the shell will increase the distillers capacity

    C

    Mesh separators are used in evaporators to filter the distillate

    D

    Reducing the brine density will reduce the heat lost overboard


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

  • 第9题:

    单选题
    Which of the following statements is true concerning the cetane number of diesel fuel?()
    A

    The cetane number affects the amount of injection lag

    B

    The cetane number is an indication of the fuels viscosity

    C

    Ignition lag is reduced with fuels having a high cetane number

    D

    The cetane number is of little significance in the combustion process


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

  • 第10题:

    单选题
    Which of the following statements is correct concerning the “flash point ” of a liquid?()
    A

    It is lower than the ignition temperature

    B

    It is the temperature at which a substance will spontaneously ignite

    C

    It is the temperature at which a substance, when ignited, will continue to bum

    D

    It is the temperature at which the released vapors will fall within the explosive range


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

  • 第11题:

    单选题
    Which of the following statements concerning fuel atomization in a diesel engine cylinder is correct?()
    A

    The greater the atomization, the greater the penetration

    B

    The greater the atomization, the less the penetration

    C

    The degree of atomization has nothing to do with the degree of penetration

    D

    Atomization and penetration are one and the same


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

  • 第12题:

    单选题
    Which of the following statements is correct concerning the viscosity of lubricating oil?()
    A

    Viscosity will increase as temperature increases

    B

    Viscosity is a measure of a fluid s internal resistance to flow

    C

    Viscosity will decrease as temperature decreases

    D

    Viscosity is not dependent on temperature


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

  • 第13题:

    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

  • 第14题:

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

  • 第15题:

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

  • 第16题:

    多选题
    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 exception will be propagated back to line 27.

    E

    The code on line 5 of class B will execute.


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

  • 第17题:

    多选题
    Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }
    A

    The code will fail to compile.

    B

    The constructor in a that takes an int as an argument will never be called as a result of constructing an     object of class b or c.

    C

    Class c has three constructors.

    D

    Objects of class b cannot be constructed.

    E

    At most one of the constructors of each class is called as a result of constructing an object of class c.


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

  • 第18题:

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

    Heat is given off from a high temperature region known as a heat sink

    B

    Heat transfer rate is affected most by the size of the heat sink involved

    C

    Heat transfer rate is affected most by the temperature difference between the heat source and the heat sink

    D

    Heat transfer by radiation will occur only by mass motion of a fluid substance


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

  • 第19题:

    单选题
    According to this passage, which of the following statements is FALSE?
    A

    Many employees don’t like a conservative dress code.

    B

    Comfortable clothes make employees more productive.

    C

    A casual clothes code is welcomed by young employees.

    D

    All the employers in the U. S. are for casual office wear.


    正确答案: C
    解析:
    信息题。A选项“许多员工不喜欢保守的着装规定”和原文第三段“85 percent of employers said that they believe that casual dress improves employee morale”内容相符;B选项“舒适的着装能提高员工的工作效率”体现在原文中“... people seem happier and more productive when they are wearing comfortable clothes”;C选项“休闲的着装规定很受年轻雇员的欢迎”和原文“A lot of young people don’t want to dress up for work”相符;D选项“美国所有的雇主都支持休闲着装的原则”和原文85%不符,答案为D选项。

  • 第20题:

    单选题
    Which of the following statements concerning fire-tube boilers is correct?()
    A

    Combustion gases flow through the tubes

    B

    Flames impinge on the tubes

    C

    Combustion occurs in the tubes

    D

    Water flows through the tubes


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

  • 第21题:

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


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

  • 第22题:

    单选题
    Which of the following statements is true concerning an oil cooler?()
    A

    The oil temperature is less than the cooling water temperature

    B

    The oil pressure is less than the cooling water pressure

    C

    The oil pressure is greater than the cooling water pressure

    D

    The oil flow control valve is always installed in the oil input line


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

  • 第23题:

    单选题
    Which of the following statements is true concerning Halon 1301 fire extinguishing equipment?()
    A

    The agent is considered nontoxic at room temperature in low concentrations

    B

    The agent is less effective than carbon dioxide

    C

    Halon primarily extinguishes the fire by cooling

    D

    The agent cannot be used on electrical fires because it leaves a residue


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

  • 第24题:

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


    正确答案: B,C
    解析: SL-275中指出:要为一个新对象分配空间必须执行new Xxx()调用,new调用执行以下的操作: 
    1.为新对象分配空间并将其成员初始化为0或者null。 
    2.执行类体中的初始化。(例如在类中有一个成员声明int a=10;在第一步后a=0 ,执行到第二步后a=10)    
    3.执行构造函数。 
    4.变量被分配为一个到内存堆中的新对象的引用。