Question: Consider the below C# program. static void Worker 1 ( ) { Thread t 2 = new Thread ( Worker 2 ) ; t 2

Consider the below C# program.
static void Worker1(){
Thread t2= new Thread(Worker2);
t2.Start();
Thread.Sleep(1000);
Console.Write("b");
}
static void Worker2(){
Console.Write("c");
}
static void Main(string[] args){
Thread t = new Thread(Worker1);
Console.Write("a");
t.Start();
}
Assume two changes to this code:
the last two statements in main are swapped
the Sleep statement is replaced with t2.Join();
Which of the following are possible outputs of this program?
abc
acb
bac
bca
cab
cba

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!