- Home
- Placement
- Programming
- Threads
- Array
- Data Types
- Functions
- Loop & Control Statements
- Operators & Expressions
- Pointer
- Preprocessor
- Storage Classes
- Structure & Union
- Variables & Constants
- Classes and Objects
- Consructors and Destructors
- Exception handling
- File Handling
- Function Overloading
- Inheritance
- Operator Overloading
- Polymorphism
- Templates
C Language
C++ language
JAVA
-
-
( 1 ) Which method can be used to find that thread holds lock
- 1) holdLock()
- 2) lockHold()
- 3) holdsLock(object)
- 4) lockHold(object)
-
Show Answer Report Discussion in forumAnswer : 3) holdsLock(object)
Solution :
discussion
Answer : 3) holdsLock(object)
-
-
-
( 2 ) What state does Thread enter in when it has been created and started?
- 1) New
- 2) Runnable
- 3) Running
- 4) Waiting
-
Show Answer Report Discussion in forumAnswer : 3) Running
Solution :
discussion
Answer : 3) Running
-
-
-
( 3 ) Which of the following will not directly cause a thread to stop?
- 1) Input Stream Access
- 2) wait()
- 3) sleep()
- 4) notify()
-
Show Answer Report Discussion in forumAnswer : 4) notify()
Solution :
discussion
Answer : 4) notify()
-
-
-
( 4 ) What is the name of the method used to start a thread execution?
- 1) resume();
- 2) run();
- 3) start();
- 4) init();
-
Show Answer Report Discussion in forumAnswer : 3) start();
Solution :
discussion
Answer : 3) start();
-
-
-
( 5 ) Which method can be used to find whether Thread hasn't entered dead state?
- 1) isAlive()
- 2) isRunning()
- 3) isNotDead
- 4) All of the above
-
Show Answer Report Discussion in forumAnswer : 1) isAlive()
Solution :
discussion
Answer : 1) isAlive()
-
-
-
( 6 ) What notifyAll() method do?
- 1) Wakes up one threads that are waiting on this object's monitor
- 2) Wakes up all threads that are not waiting on this object's monitor
- 3) Wakes up all threads that are waiting on this object's monitor
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 3) Wakes up all threads that are waiting on this object's monitor
Solution :
discussion
Answer : 3) Wakes up all threads that are waiting on this object's monitor
-
-
-
( 7 ) What will be the result of invoking the wait() method on an object without ensuring that the current thread holds the lock of the object?
- 1) The code will fail to compile
- 2) Nothing special will happen
- 3) An IllegalMonitorStateException will be thrown if the wait() method is called, while the current thread does not hold the lock of the object
- 4) The thread will be blocked until it gains the lock of the object
-
Show Answer Report Discussion in forumAnswer : 3) An IllegalMonitorStateException will be thrown if the wait() method is called, while the current thread does not hold the lock of the object
Solution :
discussion
Answer : 3) An IllegalMonitorStateException will be thrown if the wait() method is called, while the current thread does not hold the lock of the object
-
-
-
( 8 ) What are valid statements for daemon threads?
- 1) User created threads are non daemon threads.
- 2) JVM can exit when only daemon threads exist in system.
- 3) Daemon threads are low priority threads which runs intermittently in background for doing garbage collection.
- 4) All of the above
-
Show Answer Report Discussion in forumAnswer : 4) All of the above
Solution :
discussion
Answer : 4) All of the above
-
-
-
( 9 ) What is dead thread in java ?
- 1) A thread that is waiting for I/O operation
- 2) A thread completed its run method
- 3) A thread is in sleep
- 4) None of these
-
Show Answer Report Discussion in forumAnswer : 2) A thread completed its run method
Solution : A dead or terminated thread has completed its run() method. It can never be restarted.
discussion
Answer : 2) A thread completed its run method
-
-
-
( 10 ) Which of these class is used to make a thread?
- 1) String
- 2) System
- 3) Thread
- 4) Runnable
-
Show Answer Report Discussion in forumAnswer : 3) Thread
Solution : Thread class is used to make threads in java, Thread encapsulates a thread of execution. To create a new thread the program will either extend Thread or implement the Runnable interface.
discussion
Answer : 3) Thread
-