Question about Multicast Delegates?
- by IbrarMumtaz
I am going through some exam questions for the 70-536 exam and an actual question one developer posted on his blog has popped up in my exam questions. I cannot remember what his answer was .... but below is the question:
You need to write a multicast delegate that accepts a DateTime argument and returns a bool
value. Which code segment should you use?
A: public delegate int PowerDeviceOn(bool, DateTime)
B: public delegate bool PowerDeviceOn(Object, EventArgs)
C: public delegate void PowerDeviceOn(DateTime)
D: public delegate bool PowerDeviceOn(DateTime)
The answer is A.
Can someone please explain why? As I already did some research into this
question a while ago and so I was sure that it was C, obviously now looking
back at the question its clear that I did not read properly. As i was sure
I had seen the same one before so I jumped to the most obvious one.
A variation on this question:
You need to write a multicast delegate that accepts a DateTime argument.
Which code segment should you use?
A: public delegate int PowerDeviceOn(bool, DateTime)
B: public delegate bool PowerDeviceOn(Object, EventArgs)
C: public delegate void PowerDeviceOn(DateTime)
D: public delegate bool PowerDeviceOn(DateTime)
Now this is another variation on this question, it still has the same bogus sample answers, as they still kind work in throwing the exam taker off. Notice how by simply keeping the sample answers the same and by removing a small portion of the question text, the answer is C and not A.
The variation has no official answer as I just conjured it up using the exam question as a baseplate. The answer is definitely C. This time round its easy to see why C is correct but the very first question I have an inkling but as you know an inkling is not good enough in passing exams.
Thanks For Reading.