Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What should a mid-level C# developer know? 4

Status
Not open for further replies.

imterpsfan3

Programmer
Jul 22, 2005
160
US
I'm not sure if this is posting to the right forum. I recently went for an interview for a mid-level C# developer. They asked me stuff about reflection, can you inherit from a string, if a string had 1GB of data in it, should it be passed by value or reference, how is a string an immutable object, etc etc.

Are these ridiculous questions or what?

I can't think of a situation where you would have a GB of data in a string or would want to. You could know the answers to all those questions and still be a rotten programmer.

Or perhaps I should know all these things. Just looking for some feedback.

Microsoft Certified Solutions Developer -- Visual Basic 6
Microsoft Certified Applications Developer C# (in the works)
 
The best interviews - involve a problem and your solution.

An employer should look at your analytical skills and your creativity. Any monkey can punch code into a computer. Its the ability to architect a solid and efficient solution that is scalable and easy to manage.

I believe in strong OO concepts. Design patterns especially.

In the case of your questions, they are trying to make a point.

Can you inherit from a string? no - its a basic datatype
If a string had 1GB of data: you would pass a reference, why create another GB variable? This doesn't so much apply to strings - but maybe Images, large datasets, etc.
Reflection and concepts related to reflection: whop them off their butts with a kickin' example.

I'm looking for a job where the interviewer expects me to teach them something. (If anyone has an opportunity available...)

Stick with C# though - there's some good solutions out there!
 
I often encounter the need to declare very large strings. But I work in a specialized field.

Reflection is a core concept of OOP, so that should be known. Asking about "string inheritance" is testing whether you know if a "string" is an object vs. a data type. Passing by value or reference is meant to discern if you know what happens to the value of an object in each situation. So those three are all valid quesitons.

Not sure about the "immutable object" question.

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thanks for your feedback. I learned a few things from the both of you. I have mostly created database driven applications with Visual Basic and C#. I have worked with class modules, DLL's, etc. I'm not always good on the terminology.

Ok, this interview proved I was stupid. Maybe I should take the label of programmer off of my profile here lol. I guess I'll have to qualify myself as a rookie. Needless to say it was a humiliating experience. I probably shouldn't go to another interview until I become well-versed in all of the OOP concepts.

They must have asked me about 50 questions. I answered 30 of them as well as one could. I even brought up some things they didn't know. Believe it or not I was able to remember most of the questions after the interview and wrote them down.

The interviewer said he prided himself on the fact that a lot of people come to his interview with a lot of confidence, but he's able to humble them.

Can someone suggest a good OOP book that explains concepts like these? I didn't go to college for computer science.



Microsoft Certified Solutions Developer -- Visual Basic 6
Microsoft Certified Applications Developer C# (in the works)
 
That's a bad interviewer. Be glad you didn't work for that company. Well, perhaps that's a little rough. I've hired/trained a lot of programmers, and the primary qualification has always been aptitude. Rather than trying to "humble" potential employees, I tested:

1) visual speed and accuracy
2) mechanical comprehension
3) typing skills

Then I took those candidates that excelled in these areas, and tested/sought specific skill sets. I wasn't looking for terminology knowledge. If I wanted an experienced programmer, I wanted to see what programs they'd written.

Everything else can be taught.

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
I actually had a few applications that I wanted to show them but they weren't interested in any of the code I had written.

I knew this wasn't the right place for me to work. He explained that they have "code audits" and that if you fail more than one, they fire you.

The place seemed more like a chop shop to me.

But this all proved that I need to build a better foundation in object-oriented programming. I'm going to use this as a learning experience so I can get better.

I'm a rookie but learning...
 
This interview is basically telling me that I need to go find another career besides programming.

I'm a rookie but learning...
 
Dear imterpsfan3,
First of all i'd like to thank all who replied there for their valuable replies, I really liked it as I have imterpsfan3 problem with termonologies. But i'd like to express it from one other point of view as I had some of such strange interviews. It happened many times that the interviewer asked me about things he's not seeking an answer, he's just watching my attitude even if my answer wrong!. So in my opninion, most experienced applicants may fail in at least one technical question so it's acceptable but an applicant should know how to act in the situation of a difficult question or even an embarrasing question.
I hope u got what I mean.
One more point, never lose confidence in yourself. Believe you'r good and willing o be better and it's a recruiter problem if he needs an applicant with ur skills or higher.

 
Strings are immutable, so if you have one and you append something to it, or change it, the CLR chucks it away and makes a new one. This normally isn't too much of an overhead problem unless you are looping through a collection and building up a string as you go, maybe to build up a report or something. In which case you should use the StringBuilder class, which is specifically designed to handle this situation.

As for the rest, don't get disheartened. Most of what goes on in .NET involves knowing how and when to use the framework classes, and there are thousands of them. Nobody (except maybe JurkMonkey and ChipH [smile]) knows them all. many times you will see code where the author appears to be jumping through hoops to perform some task that can be accomplished with a single method call on a framework class - they just didn't know the class existed, or maybe what it was for. What IS important is your attitude - if you don't know something, it's OK to admit it as long as you make a point of finding out how to do it. People will normally respect your honesty more than your BS.
 
stevexff is right - when I went for my job interview I was asked a bunch of questions about Java that I didn't know. But my answer was "I can learn anything"

they liked that. It is about attitude!
 
This interview is basically telling me that I need to go find another career besides programming.

Don't get discouraged by this guy. His comment about failing two code audits and you're fired is not a good sign. 5 or 6, and you may be shown the door, but not 2.

There can be jerks in any industry.

Chip H.


____________________________________________________________________
Donate to Katrina relief:
If you want to get the best response to a question, please read FAQ222-2244 first
 
I hate it when interviewers think they can determine something about someone by asking tidbits of info.

Programming ability has nothing to do with memorization skills. (not that a good memory won't help)

I'm currently interviewing for a C# position and I would not ask any of those questions. The questions I ask are more along the lines of "How would you approach the following problem...", "What project are you most proud of?", "What's the biggest programming mistake you've made?", followed up by "what did you learn from this mistake and how did you adjust to prevent similar mistakes in the future?
 
I think it depends. Those questions probable are not applicable to a mid-level C# developer and NeilTrain's approach is more inline, because good problem solving skills and ability to learn are much more important for a Mid Level canidate then rattling off specifics.

On the Senior level though, you have to know those answers and much more by heart or your ability to give guildance and direction to a project could be compromised. This level of knowledge only comes with expirence.
If you don't recognize that a string is an immutable object, your whole app could blow up.

That interviewer sounds like he was showing off. You should stroke his ego a little in that case. Tell the interview that you hope to become as smart as him someday:)
 
That interviewer sounds like he was showing off. You should stroke his ego a little in that case. Tell the interview that you hope to become as smart as him someday:)

One of the smarts comments on this thread.

can you inherit from string was a question about Sealed classes which is legitimate question, as a beginner, let alone intermediate, you should know the semantics of classes and methods. The answer is no, it is Sealed.

Can you pass string by value? Was a question to test your knowledge about value types and reference types in C#. String is a reference type; even though it is immutable.

Immutable types are used to make reference types that have value semantics (i.e act like value types) This means that the Operator = (the one you will be calling to modify the string) will return a new instance of the class instead of reference to the same class after modifying it.

You don’t need to quit programming; you just need to read more.
My advice is
1- Forget every thing negative about this interview. After all it is one company out of zillions out there need us
2- Buy Andrew Troelsen C# and the .NET Platform and “eat” it.
Good luck to you


Walid Magd
 
I apologies for my cryptic comment about passing string by value which I now realize it is may be confusing. "Even though" should have been “However” and the whole comment should have been written like this

Can you pass string by value? Was a question to test your knowledge about value types and reference types in C#. String is a reference type; However it is immutable.

The real meaning of passing by value is to call the copy constructor. And because string DOES has a value semantics, passing string as a parameter to a method will automatically invoke the copy constructor. In plain English, the method will work on a copy of the string and any modifications will not affect the original string. If passing by reference is desired, use the key word “ref” in the method definition/call

Ex:
using System;

namespace ByValueOrByReference
{
class Class1
{

static void Main(string[] args)
{
string str1 = "I am the original string.";
Console.WriteLine(str1);
ChangeString(/*ref*/ str1);
Console.WriteLine(str1);

}
static public string ChangeString(/*ref*/ string str)
{
str = "I am the modified string.";
Console.WriteLine(str);
return str;
}

}
}

The output will be
I am the original string.
I am the modified string.
I am the original string.

However, if you uncommented the /*ref*/ it will be
I am the original string.
I am the modified string.
I am the modified string.

Of course you still can pass by value and have the original string affected by assigning the return value to it
Str1 = ChangeString(/*ref*/ str1);

But making a “COPY” (i.e pass by value) of GB string is, in my opinion, overkill.

Best of luck


Walid Magd
 
For some odd reason I was offered a job there, despite not answering about 1/3 of the questions correctly. I decided not to take the job because I feel I need to know more in order to become a C# programmer.

I think they probably found someone better for the job and I am going to hit the books every day and night until I get to the point where I know something.

 
hitting the books" can only get you so far, and so fast.

On the job expirience is the best learning environment for a programmer. I learned more in my first 2 months at a programming job than I did in 2 years of college programming courses
 
I agree with NeiTrain. It's good to know a string is mutable object. It's even beter knowing why you learned that.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
I think what I'm going to do is finish a couple of these thousand page programming books on my shelf on C#, create some applications on my own, then think about trying to get a job in the C# arena.

The job interview revealed that I have a lot left to learn.

 
We all have a lot to learn (even chiph (I think?)).

The books can teach you only so much.

Try writing something for a couple of users and you will soon find out that they are capable of breaking any kind of code.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top