Sail E0 Webinar

MCQs

Total Questions : 22 | Page 1 of 3 pages
Question 1. 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 2. What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY?
  1.    0 & 256
  2.    0 & 1
  3.    1 & 10
  4.    1 & 256
 Discuss Question
Answer: Option C. -> 1 & 10


1 & 10


Question 3. Which of these method is used to explicitly set the priority of a thread?
  1.    set()
  2.    make()
  3.    setPriority()
  4.    makePriority()
 Discuss Question
Answer: Option C. -> setPriority()


The default value of priority given to a thread is 5 but we can explicitly change that value between the permitted values 1 & 10, this is done by using the method setPriority().


Question 4. Which of these method is used to find out that a thread is still running or not?
  1.    run()
  2.    Alive()
  3.    isAlive()
  4.    checkRun()
 Discuss Question
Answer: Option C. -> isAlive()


The isAlive( ) method returns true if the thread upon which it is called is still running. It returns false otherwise.


Question 5. Which of these method waits for the thread to treminate?
  1.    sleep()
  2.    isAlive()
  3.    join()
  4.    stop()
 Discuss Question
Answer: Option C. -> join()


join()


Question 6. What is synchronization in reference to a thread?
  1.    It's a process of handling situations when two or more threads need access to a shared resource.
  2.    Its a process by which many thread are able to access same shared resource simultaneously.
  3.    Its a process by which a method is able to access many different threads simultaneously.
  4.    Its a method that allow to many threads to access any information require.
 Discuss Question
Answer: Option A. -> It's a process of handling situations when two or more threads need access to a shared resource.


When two or more threads need to access the same shared resource, they need some way to ensure that the resource will be used by only one thread at a time, the process by which this is achieved is called synchronization


Question 7. Which of these method is used to begin the execution of a thread?
  1.    run()
  2.    start()
  3.    runThread()
  4.    startThread()
 Discuss Question
Answer: Option B. -> start()


start()


Question 8. Which of these interface is implemented by Thread class?
  1.    Runnable
  2.    Connections
  3.    Set
  4.    MapConnections
 Discuss Question
Answer: Option A. -> Runnable


Runnable


Question 9. 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().


Question 10. Which of these method waits for the thread to treminate?
  1.    sleep()
  2.    isAlive()
  3.    join()
  4.    stop()
 Discuss Question
Answer: Option C. -> join()


join()


Latest Videos

Latest Test Papers