in Education by
What should not be done to avoid deadlock? (a) Avoid using multiple threads (b) Avoid hold several locks at once (c) Execute foreign code while holding a lock (d) Use interruptible locks I have been asked this question in examination. Question is from Multithreading topic in chapter Multithreading of Java Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
Correct choice is (c) Execute foreign code while holding a lock The best explanation: To avoid deadlock situation in Java programming do not execute foreign code while holding a lock.

Related questions

0 votes
    Deadlock is a situation when thread is waiting for other thread to release acquired object. (a) True (b) ... Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of this method is used to avoid polling in Java? (a) wait() (b) notify() (c) notifyAll() ( ... in portion Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What should not be done to avoid deadlock? (a) Avoid using multiple threads (b) Avoid hold several ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Which of this method is used to find out that a thread is still running or not? (a) run() (b) ... in chapter Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What does not prevent JVM from terminating? (a) Process (b) Daemon Thread (c) User Thread (d) JVM ... chapter Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of this method can be used to make the main thread to be executed last among all the threads? ... portion Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What will happen if two thread of the same priority are called to be processed simultaneously? (a) Anyone ... Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of the following will ensure the thread will be in running state? (a) yield() (b) notify() (c ... section Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is the default value of priority variable MIN_PRIORITY AND MAX_PRIORITY? (a) 0 & 256 (b) 0 & 1 ... section Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method waits for the thread to terminate? (a) sleep() (b) isAlive() (c) join() (d ... in division Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method is used to explicitly set the priority of a thread? (a) set() (b) make() ( ... in division Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    What is synchronization in reference to a thread? (a) It's a process of handling situations when two or ... Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method is used to implement Runnable interface? (a) stop() (b) run() (c) runThread( ... division Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these method is used to begin the execution of a thread? (a) run() (b) start() (c) ... in chapter Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
0 votes
    Which of these statement is incorrect? (a) A thread can be formed by implementing Runnable interface only (b ... Multithreading of Java Select the correct answer from above options...
asked Mar 1, 2022 in Education by JackTerrance
...