Which class or interface defines the wait(), notify(), and notifyAll() methods?

  • Object

Which of the following will not directly cause a thread to stop?

  • notify()

Assume the following method is properly synchronized and called from a thread A on an object B:


After calling this method, when will the thread A become a candidate to get another turn at the CPU?

  • After thread A is notified, or after two seconds.

Which method registers a thread in a thread scheduler?

  • start();

Which will contain the body of the thread?

  • run();

Which method must be defined by a class implementing the java.lang.Runnable interface?

  • public void run()

Which of the following will directly stop the execution of a Thread?

  • wait()

Which three guarantee that a thread will leave the running state?

  • wait()
  • sleep(1000)
  • aLiveThread.join()

Which two of the following methods are defined in class Thread?

  • start()
  • run()

Which cannot directly cause a thread to stop executing?

  • Calling notify() method on an object.

Which three are methods of the Object class?

  • notify();
  • notifyAll();
  • wait(long msecs);

Which two are valid constructors for Thread?

  • Thread(Runnable r, String name)
  • Thread()

What is the name of the method used to start a thread execution?

  • start();

What allows the programmer to destroy an object x ?

  • Only the garbage collection system can destroy an object.

© 2018 Micro Solutions Bangladesh and/or MCQ Academy.