pkreyenhop / Fib-and-Animals

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Interview101

Practical Interview with two Exercises

  1.   Create test project JavaTest1
    

a. Choose where to create test Project first (IDE, VC, Build System)

b. Create project with skeleton for command line executable with unit tests and log4j library.

c. Build the empty project from IDE

d. Build the empty project from command line

  1.   Create function to calculate Fibonacci sequence: 
    

fib(0) = 0

fib(1) = 1

fib(n) = fib(n-1)+fib(n-2)

E.g.: fib(2)=fib(1)+fib(0)=1, fib(3)=fib(2)+fib(1)=2, …

  1. start a with dummy function and add unit tests according to the spec

  2. elaborate the function to make the tests pass

  3. Check your project into version control

  4. refactor the function name to “fibonacci” and tidy the code up

  5. Commit your changes and show diff

  6. Build and test the solution with you build system

  7. describe the complexity of your solution – would it work for a large n?

  1. Create a class animals in new project JavaTest2

a) add a property for age to animals

b) Make dogs a subclass of animals with property colour.

c) Encapsulate the properties and create/generate getter and setter methods

d) generate unit tests

e) add a function to animals that tests for isBaby (age < 1 year).

f) override the isBaby function for dog with a test for age < 2 years

g) create a list of dogs

h) filter list for puppies

About


Languages

Language:Java 100.0%