├── .gitignore ├── LICENSE ├── README.md ├── bit-puzzle.md ├── map-interface-question.md ├── src ├── BitPuzzle.java ├── HowWillYouCompare.java ├── TestThread.java └── TheAdderClass.java └── test-thread.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | out 3 | *.iml 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 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. 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HackerRank Java (Basic) Skill Certification Test 2 | 3 | ![made-with-java](https://img.shields.io/badge/Made%20with-Java-1f425f.svg) 4 | ![problems-solved](https://img.shields.io/badge/Problems%20Solved-6/6-1abc9c.svg) 5 | [![cp](https://img.shields.io/badge/also%20see-Competitve%20Programming-1f72ff.svg)](https://github.com/anishLearnsToCode/competitive-programming) 6 | [![cp](https://img.shields.io/badge/also%20see-Other%20Certifications-1f72ff.svg)](https://github.com/anishLearnsToCode/competitive-programming#certifications) 7 | 8 | 📺 [My YouTube Channel](https://www.youtube.com/channel/UC6zEtIjpypm8gADSdHMP5vg/featured) 9 | 10 | Took this test on HackerRank [here](https://www.hackerrank.com/skills-verification) 11 | on __14th July 2020__. 12 | Certificate can be viewed [here](https://www.hackerrank.com/certificates/e7bb326e632c) 13 | 14 | ## Programs 15 | - [How Will You Compare?](src/HowWillYouCompare.java) 16 | - [The Adder Class](src/TheAdderClass.java) 17 | - [Map Interface Question (MCQ)](map-interface-question.md) 18 | - [Bit Puzzle (MCQ)](bit-puzzle.md) 19 | - [Threads Question (MCQ)](test-thread.md) 20 | - _I have forgotten the 6th question 😋_ (so good luck with that) 21 | -------------------------------------------------------------------------------- /bit-puzzle.md: -------------------------------------------------------------------------------- 1 | # BitPUzzle Question 2 | 3 | __Answer:__ 2 -------------------------------------------------------------------------------- /map-interface-question.md: -------------------------------------------------------------------------------- 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 10 | -------------------------------------------------------------------------------- /src/BitPuzzle.java: -------------------------------------------------------------------------------- 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 | } 14 | -------------------------------------------------------------------------------- /src/HowWillYouCompare.java: -------------------------------------------------------------------------------- 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 | } 18 | -------------------------------------------------------------------------------- /src/TestThread.java: -------------------------------------------------------------------------------- 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 | } 32 | -------------------------------------------------------------------------------- /src/TheAdderClass.java: -------------------------------------------------------------------------------- 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 | 17 | -------------------------------------------------------------------------------- /test-thread.md: -------------------------------------------------------------------------------- 1 | # TestThread Question (MCQ) 2 | 3 | __Answer:__ No pattern can be determined 4 | --------------------------------------------------------------------------------