C# Questions & Answers on Multithreaded Programming – 1 for Freshers

1. Select the type of multitasking methods that exist:

a) process based
b) thread based
c) only process
d) both process & thread based
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 b
d) Both a & b
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
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.
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 a & b
d) Only b
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
Answer: d
6. Number of threads that exists for each of the processes that occurs in the program:

a) atmost 1
b) atleast 1
c) only 1
d) both a & c
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
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.
8. What does the given code snippet specify?
  1. public Thread(ThreadStart start)
a) Defines a thread
b) Declaration of a thread constructor
c) Only a
d) Only a & b
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:
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
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
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 method of Thread class is used to Suspend a thread for a period of time?

a) sleep()
b) terminate()
c) suspend()
d) stop()
Answer: a

Related

Java Multiple Choice Questions & Answers on StringBuffer Class for Freshers

1. Which of these class is used to create an object whose character sequence is mutable? a) String()b) StringBuffer()c) Both of the mentionedd) None of the mentioned Answer: b Explanation: String...

CSS Multiple Choice Questions & Answers on Styling Lists and Navigation Menus for Freshers

1. Which of the following property sets list-style-type, list-style-position, and liststyle-image? a) styleb) list-stylec) menu-styled) img-style Answer: b Explanation: Syntax: list-style...

C Programming Questions and Answers on Register Variables for Freshers

1. What is the output of this C code? #include int main() { register int i = 10; int *p = &i; *p = 11; printf("%d %d\n", i, *p); ...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item