Question about Multicaste Delegates?
Posted
by IbrarMumtaz
on Stack Overflow
See other posts from Stack Overflow
or by IbrarMumtaz
Published on 2010-05-03T16:52:25Z
Indexed on
2010/05/03
17:08 UTC
Read the original article
Hit count: 231
I am going through some exam questions for the 70-536 exam and an actual question one developer postedon 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 arguement 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 varitation on this question:
You need to write a multicast delegate that accepts a DateTime arguement. 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 quesiton, 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 asnwers 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 definately C. This time round its easy to see why C is correctr but the very first question I have an inkiling but as you know an inkling is not good enough in passing exams.
Thanks For Reading.
© Stack Overflow or respective owner