Hot Area:

HOTSPOT
You have the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

HOTSPOT
You have the following code:

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Answer:



Leave a Reply 10

Your email address will not be published. Required fields are marked *


Paul

Paul

Indeed: Y, N, N:
Also note that the constuctor is executed twice, by new and explicit.

Output will be something like:
First
Second
Third
Third
First
Second
Third
Third,

JS1985

JS1985

Wow.. the Main method is located within the Subscriber class.
Is that intended?

Pascal

Pascal

Yes YES NO, Tested in VS, it follows an ordering, i cant subscribe first and second person gets his response before me

z1ppz

z1ppz

YES YES NO

public class Alert
{
public event EventHandler SendMessage;

public void Execute()
{
SendMessage(this, new EventArgs());
}
}

public class Subscriber
{
Alert alert = new Alert();

public void Subscribe()
{
alert.SendMessage += (sender, e) => { Console.WriteLine(“First”); };
alert.SendMessage += (sender, e) => { Console.WriteLine(“Second”); };
alert.SendMessage += (sender, e) => { Console.WriteLine(“Third”); };
alert.SendMessage += (sender, e) => { Console.WriteLine(“Third”); };
}

public void Execute()
{
alert.Execute();
}

public static void Main()
{
Subscriber subscriber = new Subscriber();
subscriber.Subscribe();
subscriber.Execute();
Console.ReadKey();
}
}

keyur

keyur

Yes Yes No
Out pot is
—————-
First
Second
Third
Third