Programming questions are an integral part of an interview for the developers position. No matter which programming language you master, familiarity with fundamental concepts of programming is something that is always expected from you.
Coding skills are always the deciding factor in any programming interview. In this coding interview questions article, we will discuss the top 40 Coding Interview Questions you should absolutely know to crack those interviews and get your dream job.
The coding interview questions addresses in this article are grouped into 2 categories (as below) to make your learning simpler.
Question: What is abstraction and abstract class in Java?
Abstraction is a process of hiding the implementation details and showing only functionality to the user.
Another way, it shows only important things to the user and hides the internal details for example sending sms, you just type the text and send the message. You dont know the internal processing about the message delivery.
Abstraction lets you focus on what the object does instead of how it does it.
There are two ways to achieve abstraction in java
Abstract class (0 to 100%) Interface (100%)
Abstract class in Java:
A class that is declared as abstract is known as abstract class. It needs to be extended and its method implemented. It cannot be instantiated.
A method that is declared as abstract and does not have implementation is known as abstract method. Example abstract method
Question: Can you create instance of abstract class?
No, you can not create instance of abstract class in Java, they are incomplete.
Even though, if your abstract class don’t contain any abstract method, you can not create instance of it.
By making a class abstract, you told compiler that, it’s incomplete and should not be instantiated. Java compiler will throw error, when a code tries to instantiate abstract class.
2 How do you reverse a string in Java?
2 How to find out if the given two strings are anagrams or not?
Two strings are anagrams if they contain a similar group of characters in a varied sequence.
Â Â Â Â System.out.println(str + ” and ” + reverse + ” not anagrams string”);
Â Â Â Â char anagram1 = str.toCharArray();
Â Â Â Â char anagram2 = reverse.toCharArray();
Â Â Â Â anagrmstat = Arrays.equals(anagram1, anagram2);
Â Â Â Â System.out.println(” anagrams string”);
Â Â Â Â System.out.println(” not anagrams string”);
1 Which sorting algorithm is the best?
1 What are the concepts introduced in OOPs?
Following are the concepts introduced in OOPs:
This is one of the very common coding interview questions, that often allows the interviewer to branch out into related topics based on the candidateâs answers