Programming  Java  Threads

Answer each question, once completed click submit.

1. Two threads cannot simultaneously enter into the methods of the same object if the methods are

static synchronized private package

Workspace

Discuss

2. While using threads which of the following is incorrect?

You invoke the Run method You implement Runnable interface You extend from Thread class You call the start method

Workspace

Discuss

3. What is the name of the method used to schedule a thread for execution?

init() start() run() resume()

Workspace

Discuss

4. What is the default priority of a thread in Java?

10 5 3 1

Workspace

Discuss

5. A thread becomes not runnable when

its sleep method is invoked the program terminates a network connection is established an event occurs

Workspace

Discuss

6. What is the default priority of a newly created thread?

MIN_PRIORITY NORM_PRIORITY MAX_PRIORITY None of these

Workspace

Discuss

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?
while the current thread does not hold the lock of the object

The code will fail to compile Nothing special will happen An IllegalMonitorStateException will be thrown if the wait() method is called, The thread will be blocked until it gains the lock of the object

Workspace

8. Which one of the following is a static member of Thread ?

currentThread() join() getName() interrupt()

Workspace

Discuss

9. Select the valid thread state transition?

ready to running ready to waiting waiting to running running to ready

Workspace

Discuss

10. What is dead thread in java ?

A thread that is waiting for I/O operation A thread completed its run method A thread is in sleep None of these

Workspace

Discuss

11. Which of these class is used to make a thread?

String System Thread Runnable

Workspace

Discuss

12. Which of these interface is implemented by Thread class?

Runnable Connections Set MapConnections

Workspace

Discuss

13. Which of these method of Thread class is used to find out the priority given to a thread?

get() ThreadPriority() getPriority() getThreadPriority()

Workspace

Discuss

14. Which of these method of Thread class is used to Suspend a thread for a period of time?

sleep() terminate() suspend() stop()

Workspace

Discuss

15. Which function of pre defined class Thread is used to check weather current thread being checked is still running?

isAlive() Join() isRunning() Alive()

Workspace

Discuss

16. What is multithreaded programming?
Which of these are types of multitasking?

It’s a process in which two different processes run simultaneously. It’s a process in which two or more parts of same process run simultaneously. Its a process in which many different process are able to access same information. Process based

Workspace

Discuss

17. Which of these packages contain all the Java’s built in exceptions?

Thread based Process and Thread based None of the mentioned javio

Workspace

Discuss

18. Thread priority in Java is?

java.util java.lang java.net Integer

Workspace

Discuss

19. Which of these statements is incorrect?

Float double long By multithreading CPU’s idle time is minimized, and we can take maximum use of it.

Workspace

Discuss
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19