Need some ideas for a few small C# tests

Funnily enough, I implemented a parser, a tree and a stack just last week. Somewhat specialized implementations, of course, but it isn’t often that I get quite that close to archetypal undergraduate CS.

Thats my point, I think I last touched stacks was with javame code about 9 years ago? And maybe another decade or so prior to that when I was doing c++ at one stage.

Been brushing up though on trees as they seem to be used extensively in AI/Machine learning structures but again that would be python based I think.
 
Not a huge fan of tests but some very good suggestions here aka Hamster and others. I notice a few folks talk about stack and heaps, I honestly can't recall the last time I had to manipulate code on that level with c#, Java yes and older mobile code but c# is heavily object geared and a lot of the modern features obfuscate low level code more and more.

The one thing I would also look for is not just the ability to code a problem but the ability of correctly defining and solving it. If you are in a perfect world with perfect specs, easy to code but most are not so that ambiguity should be thrown at them too.

It depends on what you do with it, and yes I'd agree that your interview questions should be tailored to what your work load is. Most of the work I did in South Africa was fairly basic C#, REST API stuff, the complication was actually in managing the sheer number of versioned moving parts. But the actual code was not complicated. That did make it a great lesson in modularity though.

I wrote a custom data structure or two while working on my own game in South Africa, but otherwise, whatever the standard libraries provided was fine. That being said, you ought to know when to use a list and when to use an array.

In my current job, its important to know the more computer sciencey stuff so I can see why we test for it.
 
It depends on what you do with it, and yes I'd agree that your interview questions should be tailored to what your work load is. Most of the work I did in South Africa was fairly basic C#, REST API stuff, the complication was actually in managing the sheer number of versioned moving parts. But the actual code was not complicated. That did make it a great lesson in modularity though.

I wrote a custom data structure or two while working on my own game in South Africa, but otherwise, whatever the standard libraries provided was fine. That being said, you ought to know when to use a list and when to use an array.

In my current job, its important to know the more computer sciencey stuff so I can see why we test for it.

Lists and arrays sure, those are bread an butter to most developers, custom data structures are pretty much the norm with generics but I would test maybe more on reflection, polymorphism etc but yes, its very job/work load dependent. My personal focus has been far more on the business logic side of the equation than pure code for many years but I think even most developers are not diving as deep anymore.
 
Lists and arrays sure, those are bread an butter to most developers, custom data structures are pretty much the norm with generics but I would test maybe more on reflection, polymorphism etc but yes, its very job/work load dependent. My personal focus has been far more on the business logic side of the equation than pure code for many years but I think even most developers are not diving as deep anymore.

No, they generally don't. Not in South Africa certainly, and even in the UK or USA, I would think that the people who need deep programming knowledge are rare. Most companies want far more basic systems.

Well, you don't really need custom data structures with generic. List<Person> is not a custom data structure, unless you wrote the list class yourself.

Reflection? Would you test on that? I can never remember how to to reflection in either Kotlin or C#. I just Google it and find a way that works. You should seldom need reflection in any case - I'd probably rather ask about the pitfalls of reflection and when it is a good idea to use it.
 
Thats my point, I think I last touched stacks was with javame code about 9 years ago? And maybe another decade or so prior to that when I was doing c++ at one stage.

Been brushing up though on trees as they seem to be used extensively in AI/Machine learning structures but again that would be python based I think.

Oh, I still do algorithms and data structures in very much a daily basis, just not usually something as simple/canonical as stacks, trees, etc.

The AI/ML decision trees algorithms are somewhat different. Still trees of course, but usually with fixed structure, and the algorithms aren’t so much about trees as a container, so much as figuring out what the branch criteria in the data set is, and what expectation (value, gradient, etc.) to store in the leaf nodes (in order to make predictions).

We use C/C++ exclusively for our ML, for performance reasons. If your data is small, or if you’re new to it, as you say, Python is the best bet.
 
Last edited:
No, they generally don't. Not in South Africa certainly, and even in the UK or USA, I would think that the people who need deep programming knowledge are rare. Most companies want far more basic systems.

Well, you don't really need custom data structures with generic. List<Person> is not a custom data structure, unless you wrote the list class yourself.

Reflection? Would you test on that? I can never remember how to to reflection in either Kotlin or C#. I just Google it and find a way that works. You should seldom need reflection in any case - I'd probably rather ask about the pitfalls of reflection and when it is a good idea to use it.

Hmm maybe not test but certainly quiz the knowledge. Like I said, I'm not a fan of actual tests within a timeframe as that feels very non-working world to me and a lot of development is experimenting with your own code to make a solution work and if you don't know/recall how, finding the knowledge and correctly implementing it in getting it to work.

Even better is giving the poor a sod a one line spec and say , right, where do you go from here :P
 
As an alternative to testing whether the candidate can write code in c# why not test the ability to problem solve. One of the basic tests we do is give candidates a 5x5 grid and fill it with numbers, usually something like this:

5 | 5 | 5 | 5 | 5
4 | 5 | 5 | 5 | 5
3 | 4 | 5 | 5 | 5
2 | 3 | 4 | 5 | 5
1 | 2 | 3 | 4 | 5

Then ask them to write a simple script (in pseudo code) to print that. You get a fairly good idea of the person's capabilities by the approach they use and you can see if they can actually solve problems.
 
I agree on the sentiment that the test needs to reflect the workload.

Personally I would like to see if the candidate understands patterns, mocking, how to write loosely coupled, extensible and testable code. This has a direct impact on code quality. A test that I have used in the past was as follows:


Lets say we have a given order object and we need to write an Order Shipping function. We can decide whether this function needs to do anything or not. This is where the candidate usually goes procedural or OO, which is an indicator.

Then I tell the candidate that the requirement has changed and the system must send an email to some email address once the order has shipped successfully. His implementation can now be one of many. Either he changes the existing code, uses inheritance or composition and applies a design pattern. His implementation is quite a big indicator. The details of sending the email is not important. How he extends the function is.

Next I tell the candidate that the requirement has changed again and that the function needs to send an SMS when the order amount is more than a certain amount. Again, I want to see what route he takes. If he used inheritance, he will paint himself into a corner quite quickly because the email requirement will be removed next. The total code for this test is literally a few lines. I have never had a candidate implement it in a remotely satisfactory way. Pretty disappointing actually. The next step of the test is where I show them on a white board how I would implement it. During this part I explain the downsides of his implementation and why the new way is better. This is part of the test where I see whether the candidate can easily grasp concepts and run with it. Some candidates have a-ha moments and get it, others not. It also tests the interaction with the candidate and his reaction to new ideas.

This test tells me:
- how they deal with the real world where requirements change and if they think ahead
- how they architect a solution and if they architect it for testability and extensibility
- naming conventions of classes and methods
- how thy handle failure scenarios
- if they grasp concepts
- how they react to new ideas that are not their own

This test can easily be done in an hour.
 
We use testdome for our recruitment tests as a pre-interview screening mechanism. They can write the tests from home, and they don't waste 2 or 3 people's time during the interview if they can't pass the tests.

Based on the tests I've seen in this thread, and the quality of candidates I've seen recently... good luck :ROFL:
 
I will test for 3 things.
Basic Fundamental(Reading from a file, Using Arrays and Sorting)
Using libraries.
Using RestAPI.



A few years back, we made a test. I had to hire 1 person for my team. The company required people to write a test online, about 15 application was received. We had to narrow it to 5 for an interview. I requested 8 people to write the second test + interview.

I provided a simple problem and a link to libraries + full detail documentation(Logging, Error Handling, Graphic, lastly database[nosql] and RestClient).
Also Gave them a swagger api link.
The test had a target of 1 hour, the number of lines of code required was only 30 lines.
We got 2 employees that ace the test in 30 minutes, the rest never even made it halfway.

The problem was simple:
1. A file consist of employees, it contains duplicate information. Access the api to get the latest information and keep the employee id that has the latest information.
2. Write the information to sql.lite database. [Employee, Employee_Address].
3. Display the information in grid format as shown in the pictures provided. You can use any display choice method you prefer, as long as the information shows.


Solution
1. Add the libraries using Nuget. Most just copied the dll's over.
2. Read all the content of the file and store it in a List/Array.
3. Search for duplicates.
4. Call the API with employee Id to get the information. The 2 employees, one use latest graphql api call and the other the array function(pagination). I provided 8 different ones.
5. Call Library Save Employee function
6. Create a WPF/WinForm or MVC Web Form, Add UC control or MVC component and past an array/list to display the list.

The only code was reading from a file and searching duplicates. The rest was reading 2 pages of information and just calling api's.

Only 2 of the 8 was able to past the test, all senior guys. Both got hired. Both never end up my team. Both ended up after 2 years emigrating. Both were legends.


This is a great test. Where I highlighted I think is really the core of what a test should be.
 
As always, to the smart guys, this is South Africa. 99% of the work here don't require you to solve the bracket problem or even care about O notation. Nevermind the hard stuff.

If you can create a table, create a REST API and consume it using Angular and a flexbox fronted, CONGRATS! You have a job.
I'm busy getting my WordPress themes on the WordPress website, can I get a job?

To be honest, I would just have a nice general programming chat with the candidate. If he is already familiar with programming jargon to the point where he can impress me with his insights/knowledge, then he is halfway to employment already.

Let's be honest the vast majority of candidates are still going to need a fair bit of hand-holding / mentoring to get them to be the employees you want them to be. All I want is a candidate that knows enough so as teaching him / her does not make me hate myself.
 
Top
Sign up to the MyBroadband newsletter
X