多选题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();   }   }Ai.v is guaranteed always to be 0 or 1.Bj.v is guaranteed always to be 0 or 1.Ck.v is guaranteed always to be 0 or 1Dj.v will always be greater than or equal to k.v at any give time.Ek.v will always be greater than or equal to j.v at any give time.

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


参考解析

解析: 暂无解析

相关考题:

All the following statements concerning the nature of language change is true except() A language change is inevitableB language change is abruptC language change is universalD language change is extensive

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.

In HDLC Protocol, when Supervisory Frame's type code is '00'.About the following statements, which is correct.A.Receive ReadyB.Receive not ReadyC.RejectD.Selective Reject

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.

Which of the following statements concerning intellectual property is wrong?()A、Intellectual property is an intangible creationB、Intellectual property in ludes patents,trademarks,copyrights,etc.C、Intellectual property is a visible creationD、There are some agreement sconcerning intellectual property under the WTO

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、10B、30C、17D、16

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.

单选题Which of the following statements concerning energy is correct?()AEnergy can be created or destroyedBEnergy may not be transformedCThe total quantity of energy in the universe is always the sameDNone of the above

多选题Concerning the figure below, if a =b, which of the following statements must be true? (Indicate all such statements.)Ac=dBl and k are parallelCm and l are perpendicular

单选题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?()A10B30C17D16

单选题Which of the following statements concerning cargo is correct?()ACargoes are any type of goods transported by any type of shipsBCargoes are goods transported in bulkCCargoes usually include goods transported in bulk and in containersDCargoes are usually packaged in containers

多选题Click the Exhibit button.   Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe exception will be propagated back to line 27.EThe code on line 5 of class B will execute.

单选题Which of the following statements concerning butterfly valves is correct?()ASpecial tools are required for lapping or grindingBIt is impossible to throttle flow with a butterfly valveCTo close the valve, it is only necessary to turn the handle a quarter of a turnDThe butterfly valve should never be used in a freshwater system

多选题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) {}   }AThe code will fail to compile.BThe 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.CClass c has three constructors.DObjects of class b cannot be constructed.EAt most one of the constructors of each class is called as a result of constructing an object of class c.

多选题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   }   }Aa++;Bb++;Cc++;Dd++;Ee++;

单选题Which of the following statements is correct concerning heat transfer?()AHeat is given off from a high temperature region known as a heat sinkBHeat transfer rate is affected most by the size of the heat sink involvedCHeat transfer rate is affected most by the temperature difference between the heat source and the heat sinkDHeat transfer by radiation will occur only by mass motion of a fluid substance

单选题Which of the following statements is true concerning centrifugal pumps?()AThey are particularly suited for pumping high viscosity fluidsBThey are started with the discharge valve openedCThe flow of liquid is developed by imparting energy due to the rotation of an impellerDThey are always mounted in a horizontal position

单选题According to this passage, which of the following statements is FALSE?AMany employees don’t like a conservative dress code.BComfortable clothes make employees more productive.CA casual clothes code is welcomed by young employees.DAll the employers in the U. S. are for casual office wear.

单选题Which of the following statements is true concerning any evaporator?()AHigh conductivity of the distillate indicates distillate salinity is excessiveBIncreasing the absolute pressure of the shell will increase the distillers capacityCMesh separators are used in evaporators to filter the distillateDReducing the brine density will reduce the heat lost overboard

单选题Which of the following statements concerning fire-tube boilers is correct?()ACombustion gases flow through the tubesBFlames impinge on the tubesCCombustion occurs in the tubesDWater flows through the tubes

单选题Which of the following statements is true concerning the cetane number of diesel fuel?()AThe cetane number affects the amount of injection lagBThe cetane number is an indication of the fuels viscosityCIgnition lag is reduced with fuels having a high cetane numberDThe cetane number is of little significance in the combustion process

单选题Which statements concerning the switch construct are true?()AAll switch statements must have a default label.BThere must be exactly one label for each code segment in a switch statement.CThe keyword continue can never occur within the body of a switch statement.DNo case label may follow a default label within a single switch statement.EA character literal can be used as a value for a case label.

单选题Which of the following statements is correct concerning the “flash point ” of a liquid?()AIt is lower than the ignition temperatureBIt is the temperature at which a substance will spontaneously igniteCIt is the temperature at which a substance, when ignited, will continue to bumDIt is the temperature at which the released vapors will fall within the explosive range

单选题Which of the following statements is true concerning an oil cooler?()AThe oil temperature is less than the cooling water temperatureBThe oil pressure is less than the cooling water pressureCThe oil pressure is greater than the cooling water pressureDThe oil flow control valve is always installed in the oil input line

单选题Which of the following statements concerning fuel atomization in a diesel engine cylinder is correct?()AThe greater the atomization, the greater the penetrationBThe greater the atomization, the less the penetrationCThe degree of atomization has nothing to do with the degree of penetrationDAtomization and penetration are one and the same

单选题Which of the following statements is true concerning Halon 1301 fire extinguishing equipment?()AThe agent is considered nontoxic at room temperature in low concentrationsBThe agent is less effective than carbon dioxideCHalon primarily extinguishes the fire by coolingDThe agent cannot be used on electrical fires because it leaves a residue

单选题Which of the following statements is correct concerning the viscosity of lubricating oil?()AViscosity will increase as temperature increasesBViscosity is a measure of a fluid s internal resistance to flowCViscosity will decrease as temperature decreasesDViscosity is not dependent on temperature

多选题Given the following code fragment:     public void create() {     Vector myVect;     myVect = new Vector();      }  Which of the following statements are true?()AThe declaration on line 2 does not allocate memory space for the variable myVect.BThe declaration on line 2 allocates memory space for a reference to a Vector object.CThe statement on line 2 creates an object of class Vector.DThe statement on line 3 creates an object of class Vector.EThe statement on line 3 allocates memory space for an object of class Vector.