Sail E0 Webinar

MCQs

Total Questions : 86 | Page 9 of 9 pages
Question 81.

Which of these interface is implemented by Thread class?


  1.    Runnable
  2.    Connections
  3.    Set
  4.    MapConnections
 Discuss Question
Answer: Option A. -> Runnable

None.


Question 82.

Which two are valid constructors for Thread?

    1. Thread(Runnable r, String name)

    2. Thread()

    3. Thread(int priority)

    4. Thread(Runnable r, ThreadGroup g)

    5. Thread(Runnable r, int priority)



  1.    1 and 3
  2.    2 and 4
  3.    1 and 2
  4.    2 and 5
 Discuss Question
Answer: Option C. -> 1 and 2

(1) and (2) are both valid constructors for Thread.

(3), (4), and (5) are not legal Thread constructors, although (4) is close. If you reverse the 

arguments in (4), you'd have a valid constructor.


Question 83.

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


  1.    init();
  2.    start();
  3.    run();
  4.    resume();
 Discuss Question
Answer: Option B. -> start();

Option B is Correct. The start() method causes this thread to begin execution; the Java 

Virtual Machine calls the run method of this thread.

Option A is wrong. There is no init() method in the Thread class.

Option C is wrong. The run() method of a thread is like the main() method to an application. 

Starting the thread causes the object's run method to be called in that separately executing

 thread.

Option D is wrong. The resume() method is deprecated. It resumes a suspended thread.


Question 84.

Which of these method can be used to make the main thread to be executed last 

among all the threads?


  1.    stop()
  2.    sleep()
  3.    join()
  4.    call()
 Discuss Question
Answer: Option B. -> sleep()

By calling sleep() within main(), with long enough delay to ensure that all child threads 

terminate prior to the main thread.


Question 85.

Which of these keywords are used to implement synchronization?


  1.    sunchronize
  2.    syn
  3.    synch
  4.    synchronized
 Discuss Question
Answer: Option D. -> synchronized

None


Question 86.

Which of these method is used to implement Runnable interface?


  1.    stop()
  2.    run()
  3.    runThread()
  4.    stopThread()
 Discuss Question
Answer: Option B. -> run()

To implement Runnable interface, a class needs only to implement a single method 

called run().


Latest Videos

Latest Test Papers