Skip to content

Miscellaneous JAVA tests and trials, including lifedays, decathlon calculations, dining philosophers simulation and other interview questions

Notifications You must be signed in to change notification settings

scienceMiner/seatrials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 

Repository files navigation

seatrials

Contains some useful JAVA utilities. Including:

  1. LifeDays - calculate the number of days someone has been alive for.
  2. Decathlon - for anyone interested in how decathlon results are mapped into points... trust me, its reasonably interesting

Also this repo contains some (mildly) useful JAVA interview questions which I've often asked (no guarantees!). Including:

  1. Reversing a line of input - if you type in an input line how would you display this line reversed leads on to a discussion of arrays/lists, how arrays might be represented internally, efficiency for reversal etc.
  2. FizzBuzz - A classic newbie java question - @ Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number itself and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
  3. Powerset - Generate the set of all sets for a given input set - obviously this is a nice intro to recursion, unfortunately its not PROLOG...
  4. Monte Carlo PI simulation - You can simulate random (x, y) points in a 2-D plane with domain as a square of side 1 unit. Imagine a 90 degree quarter circle inside the same domain with the same radius inscribed into the square. We then calculate the ratio of number points that lie inside the quarter circle and total number of generated points multiplying by 4. A common interview puzzler which seeks to determine understanding of basic monte carlo simulation principles.
  5. Dining Philosophers simulation - Multi-threaded option to recreate the dining philosophers problem. This often leads onto concurrency discussion including resource allocation issues.

About

Miscellaneous JAVA tests and trials, including lifedays, decathlon calculations, dining philosophers simulation and other interview questions

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages