Need some ideas for a few small C# tests

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
28,052
Reaction score
17,805
I have an assignment and it seems fun but actually thinking up ideas is not that fun!

I have to put together a small test for my boss, I think he is using it as part of their recruitment portfolio.

The test must take no more than an hour. It must be a C# console app with no SQL or database programming. Algorithms are ok but a lot of these generic online tests, puzzles etc can be easily googled and solved though so he rather wants something that is a real world scenario (classes, lists, linq, inheritance, writing to or reading from text documents) anything of that sort.

Please throw some quick ideas at me so I can spend some time thinking about what to come up with. Even just a short one liner.

Much appreciated guys.
 
Last edited:
Load a maze from a text file (containing an image of the maze using “text art”), and output a similar maze file, but with the solution (path from entrance character to exit character) filled in.
 
Load a maze from a text file (containing an image of the maze using “text art”), and output a similar maze file, but with the solution (path from entrance character to exit character) filled in.

That's a good one yeah!
 
If it's for recruitment, make them consume an API you guys setup for the test.

They'll need to add the correct http auth headers, list results from a GET, view details of a specific item and maybe update/add an item. Take a student database:

GET /students
GET /students/{id}
POST /students/
PUT /students
DELETE /students/{id}

Tell to go as far as they can but at minimum they need to consume the two GETS and the PUT or something and to treat it as if it's going into production.

1. It'll give you an idea if they have basic understanding of real world problems

2. You'll get an idea of the quality of code you'll get from them: naming conventions, structure, where they keep settings, do they commit stuff they shouldn't.

3. Since they'll never implement all of it in an hour, you'll see who is willing to go the extra mile.

But that's just me. Hackerrank and algos are bullshit.
 
One option which I like is to write a C# file yourself, but make a lot of mistakes. Name interfaces badly, name classes badly (ie CustomerCustomerDatabase<Customer>), put logic inside the constructor, don't handle exceptions, don't log anything, make logical errors inside loops, etc etc.

This doesn't test problem solving skills, but it does test programming knowledge quite effectively. The more senior the programmer, the more problems he is likely to spot and the better his suggestions will be. You can add some concurrency stuff in there too.

This should take no more than an hour, and it also isn't high pressure - which may be a good thing or a bad thing from your point of view.
 
If it's for recruitment, make them consume an API you guys setup for the test.

They'll need to add the correct http auth headers, list results from a GET, view details of a specific item and maybe update/add an item. Take a student database:

GET /students
GET /students/{id}
POST /students/
PUT /students
DELETE /students/{id}

Tell to go as far as they can but at minimum they need to consume the two GETS and the PUT or something and to treat it as if it's going into production.

1. It'll give you an idea if they have basic understanding of real world problems

2. You'll get an idea of the quality of code you'll get from them: naming conventions, structure, where they keep settings, do they commit stuff they shouldn't.

3. Since they'll never implement all of it in an hour, you'll see who is willing to go the extra mile.

But that's just me. Hackerrank and algos are bullshit.

Can't agree more. You don't get more real world problem than this.
 
If it's for recruitment, make them consume an API you guys setup for the test.

They'll need to add the correct http auth headers, list results from a GET, view details of a specific item and maybe update/add an item. Take a student database:

GET /students
GET /students/{id}
POST /students/
PUT /students
DELETE /students/{id}

Tell to go as far as they can but at minimum they need to consume the two GETS and the PUT or something and to treat it as if it's going into production.

1. It'll give you an idea if they have basic understanding of real world problems

2. You'll get an idea of the quality of code you'll get from them: naming conventions, structure, where they keep settings, do they commit stuff they shouldn't.

3. Since they'll never implement all of it in an hour, you'll see who is willing to go the extra mile.

But that's just me. Hackerrank and algos are bullshit.

I agree and disagree.. it depends on what the job entails.

So eg if the job requires a lot of bespoke code customization and bug fixing, then doing the above with semi-realistic inputs (simplified domain) you normally work with is more ideal. (Pending how/where u do this.. requires offline or ideally onsite).

If on the other hand the job generally requires more algorithmic optimizations or considerations (more than a side thought), then perhaps the usual complex data sort or graph like questions are ideal. (Online or Live online)

If it’s merely a check to see if the guy can code, a targeted approach is better. Here you can either give samples that test understanding of what happens in memory or output along with your silly fizz buzz, word reversal stuff which is trivial yet will knockout those that really can’t code. (Almost always completely online/hackerrank like stuff)
 
On ^^^, we generally require that someone shows excellent algorithm skills, since it tells us that they’re smart. This still doesn’t tell us whether or not they’re likely to write decent production code, or if they would be good to work with.

To remedy the above, the in-person interview is largely geared towards seeing how clearly the candidate can communicate their ideas, how structured they are when approaching the problem, how quickly they internalize new concepts, and how they interact with the interviewer in a stressful situation. This tends to be a good indicator of their code quality and how well they will work with the team.

We’ve had a few people try out the “real world” problem approach, and haven’t found it to be particularly good. Primarily, because real world problems tend to be a lot more ambiguous, in terms of both specification, the objective assumed and the result achieved (just like the real world). This makes it hard to calibrate against other candidates. Secondly (and this is somewhat specific to the industries I’ve worked in), the vast majority of real problems, aren’t really understandable, unless one has had experience in the specific industry, so this tends to select for people with experience, but who are potentially worse long term candidates.
 
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.
 
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.
Please make them write tests too, would help with when the company has testers employed
 
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.

That is something you immediately notice about interviewing in South Africa compared to interviewing in the UK.

South Africa: Write a for loop
UK: Write your own stack data structure class that provides constant time access to the item with the highest value in the stack, which works even after things are removed from the stack
 
IBM research has a good collection of challenges / solutions:
 
That is something you immediately notice about interviewing in South Africa compared to interviewing in the UK.

South Africa: Write a for loop
UK: Write your own stack data structure class that provides constant time access to the item with the highest value in the stack, which works even after things are removed from the stack
Max-heap.... :cool:
 
Max-heap.... :cool:

To get the stack property, I would have a maxheap of indices partially sorted (i.e., heap property) by the value they index in an associated array. The indices point to offsets in an associated array stack, and pushing onto the array would propagate the index through the binary heap (O(log n)), and popping would remove the index from the binary heap (O(log n)). Index 0 of the binary heap would have the max value available in time O(1). This uses O(N) additional storage - so I will think about if one can do better, but I suspect not.
 
To get the stack property, I would have a maxheap of indices partially sorted (i.e., heap property) by the value they index in an associated array. The indices point to offsets in an associated array stack, and pushing onto the array would propagate the index through the binary heap (O(log n)), and popping would remove the index from the binary heap (O(log n)). Index 0 of the binary heap would have the max value available in time O(1). This uses O(N) additional storage - so I will think about if one can do better, but I suspect not.
Similar outcome as a red-black tree, or a min-max kd-tree
 
Last edited:
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.
 
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.
 
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.

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.
 
Top
Sign up to the MyBroadband newsletter
X