C# MCQ Questions And Answers - Multithreading
This section focuses on "Multithreading" in C#. These Multiple Choice Questions (MCQs) should be practiced to improve the C# skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.
1. Threads are ?
Explanation: Threads are lightweight processes
2. The threads created using the Thread class are called the?
Explanation: The threads created using the Thread class are called the child threads of the main thread.
3. Which method for making a thread pause for a specific period of time.
Explanation: sleep() method for making a thread pause for a specific period of time.
4. Select the type of multitasking methods that exist:
Explanation: There are two distinct types of multitasking: process-based and thread-based.
5. Choose the correct statement about process-based multitasking.
Explanation: The process-based multitasking is the feature that allows your computer to run two or more programs concurrently. For example, process-based multitasking allows you to run a word processor at the same time you are using a spreadsheet or browsing the Internet. In process-based multitasking, a program is the smallest unit of code that can be dispatched by the scheduler.
6. Choose the namespace which supports multithreading programming?
Explanation: The classes that support multithreaded programming are defined in the System.Threading namespace. Thus, you will usually include this statement at the start of any multithreaded program.
7. Which of these keywords are used to implement synchronization?
Explanation: synchronized keywords are used to implement synchronization
8. What is synchronization in reference to a thread?
Explanation: When two or more threads need to access the same shared resource, they need some way to ensure that the resource will be used by only one thread at a time, the process by which this is achieved is called synchronization.
9. Which method is called when a thread is blocked from running temporarily?
Explanation: When a thread is temporarily blocked from running, it calls Wait( ). This causes the thread to go to sleep and the lock for that object to be released, allowing another thread to acquire the lock.
10. The runtime aborts the thread by throwing a ThreadAbortException
Explanation: The runtime aborts the thread by throwing a ThreadAbortException