Skip to content

Commit 01f3db4

Browse files
:octocat: adds license and readme file
1 parent f525086 commit 01f3db4

9 files changed

+125
-0
lines changed

Diff for: LICENSE

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright 2020 anishLearnsToCode
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
4+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
5+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
6+
persons to whom the Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
9+
Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
12+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
13+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
14+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Diff for: README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# HackerRank Java (Basic) Skill Certification Test
2+
3+
![HitCount](http://hits.dwyl.com/anishLearnsToCode/hackerrank-python-basic-skill-test.svg)
4+
![made-with-java](https://img.shields.io/badge/Made%20with-Java-1f425f.svg)
5+
![problems-solved](https://img.shields.io/badge/Problems%20Solved-6/6-1abc9c.svg)
6+
[![license](https://img.shields.io/badge/LICENSE-MIT-<COLOR>.svg)](LICENSE)
7+
[![hackerrank-python](https://img.shields.io/badge/hackerrank%20certification-python-1f72ff.svg)](https://github.com/anishLearnsToCode/hackerrank-python-basic-skill-test)
8+
9+
Took this test on HackerRank [here](https://www.hackerrank.com/skills-verification)
10+
on __14th July 2020__.
11+
Certificate can be viewed [here](https://www.hackerrank.com/certificates/e7bb326e632c)
12+
13+
## Programs
14+
- [How Will You Compare?](src/HowWillYouCompare.java)
15+
- [The Adder Class](src/TheAdderClass.java)
16+
- [Map Interface Question (MCQ)](map-interface-question.md)
17+
- [Bit Puzzle (MCQ)](bit-puzzle.md)
18+
- [Threads Question (MCQ)](test-thread.md)
19+
- _I have forgotten the 6th question 😋_ (so good luck with that)

Diff for: bit-puzzle.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# BitPUzzle Question
2+
3+
__Answer:__ 2

Diff for: map-interface-question.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Map Interface Question
2+
3+
__Answer:__
4+
The following classes implement the Map Interface:
5+
- HashMap
6+
- HashTable
7+
- TreeMap
8+
- ConcurrentHashMap
9+
- LinkedHashMap

Diff for: src/BitPuzzle.java

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class BitPuzzle {
2+
public static void main(String[] args) {
3+
try {
4+
Float f = new Float("3.0");
5+
int x = f.intValue();
6+
byte b = f.byteValue();
7+
double d = f.doubleValue();
8+
System.out.println(x + b + d);
9+
} catch (NumberFormatException exception) {
10+
System.out.println("ahhhh");
11+
}
12+
}
13+
}

Diff for: src/HowWillYouCompare.java

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.Arrays;
2+
3+
public class HowWillYouCompare {
4+
private static class Comparator {
5+
public boolean compare(int a, int b) {
6+
return a == b;
7+
}
8+
9+
public boolean compare(String a, String b) {
10+
return a.equals(b);
11+
}
12+
13+
public boolean compare(int[] a, int[] b) {
14+
return Arrays.equals(a, b);
15+
}
16+
}
17+
}

Diff for: src/TestThread.java

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
class SampleDemo implements Runnable {
2+
private Thread t;
3+
private String threadName;
4+
5+
SampleDemo(String threadName) {
6+
this.threadName = threadName;
7+
}
8+
9+
@Override
10+
public void run() {
11+
while (true) {
12+
System.out.println(threadName);
13+
}
14+
}
15+
16+
public void start() {
17+
if (t == null) {
18+
t = new Thread(this, threadName);
19+
t.start();
20+
}
21+
}
22+
}
23+
24+
public class TestThread {
25+
public static void main(String[] args) {
26+
SampleDemo A = new SampleDemo("A");
27+
SampleDemo B = new SampleDemo("B");
28+
B.start();
29+
A.start();
30+
}
31+
}

Diff for: src/TheAdderClass.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
abstract class Calculator {
2+
abstract int add(int a, int b);
3+
}
4+
5+
class Adder extends Calculator {
6+
7+
@Override
8+
int add(int a, int b) {
9+
return a + b;
10+
}
11+
}
12+
13+
public class TheAdderClass {
14+
}
15+
16+

Diff for: test-thread.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TestThread Question (MCQ)
2+
3+
__Answer:__ No pattern can be determined

0 commit comments

Comments
 (0)