Looking for c# technical interview questions

B

bill

Anyone see any articles or websites that have some prewritten c# technical
interview questions?

I did find this one: http://www.techinterviews.com/index.php?p=54. But I'm
looking for more.

I like some of the questions in the above link but many are just useless
trivia. I want someone who can think, not memorize the manuals.

I'd rather have someone explain why you should separate business logic from
DAO and interface rather than how many bytes a char uses or what the
allowable signatures for Main() are. But I am curious as to what other
people are thinking interview wise.

Thanks
-Bill
 
M

Mortos

As you say, you are looking for a thinker and not someone who just knows
the syntax. So you have no need for "C# interview questions". Besides
you seem to have a fairly good idea of who you're looking for. You don't
seem to need the questions at all. ;-)
Just my 2 pence.
 
B

bill

Come one. Of course there's a need for some detailed hard technical
questions... If you list it as a skill on your resume you better be
prepared to be hammered at least a little.

But some questions are important while others are just trivia. Look through
the list of questions on that link I sent. There're clearly some questions
that are very good and some that blow. I'm just looking for more good ones.
 
C

clintonG

If you can't think of the correct questions yourself you obviously do not
even meet your own requirements and lack the qualifications to do
your job. So let everybody know at work you intend to fire yourself.

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET (e-mail address removed)
URL http://www.metromilwaukee.com/clintongallagher/
 
J

Jon Skeet [C# MVP]

bill said:
Anyone see any articles or websites that have some prewritten c# technical
interview questions?

I did find this one: http://www.techinterviews.com/index.php?p=54. But I'm
looking for more.

I like some of the questions in the above link but many are just useless
trivia. I want someone who can think, not memorize the manuals.

There are also loads of mistakes:

4) Main doesn't have to be public.

7) Suggests a basic failure to understand the difference between "pass
a reference by value" and "pass a value by reference", and the same
failure as shown in 11.

11) and 12) are incorrect - see
http://www.pobox.com/~skeet/csharp/memory.html

14) Neglects the possibility of using Convert.ToInt32 instead.

15) Has dodgy terminology - you don't assign anything "to the object".
It also neglects the possibility of just casting to object.

16) See 7 - and you don't need to be passing it, necessarily.

19) This ignores the reasons why finalizers *are* implemented in
classes which contain unmanaged resources - namely for late cleanup if
Dispose hasn't been called.

20) Package declarations also have to be the first thing within the
file, can't be nested, and affect all classes within the file.

21) Incomplete answer - only types which can be the types of constant
expressions are suitable for variables declared as const, and the value
has to be a constant expression too.

22) What kind of question is that?

24) What's different compared to what other language?

27) This doesn't explain *when* the IL->native compilation is
performed.

29) Duplicate of 27.


14 dodgy questions out of 31 - hardly encouraging, is it? What's even
worse, the feedback on the page is mostly positive :(
I'd rather have someone explain why you should separate business logic from
DAO and interface rather than how many bytes a char uses or what the
allowable signatures for Main() are. But I am curious as to what other
people are thinking interview wise.

It sounds like you're not really after C# questions as such then - more
..NET and general software design principles.
 
J

Jon Skeet [C# MVP]

bill said:
I'd rather have someone explain why you should separate business logic from
DAO and interface rather than how many bytes a char uses or what the
allowable signatures for Main() are. But I am curious as to what other
people are thinking interview wise.

One interview question I've used before is fairly open-ended in terms
of approaches, but shows some problem-solving ability:

You have an image, in a raw format of 24 bit colour values (no
transparency). You wish to reduce the image to a given number of
colours. How would you approach doing this? What trade-offs in
cost/quality can be made? What extra information about the image could
help you beforehand?
 
S

Sami Vaaraniemi

In my experience it is best to have the candidate write code on a whiteboard
if you want to make sure he/she can actually write code. Trivia questions
such as the ones in the link do not give a good not indication of one's
capabilities.

In addition to having a candidate write code, here's one question I always
ask. What's wrong with the code snippet below?

SqlConnection myConnection = new SqlConnection("<connection string>");
SqlCommand myCommand = new SqlCommand("ap_DoSomething", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;

// Add Parameters to SPROC
SqlParameter parameterItemID = new SqlParameter("@ItemID", SqlDbType.Int,
4);
parameterItemID.Value = 1;
myCommand.Parameters.Add(parameterItemID);

// Open the database connection and execute SQL Command
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();

If the candidate cannot find anything wrong with this, I'm not likely to
recommend hiring him/her.

Sami
www.capehill.net
 
M

Mortos

Nah. What I meant is that there is a difference between knowing the
syntax as opposed to coding solutions. It's like hiring someone 'cos
they've passed the MS certification exam. It means nothing.
Come one. Of course there's a need for some detailed hard technical
questions... If you list it as a skill on your resume you better be
prepared to be hammered at least a little.

But some questions are important while others are just trivia. Look through
the list of questions on that link I sent. There're clearly some questions
that are very good and some that blow. I'm just looking for more good ones.
{Snip}
 
E

Ed Courtenay

I'd also add that the answers given to questions 20 and 31 are just
laughable.

26) The target for a goto must be in the same or an enclosing scope of the
goto statement.
 
D

Doknjas

I've conducted a few interviews and these are some of the technical
questions I've asked:

- How would you copy an object, with and without serialization?

- What is the consequence of passing an object by reference?

- What's the difference between an abstract base class and an
interface? When would you use one over the other?

- What are the differences between a struct and a class?

- Why is it not a good idea to depend on catching exceptions as part
of an app's normal logical flow?

- What is the "static class initialization problem"?
 
S

Stu Smith

We set two little exercises.

The first is a small component class and test harness, which crashes when
you run it. The task is to debug and fix it. It's the sort of problem where
there is no one right fix; there are various approaches depending on what
they think this component should do.

The second is to write a small application according to a brief
specification. Again, it's the sort of problem which allows one of several
implementations. We allow either C# or C++ there.

(Obviously I can't give too many details here).

We send this exercise out when we find a good CV, before the interview. We
estimate it takes around four hours' total work (a couple of evenings). If
the submission is good, we invite them for interview, and ask them about the
code they wrote (amongst other things). That's a good time to sneak in a
couple of techie/language lawyer questions.

It does involve more work on both our side and on theirs, but it does tend
to eliminate those people who are only good on paper, as it were.

Stu
 
J

Jon Skeet [C# MVP]

Stu Smith said:
We set two little exercises.

The first is a small component class and test harness, which crashes when
you run it. The task is to debug and fix it. It's the sort of problem where
there is no one right fix; there are various approaches depending on what
they think this component should do.

The second is to write a small application according to a brief
specification. Again, it's the sort of problem which allows one of several
implementations. We allow either C# or C++ there.

(Obviously I can't give too many details here).

I'm intrigued though - as I'm unlikely to apply for a job with you
(unless you happen to be in the Reading area of the UK), any chance you
could email the questions to me? I promise I won't divulge them on the
net...
 
C

C# Learner

Ed said:
I'd also add that the answers given to questions 20 and 31 are just
laughable.

26) The target for a goto must be in the same or an enclosing scope of the
goto statement.

The mind baffles at question 22:

"What does a character do? On most systems, produces a rather annoying
beep."

Perhaps he/she missed something in that sentence.
 
B

bill

I do agree with you. I like mostly to talk and find out if a candidate's
smart first of all, is a guy I'd want to work with second, and then see if
they have any passionate about something. I'm more interested if they can
learn and are motivated to do so. But a few hard questions just too keep
them honest is also good. Then I might just switch to asking what kind of
music they're into and if they play any instrument :).

The thing is I've been in the situation where I'm looking for contractors
instead of long term employees lately. And I just need to cut to the quick.
These guys need to get up and running ASAP so its a different kind of
interview for me which I'm not used to giving.

Some great responses in the thread. Thanks to all.
 
B

bill

Are you such a clueless dork that you can't play nice? A quick troll of
your website and I know I wouldn't have to waste any time interviewing you.
 
S

Stu Smith

I've sent an email, hopefully it reaches you...


Jon Skeet said:
I'm intrigued though - as I'm unlikely to apply for a job with you
(unless you happen to be in the Reading area of the UK), any chance you
could email the questions to me? I promise I won't divulge them on the
net...
 
M

mikeb

I'd like to join in...

13) A reference does not have to 'go null' to be garbage collected. It
has to be non-rooted (inaccessible). I think this distinction is
important, because of the common belief that setting references to null
helps the GC. It often doesn't (even if it doesn't hurt).

21) another difference between const and readonly is that const values
referenced by another assembly are baked into the referring assembly at
compile time. If the const value changes in the 'owning' assembly it
will not be picked up by the referring assembly until it is recompiled.

24) the case statement's controlling expression can be a string expression
 
B

Brad Williams

These are good. I'd ask about delegates and events, too, these are a
goldmine for finding out how in depth someone is with .NET, because there
are different levels of understanding.


Doknjas said:
I've conducted a few interviews and these are some of the technical
questions I've asked:

- How would you copy an object, with and without serialization?

- What is the consequence of passing an object by reference?

- What's the difference between an abstract base class and an
interface? When would you use one over the other?

- What are the differences between a struct and a class?

- Why is it not a good idea to depend on catching exceptions as part
of an app's normal logical flow?

- What is the "static class initialization problem"?
 
R

Ravichandran J.V.

Following is a sample question of mine. More can be obtained from me for
a few Euros only!!!

public class GenericMath {
public T Min<T>(T item1, T item2) {
if (item1 < item2) {
return item1;
}
return item2;
}
}


The above code will generate an error

invalid.cs(4,11): error CS0019: Operator '<' cannot be applied to
operands of type 'T' and 'T'

because

1. Type 'T' is not a .Net class
2. Type 'T' could expand to any CLR Type.
3. the above code will not pass the code verification test.
4. All the above.


Answer - (4).
------

The reason is that the less-than operator (<) in C# only works with
certain types. However, the type parameter T in the above code snippet
could expand to any CLR type at run time. Rather than risk having
invalid code at run time, the preceding example is found invalid at
compile time.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
A

Alex Moskalyuk

Jon, I accidentally came across this discussion. I run
http://techinterviews.com. I want the site to be the correct source of
information, and I appreciate corrections. I edited the page to
include your reply. The information is submitted from variety of
sources, and with topics ranging from FPGA to SQL topics it's
impossible for me alone to verify.

The comments on the page where off due to a glitch in the system, I
corrected it now. If you see any glaring mistakes, please leave a
comment, I get e-mailed each time you do that, and if there are
corrections, I usually implement them right away.

Also, if you have sets of interview questions you'd like to share with
the world, or just some questions you'd consider interesting, send
them over to webmaster at that site's domain name. The goal is to have
a large bank of questions, so that any interviewer can choose whatever
they like, and someone preparing for an interview can maximize their
readiness.

By the way, the mysterious question about the character was implying
backslash-a character, which in C#, when printed to Console, does not
actually produce a beep, so it was removed.

Alex
http://www.techinterviews.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top