JavaDeploy
SiteMap
Java Certification
Java Beans
Java-OO Concepts
Threading Model
«Prev
Next»
Java Certification
Java Fundamentals
Source Files Compilation
Declare import Packages
Java main method
Identifiers Keywords
Primitive Types
Literal Values
Automatic Initialization
language-fundamentals-conclusion
Classes Objects
Object Oriented Programming
Class Interface Declarations
Subclasses Superclasses
Class Constructor Syntax
Types Of Nested Classes
Interface Use Declaration
Inner Class
Local Inner Classes
Anonymous Inner Class
Classes Objects - Conclusion
Anonymous Class - Quiz
Java Operators
Operator Summary
Logical Operators
Numeric Conversions
Casting Numeric Types
Java Casting - Quiz
Equality Testing
Assignment Operators
Order Of Evaluation.
Operator Conclusion
Declaring Java Methods
Declaring Variables
122
Exception Handling
Program Statements
Decision Making Code
for, while, do Loops
Java Break Statement
Throw Statement
try catch Block
Garbage Collection
Java Finalization
Java Statements Conclusion
Java Threading Model
Multithreading Theory
Starting Threads
Thread States
Ready to Running State
Waiting Dying Threads
Synchronized Shared Objects
Synchronization Concepts -Quiz
Waiting Notifying Threads
Preventing Thread Execution
Threading Model Conclusion
Synchronization Concepts - Quiz
Each question is worth one point. Select the best answer or answers for each question.
1.
Which of the following statements about synchronization are true?
Please select one option.
A.
Synchronization is used to coordinate access to objects that are shared among multiple threads.
B.
A synchronized method may be invoked and executed without acquiring an object's lock.
C.
A non-synchronized method requires that a thread obtain an object's lock before the method may be executed.
D.
Another word for lock is monitor.
E.
A synchronized statement may only appear in a synchronized method.
2.
Which of the following correctly tells about the effect of calling wait() method on an object? (Assume that the calling Thread has the lock of that object.)
Please select one option.
A.
The thread that has called the wait() will not come out of WAITING state until some other thread calls notify or notifyAll on the same object or interrupts the thread.
B.
The object issuing the call to wait() will halt until another object sends a notify() or notifyAll() method
C.
An exception might be raised if it is not called in a synchronized block otherwise no exception will be raised.
D.
The thread calling wait() will be automatically synchronized with any other threads who call wait().
E.
None of the above.
3.
Thread T2 has called obj.wait() and is blocked. Thread T1 holds the lock for an object obj.
What will allow the thread T2 to become runnable?
Please select one option.
A.
Thread T1 calls Thread.sleep(100).
B.
Thread T2's wait() times out.
C.
Thread T1 is interrupted.
D.
Thread T1 releases the lock on obj and calls the notify() method on T2.
E.
Thread T1 calls the notify() method on obj and releases the lock on obj.
4.
Which of the following statements are true?
Please select one option.
A.
A program ends when all daemon threads end.
B.
A program ends when all non-daemon threads end.
C.
A program ends when all threads end.
D.
A daemon thread is a low priority thread that never stops but keeps running in the back ground.
E.
A user thread cannot stop a non-user or daemon thread.
5.
The synchronized keyword can be applied to:
Please select one option.
A.
a class
B.
any method of a class
C.
an interface
D.
a method in an interface
E.
an instance field of a class
F.
an instance method of a class
Ad
Java Language Reference