Created
December 12, 2015 13:48
-
-
Save GingerGeek/0516424dfa2b5f5cfc4a to your computer and use it in GitHub Desktop.
These are the two tasks which dev candidates had to do live whilst I watched for the interview. The first one is a test of algorithmic skillz where the second is about seeing if you can adapt to new APIs by reading docs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.cubecraft.devtask.donglerounding; | |
public class Main { | |
/* | |
Welcome to Dongle Rounding! | |
SHOW OF YOUR KNOWLEDGE OF TESTING. USING A TESTING FRAMEWORK OF YOUR CHOICE, WRITE A TEST CLASS FOR THIS | |
You will be given a double, in the method double dongleRound(double roundMe); | |
To perform a DongleRounding you start from the end and round it each number from the end until there are no more decimal places. | |
For example: | |
3.4449 -> 3.445 -> 3.45 -> 3.5 -> 4 | |
11.45 -> 11.5 -> 12 (NOT 10) | |
10.3349 -> 10.335 -> 10.34 -> 10.3 -> 10 | |
EXTRA TASK: Rewrite dongle rounding so whenever there is a 5 there is a random chance of it rounding up or down | |
*/ | |
private static double dongleRound(double roundMe) { | |
return 0.0; | |
} | |
public static void main(String[] args){ | |
p("*** CUBECRAFT DEVELOPER ASSESMENT ***"); | |
p("TASK ONE: DONGLE ROUNDING"); | |
p(3.4449 + " -> " + dongleRound(3.4449)); //4.0 | |
p(3.649 + " -> " + dongleRound(3.649)); //4.0 | |
p(11.45 + " -> " + dongleRound(11.45)); //12.0 | |
p(12394.44445 + " -> "+ dongleRound(12394.4445)); //12395 | |
p(10.2349 + " -> " + dongleRound(10.2349)); //10.0 | |
p(10.9994 + " -> " + dongleRound(10.9994));//11.0 | |
p(45 + "->" + dongleRound(45)); //45.0 | |
} | |
private static <T> void p(T p){ | |
System.out.println(p); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.cubecraft.devtask.insultingcat; | |
import java.io.IOException; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Main { | |
/* | |
This is a test of working with an API you hopefully haven't used before. | |
IT IS EXPECTED YOU USE WHAT I CALL THE "INTERNET" | |
Use Spark to create a web server, I need you to create three routes. | |
It should run on port 1337 | |
localhost:1337/cat.jpg returns the JPEG image of the cat picture found in cat_picture_url | |
/insult returns a random plain text insult from the insults list | |
/pretty returns in html: | |
- A random insult in a <h1> tag | |
- An <img> tag showing the cat from cat.jpg <img src | |
*/ | |
public static void main(String[] args) throws IOException { | |
} | |
private static String cat_picture_url = "CHANGE ME"; // I used this image http://imgur.com/RIFzgZc | |
private static List<String> insults = new ArrayList<>(); | |
static { | |
insults.add("You look ugly"); | |
insults.add("The recursive function calculating your mass caused a stack overflow"); | |
insults.add("This is an insult"); | |
insults.add("Also an insult"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment