C# Multiple Choice Questions – Multithreaded Programming

This section of our 1000+ C# MCQs focuses on multithreaded programming in C# Programming Language.

1. Select the type of multitasking methods that exist:
a) process based
b) thread based
c) only process
d) both process & thread based
View Answer

Answer: d
Explanation: There are two distinct types of multitasking: process-based and thread-based.

2. Choose the correct statement about process-based multitasking.
a) A feature that allows our computer to run two or more programs concurrently
b) A program that acts as a small unit of code that can be dispatched by the scheduler
c) Only A program that acts as a small unit of code that can be dispatched by the scheduler
d) Both A feature that allows our computer to run two or more programs concurrently & A program that acts as a small unit of code that can be dispatched by the scheduler
View Answer

Answer: d
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.

3. Choose the statements which indicate the differences between the thread based multitasking and process based multitasking.
a) Process-based multitasking handles the concurrent execution of programs
b) Process-based multitasking handles the concurrent execution of pieces of the same program
c) Thread-based multitasking handles the concurrent execution of programs
d) Thread-based multitasking deals with the concurrent execution of pieces of the same program
View Answer

Answer: a
Explanation: The differences between process-based and thread-based multitasking can be summarized like this:Process-based multitasking handles the concurrent execution of programs. Thread-based multitasking deals with the concurrent execution of pieces of the same program.
advertisement
advertisement

4. What is the advantage of the multithreading program?
a) Enables to utilize the idle and executing time present in most programs
b) Enables to utilize the idle time present in most programs
c) Both Enables to utilize the idle and executing time present in most programs & Enables to utilize the idle time present in most programs
d) Only Enables to utilize the idle time present in most programs
View Answer

Answer: d
Explanation: The principal advantage of multithreading is that it enables us to write very efficient programs because it lets us utilize the idle time that is present in most programs.

5. Select the two type of threads mentioned in the concept of multithreading:
a) foreground
b) background
c) only foreground
d) both foreground & background
View Answer

Answer: d
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Number of threads that exists for each of the processes that occurs in the program:
a) at most 1
b) atleast 1
c) only 1
d) both at most 1 & atleast 1
View Answer

Answer: d
Explanation: All processes have at least one thread for execution, which is usually called the main thread because it is the primary thread that is executed when our program begins. From the main thread, we can create other threads.

7. Choose the namespace which supports multithreading programming?
a) System.net
b) System.Linq
c) System.Threading
d) All of the mentioned
View Answer

Answer: c
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.
advertisement

8. What does the following C# code snippet specify?

  1. public Thread(ThreadStart start)

a) Defines a thread
b) Declaration of a thread constructor
c) Only Defines a thread
d) Only Defines a thread & Declaration of a thread constructor
View Answer

Answer: d
Explanation: To create a thread, instantiate an object of type Thread, which is a class defined in System.Threading. The simplest Thread constructor is shown here:

advertisement
          public Thread(ThreadStart start)

Here, start specifies the method that will be called to begin execution of the thread. In other words, it specifies the thread’s entry point.

9. Which of these classes is used to make a thread?
a) String
b) System
c) Thread
d) Runnable
View Answer

Answer: c
Explanation: The multithreading system is built upon the Thread class, which encapsulates a thread of execution. The Thread class is sealed, which means that it cannot be inherited. Thread defines several methods and properties that help manage threads.

10. On call of which type of method the new created thread will not start executing?
a) Begin()
b) Start()
c) New()
d) All of the mentioned
View Answer

Answer: b
Explanation: Once created, the new thread will not start running until you call its Start() method, which is defined by Thread.

11. Which of these methods of Thread class is used to Suspend a thread for a period of time?
a) sleep()
b) terminate()
c) suspend()
d) stop()
View Answer

Answer: a
Explanation: None.

More MCQs on C# Multithreaded Programming:

Sanfoundry Global Education & Learning Series – C# Programming Language.

To practice all areas of C# language, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.