网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
What happens when thread X executes a wait() method on object A, without owning object A’s lock?()
A

 Compilation fails.

B

 An exception is thrown.

C

 The wait() method has no effect.

D

 Thread X receives the lock immediately.

E

 Object A moves the thread to the wait pool.


参考答案

参考解析
解析: 暂无解析
更多 “单选题What happens when thread X executes a wait() method on object A, without owning object A’s lock?()A  Compilation fails.B  An exception is thrown.C  The wait() method has no effect.D  Thread X receives the lock immediately.E  Object A moves the thread to the wait pool.” 相关考题
考题 public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 The code executes and prints “running”.D、 The code executes and prints “runningrunning”.E、 The code executes and prints “runningrunningrunning”.

考题 What is the name of the method that threads can use to pause their execution until signalled to continue by another thread? () Fill in the name of the method (do not include a parameter list).

考题 void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?() A、 This code may throw an InterruptedException.B、 This code may throw an IllegalStateException.C、 This code may throw a TimeoutException after ten minutes.D、 This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.E、 Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.F、 A call to notify() or notifyAll() from another thread may cause this method to complete normally.

考题 Which two CANNOT directly cause a thread to stop executing?()A、 Calling the yield method.B、 Calling the wait method on an object.C、 Calling the notify method on an object.D、 Calling the notifyAll method on an object.E、 Calling the start method on another Thread object.

考题 Which two of statements are true?()A、It is possible to synchronize static methods.B、When a thread has yielded as a result of yield(), it releases its locks.C、When a thread is sleeping as a result of sleep(), it releases its locks.D、The Object.wait() method can be invoked only from a synchronized context.E、The Thread.sleep() method can be invoked only from a synchronized context.F、When the thread scheduler receives a notify() request, and notifies a thread, that thread immediately releases its lock.

考题 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.

考题 Under which circumstances will a thread stop?()  A、The method waitforId() in class MediaTracker is called.B、The run() method that the thread is executing ends.C、The call to the start() method of the Thread object returns.D、The suspend() method is called on the Thread object.E、The wait() method is called on the Thread object.

考题 What happens when thread X executes a wait() method on object A, without owning object A’s lock?()  A、 Compilation fails.B、 An exception is thrown.C、 The wait() method has no effect.D、 Thread X receives the lock immediately.E、 Object A moves the thread to the wait pool.

考题 Given:  foo and bar are public references available to many other threads, foo refers to a Thread and bar is an Object. The thread foo is currently executing bar.wait().  From another thread, what provides the most reliable way to ensure that foo will stop executing wait()?()A、foo.notify();B、bar.notify();C、foo.notifyAll();D、Thread.notify();E、bar.notifyAll();F、Object.notify();

考题 What can cause a thread to become non-runnable?()A、 Exiting from a synchronized block.B、 Calling the wait method on an object.C、 Calling the notify method on an object.D、 Calling the notifyAll method on an object.

考题 Which two CANNOT directly cause a thread to stop executing? ()  A、 Existing from a synchronized block.B、 Calling the wait method on an object.C、 Calling notify method on an object.D、 Calling read method on an InputStream object.E、 Calling the SetPriority method on a Thread object.

考题 Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?A、foo.notify();B、bar.notify();C、foo.notifyAll();D、Thread.notify();E、bar.notifyAll();

考题 You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator "=".What happens when the main query is executed?()A、The main query executes with the first value returned by the subquery.B、The main query executes with the last value returned by the subquery.C、The main query executes with all the values returned by the subquery.D、The main query fails because the multiple-row subquery cannot be used with the comparison operator.E、You cannot define a multiple-row subquery in the WHERE clause of a SQL query.

考题 单选题Under which circumstances will a thread stop?()A The method waitforId() in class MediaTracker is called.B The run() method that the thread is executing ends.C The call to the start() method of the Thread object returns.D The suspend() method is called on the Thread object.E The wait() method is called on the Thread object.

考题 单选题You work as an application developer at Certkiller .com. Certkiller .com has asked you to create a multi-threaded application, which executes a critical database  backup operation on an hourly basis. You define this operation with the following code:  public void BackupDB () {  //Implementation code }  You then create a Thread object for the purpose of invoking this method.  You need to ensure that the thread is scheduled for execution before any other thread at runtime.What should you do?()A AB BC CD D

考题 单选题public class Threads3 implements Runnable {  public void run() {  System.out.print(”running”);  }  public static void main(String[] args) {  Thread t = new Thread(new Threads3());  t.run();  t.run();  t.start();  }  }  What is the result?()A  Compilation fails.B  An exception is thrown at runtime.C  The code executes and prints “running”.D  The code executes and prints “runningrunning”.E  The code executes and prints “runningrunningrunning”.

考题 填空题What is the name of the method that threads can use to pause their execution until signalled to continue by another thread? () Fill in the name of the method (do not include a parameter list).

考题 单选题What can cause a thread to become non-runnable?()A  Exiting from a synchronized block.B  Calling the wait method on an object.C  Calling the notify method on an object.D  Calling the notifyAll method on an object.

考题 多选题Which two can directly cause a thread to stop executing?()AExiting from a synchronized block.BCalling the wait method on an object.CCalling the notify method on an object.DCalling the notifyAll method on an object.ECalling the setPriority method on a thread object.

考题 多选题Which two CANNOT directly cause a thread to stop executing? ()ACalling the yield method.BCalling the wait method on an object.CCalling the notify method on an object.DCalling the notifyAll method on an object.ECalling the start method on another Thread object.

考题 单选题You are creating a Windows application for graphical image processing by using the .NET Framework 3.5. You create an image processing function and a delegate.You plan to invoke the image processing function by using the delegate.You need to ensure that the calling thread meets the following requirements:  (1)It is not blocked when the delegate is running   (2)It is notified when the delegate is complete What should you do?()A Call the Invoke method of the delegate.B Call the BeginInvoke and EndInvoke methods of the delegate in the calling thread.C Call the BeginInvoke method by specifying a callback method to be executed when the delegate is complete.Call the EndInvoke method in the callback method.D Call the BeginInvoke method by specifying a callback method to be executed when the delegate is complete.Call the EndInvoke method of the delegate in the calling thread.

考题 多选题Which two CANNOT directly cause a thread to stop executing? ()AExisting from a synchronized block.BCalling the wait method on an object.CCalling notify method on an object.DCalling read method on an InputStream object.ECalling the SetPriority method on a Thread object.

考题 多选题Which two of statements are true?()AIt is possible to synchronize static methods.BWhen a thread has yielded as a result of yield(), it releases its locks.CWhen a thread is sleeping as a result of sleep(), it releases its locks.DThe Object.wait() method can be invoked only from a synchronized context.EThe Thread.sleep() method can be invoked only from a synchronized context.FWhen the thread scheduler receives a notify() request, and notifies a thread, that thread immediately releases its lock.

考题 单选题Which statement is true?()A  If only one thread is blocked in the wait method of an object, and another thread executes the modify on that same object, then the first thread immediately resumes execution.B  If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, it is still possible that the first thread might never resume execution.C  If a thread is blocked in the wait method of an object, and another thread executes the notify method on the same object, then the first thread definitely resumes execution as a direct and sole  consequence of the notify call.D  If two threads are blocked in the wait method of one object, and another thread executes the notify method on the same object, then the first thread that executed the wait call first definitely resumes execution as a direct and sole consequence of the notify call.

考题 单选题void waitForSignal() {  Object obj = new Object();  synchronized (Thread.currentThread()) {  obj.wait();  obj.notify();  }  }  Which is true?()A  This code may throw an InterruptedException.B  This code may throw an IllegalStateException.C  This code may throw a TimeoutException after ten minutes.D  This code will not compile unless “obj.wait()” is replaced with “((Thread) obj).wait()”.E  Reversing the order of obj.wait() and obj.notify() may cause this method to complete normally.F  A call to notify() or notifyAll() from another thread may cause this method to complete normally.

考题 单选题You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator "=".What happens when the main query is executed?()A The main query executes with the first value returned by the subquery.B The main query executes with the last value returned by the subquery.C The main query executes with all the values returned by the subquery.D The main query fails because the multiple-row subquery cannot be used with the comparison operator.E You cannot define a multiple-row subquery in the WHERE clause of a SQL query.

考题 单选题Given: foo and bar are public references available to many other threads. foo refers to a Thread and bar is anObject.  The thread foo is currently executing bar.wait().  From another thread,what provides the most reliable wayto ensure that foo will stop executing wait()?A foo.notify();B bar.notify();C foo.notifyAll();D Thread.notify();E bar.notifyAll();