« Extend WPF: Add your own keywords and functionality to XAML with Custom Markup Extensions | Main | Comparison of Different Open Source Licenses -With Comparison Chart! »

October 01, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54ee5d54788330105351a477b970c

Listed below are links to weblogs that reference A very simple C# interview question that most developer fails:

Comments

wekempf

public string Name
{
get { return _name; }
internal set { _name = value; }
}

Björn

public TheType TheProperty
{
get { return theField; }
internal set { theField = value; }
}

Josh

public string Name { get; internal set; }

Nick

public string Name { get; internal set; }

opo

stop being a douche, I came here to learn something but I "must wait 24 hours". I don't know much about C# or .NET but I am not biased against it. I've just never needed to utilize it thus far. I seriously cannot stand that you post a question, and remove peoples answers because they are correct. All so we must come back again tomorrow.

Tomorrow, I will have lost interest. Good day

Isaac

The syntax is:

public string Name
{
get;
internal set;
}

bhamdeveloper

I think that would be accomplished by setting that to be 'internal' as in:

internal string Name {get; set;}

Chekke

Maybe those people are to busy thinking on abstrations and frameworks that already does all the OOP for you than simple OOP questions that maybe they learned in high school and now they just forgot.

People like you just let go bright people really, The selection employment system is broken.

Sergei Drannikov

public string Name
{
get
{
return m_Name;
}

internal set
{
m_Name = value;
}
}

Works since C# 2.0

Shafqat Ahmed

Thanks guys for answering. I got the correct answers from wekempf, Björn, Josh, Nick & Isaac & Sergei Drannikov.

Stats:
This post was viewed by 141 people from Dzone in last 14 hours, 26 people from DotNetNicks and numerous others from other sources. 7 Persons attemted to answer this.

Shafqat Ahmed

opo: Sorry about that, I have just opened up comments and answers and emailed you the answer.

Chekke: We don't drop someone if they cannot answer this question. We drop someone directly from interview when someone cannot explain (even a little) the differences between interface and abstract class. Also please note that having a property that is read only to the outside world and writable to the assembly is a common design requirement. We accept the answer even if someone makes the property read only and writes a different set method for it.

My point was that that simple question is a precise technical question, a developer should know that when he applies for a senior developer post. But not knowing is ok as well as there are ways to get around that by writing a internal set method. As I have said we only drop directly from the interview if someone cannot answer on basic everyday used OOP concepts like the one I mentioned above about interface vs abstract class.

lowell

"A recent trend of new developers is baffling me. The newcomer to development do not seem to know any of the basics."

it's because these newcomers are doing this:
http://thedailywtf.com/Articles/plz-email-me-teh-codez.aspx

i dont see it is as much in my world (ruby/rails), but it seems to be rampant in both the java and .NET worlds from what i see when exploring other lands

Shafqat Ahmed

Lowell: I know what you mean. These guys don't even get through the first interview. The sad thing is that when I get the CVs, it has many false items. Let me provide an example :

Last week I had this developer's CV where he wrote he knew remoting, design patterns, reflection, attributes atc. Naturally I was interested so see that he understands design patterns as he boosts them on his CV. So we called him for an interview. When I started asking him questions I got the following response.

a. He does not know what interface is, but he had implemented one interface in a project.
b. He does not know any design pattern.
c. The only part of remoting he understands is the web.config settings part and understands that very little and has no real concept about it.

How do you find real developer when you get CVs like that without calling for an interview so time is not wasted? Phone interview? Random questions at the company website?

Dan

Yay, assuming the comments are correct, My brain which normally panics into forgetting all relevant info under stress held out.

there's a typo in the question I beleive you meant "How do you define a properTy read only for the outside world and writable for the same assembly classes?"

When interviewing someone remember that they're also interviewing you, badly written test questions don't look good. Also consider that what you think is the right answer might not be correct. Is inheritance for code re-use, or to enable polymorphic behaviour? I'd say the latter I've been told I'm wrong (and i might be).

Shafqat Ahmed

Dan: Thanks for letting me know the typo. As I have commented on the post that, this syntax proves nothing, nearly all devs failed to answer this question. But that did not stop me from testing them out more. So I was curious and wanted everyone to know this.

Yes, is a syntax quirk, not knowing this does/should not fail anyone from an interview.

About the first Paragraph of the post:
However when I am looking to hire someone who can understand my instructions such as: "Make compoment A instanciation factory based and make sure you have the exportable classes exposed via public interface with their scope being private". How do I get that done if the developer do not understand design patterns or difference between interface and abstract classes?

yteslax

Hi everyone I'm a bit surprised by this post. Since the question is about very basics of any language. Access modifiers is an introductory chapter (may be even not a chapter) in any programming language book.

Mr. Shafqat Ahmed, you told that you expect giving right answer to that question from the applicant for Senior Developer position. It's very strange again because I should not expect such an interview question if I should apply for such position.

May be you have to try .NET developers who have Java (or other than .NET) background. They have more solid knowledge than developers that have started from .NET...

Tom

If the solution is known by less then 5% of the developers, then a senior developer should know NOT to use it because any junior developer that went into the code for maintenance 6-18 months later would not understand what is going on and most likely screw it up.

Developers make the simple complex ;
Senior developers make the complex simple to understand (if it all possible).

Shafqat Ahmed

I have been working in software industry for 10+ years professionally and I now work as an architect where I guide senior developers. I started with BASIC, then VB then C, then Java then C# from the first PDC

Guys, there are 2 parts of the post.

1st part says, I am little sick of a lot of the newbie developers not knowing some important basics.

2nd part says, Hey I am surprised that a lot the developers did not get answers right for this question.

Thats all!

MS

What a completely pointless interview question. Apart from anything else, this is a very poor design choice. Just because the language allows you to do something, doesn't mean you should.

You also mention you ask the question "what's the difference between an abstract class and an interface". If you're talking to someone with a year or two's experience, fine, hit them with that. But don't waste time asking questions like these to a senior developer or a tech lead - it insults them, and it embarrasses you.

Instead, ask them what they consider a contract to be, in the context of coding. If they say 'it's an interface' - wind up the interview. He's not the droid you're looking for.

And if *you're* not able to discuss a contract without using the word 'interface' you shouldn't be interviewing people.

Raoul Duke

the visibility modifier cannot be different on get/set before c# 2.0 i think, as well. :-)

The comments to this entry are closed.

Feeds

Pages