Multithreading


  1. Which of the following will ensure the thread will be in running state?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    wait() always causes the current thread to go into the object’s wait pool. Hence, using this in a thread will keep it in running state.


  1. Which of the following stops execution of a thread?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    notify() wakes up a single thread which is waiting for this object.



  1. Which of these package provides the ability to read and write in Zip format?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    java.util.zip


  1. What is true about threading?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    start() eventually calls run() method. Start() method creates thread and calls the code written inside run method.



  1. What should not be done to avoid deadlock?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    To avoid deadlock situation in Java programming do not execute foreign code while holding a lock.