How can you ensure that multithreaded code does not deadlock? : Questions « Thread « SCJP

Home
SCJP
1.Java Source And Data Type
2.Operators
3.Modifiers
4.Type Casting
5.Statements
6.Object Oriented
7.Thread
8.Utility Classes
9.File
SCJP » Thread » Questions 
7.13.3.How can you ensure that multithreaded code does not deadlock?
A.      Change the priorities of your threads.
B.      Make sure all threads yield from time to time.
C.      Mark Synchronize for methods
D.      Synchronize access to all shared variables.
E       None of above
7.13.Questions
7.13.1.How to prevent shared data from being corrupted in a multithreaded environment?
7.13.2.Answer: multi-thread
7.13.3.How can you ensure that multithreaded code does not deadlock?
7.13.4.Answer: thread and deadlock
7.13.5.When you declare synchronized code, you can specify the object on whose lock the block should synchronize.
7.13.6.Answer: lock
7.13.7.How to create a thread?
7.13.8.Answer: thread creation
7.13.9.The Runnable interface declares which methods?
7.13.10.Answer: methods in Runnable interface
7.13.11.t implements Runnable interface, which Thread method to call to execute it as a separate thread?
7.13.12.Answer: start method
7.13.13.Which of the following are thread states?
7.13.14.Answer: thread status
7.13.15.Which of the following thread state transitions are valid?
7.13.16.Answer: thread state transitions
7.13.17.What is the result of this code?
7.13.18.Answer: Thread
7.13.19.What is the output(sleeping thread)?
7.13.20.Answer: sleeping thread
7.13.21.What is the result of trying to compile and run this program?
7.13.22.Answer: synchronized block
7.13.23.The notifyAll() method must be called from a synchronized context(True/False)
7.13.24.Answer: notifyAll
7.13.25.To call wait(), an object must own the lock on the thread(True/False)
7.13.26.Answer: wait()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.