Threads Interview Questions and Answers Part 1

1. What is Thread?
Ans. Threads are part of process.
     Threads are the units to which an operating system allocates processor time, and more than one thread can be executing code inside that process.

2. What is meany by process?
Ans. A process is a group of threads that share the same virtual memory.
     A process must have atleast one thread of execution, and a thread always run in a process context.

3. What is Multi-threading?
Ans. When a collection of threads executed with in the same program to generate the output.

4. What is Multi-tasking?
Ans. Multiple programs running at same time is called multi tasking.

5. What is the namespace used for threading?
Ans. The namespace used for threading is "System.Threading"

6. What is meant by AppDomain?
Ans. Os process are subdivided into light weight managed sub processes called application domains.
7. Explain Theard.Sleep()?
Ans. Thread.sleep() method is used to "pauses" the current thread execution for a given period of time.
8. How to make a thread sleep for infinite period and also interupt it?
Ans. Thread.Sleep (System.Threading.Timeout.Infinite). 
     Thread.Interrupt - To Interrupt

9. Explain Thread.Suspend and Thread.Resume?
Thread.Suspend() - this will suspend the thread execution.
Thread.Resume() - this will resume the thread again.

10. What is difference between Thread.Sleep and Thread.Suspend()?
Thread.Sleep() - this will place thread under wait state.
Thread.Suspend() - this will go into wait state until if it is in a safe place.


Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker