[ACCEPTED]-OOP Problems to use for Coding Tests during interviews-oop

Accepted answer
Score: 17

This is a problem that I use with some trainings, looks 8 simple but is tricky OOP-wise:

Create model 7 classes that will properly represent the 6 following constructs:

  1. Define a Shape object, where the object is any two dimensional figure, and has the following characteristics: a name, a perimeter, and a surface area.
  2. Define a Circle, retaining and accurately outputting the values of the aforementioned characteristics of a Shape.
  3. Define a Triangle. This time, the name of the triangle should take into account if it is equilateral (all 3 sides are the same length), isoceles (only 2 sides are the same length), or scalene (no 2 sides are the same).

You can go on and on 5 with quadrelaterals (which include squares, rectangles, rhombi, etc) and 4 other polygons.

The way that they would solve 3 the above problems would reveal the people 2 who understand OOP apart from those who 1 don't.

Score: 6

ideally, you want to present a problem that 10 appears difficult, but has a simple, elegant, obvious 9 solution if you think in OO terms


  • we need to control access to a customer web site
  • each customer may have one or more people to access the site
  • different people from different customers may be able to view different parts of the site
  • the same person may work for more than one customer
  • customers want to manage permissions based on the person, department, team, or project

design a solution for this 8 using object-oriented techniques

one OO solution 7 is to have a Person, a Customer, an Account, and 6 AccountPermissions, where the Account specifies 5 a Person and a Customer and an optional 4 Parent Account. the use of a recursive Account 3 object collapses the otherwise cumbersome 2 person/team/department/project structure 1 a direct ERD solution might yield

Score: 3

I have used the FizzBuzz Programming Test. And shockingly can corroborate 8 the claims made by the article. As a second 7 follow up I have asked candidates to compute 6 the angle(s) between the hands on an analog 5 clock. We set up a laptop with VS 2008 installed 4 and the stub in place. all they have to 3 do is fill in the implementation.

I am always 2 stunned at how poorly candidates do on these 1 two questions. I really am.

Score: 2

Designing Social Security Application is 7 something which I ask a lot of people during 6 interviews.

The nice thing about this is 5 everyone is aware of how it works and what 4 things to keep track of. They also have 3 to justify their design and this really 2 helps me get inside their head :) (As there 1 is lots of flexibility here)

Kind regards,

Score: 1

Whether or not people do some coding in 6 the interview, I make it a point to ask 5 this: Tell me about a problem you solved recently using object oriented programming. You'd be surprised how often people 4 cannot answer that simple question. A lot 3 of times I get a blank stare, or they say 2 something like "what do you mean? I program 1 in .NET, which is all object oriented."

Score: 0

These aren't specifically OO Questions, but 6 check out the other questions tagged interview-questions

Edit: What 5 about implementing some design patterns? I don't have the 4 best knowledge in the area but it seems 3 as if you would be getting two questions 2 for the price of one. You can test for both 1 OO and Design pattens in the one question.

Score: 0

How about some sort of simple GUI. It's 5 got inheritance, overriding, possibly events. If 4 you mean for them to actually implement 3 as part of the test then you could hand 2 them a blank windows-form with an OnPaint() and 1 tell them to get to it.

Score: 0

You could do worse than ask them to design 11 a MapReduce library with a single-process 10 implementation. Will the interface still 9 work for a distributed implementation? What's 8 the exception-handling policy? Should there 7 be special support for chaining MapReduce 6 jobs in a pipeline? What's the interface 5 to the inputs and outputs? How are inputs 4 chunked up? Can different inputs in one 3 job go to different mappers? What defaults 2 are reasonable?

A good solution in Python 1 takes about a page of code.

More Related questions