Interview Questions and Answers for 'Cla' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Cla' - 209 question(s) found - Order By Rating

next 30
 Q1. What is the different between collection and Stream Api ?Core Java
Ans. data under collection are actually stored in memory so that they can be retrieved when needed whereas data in streams are not stored and hence we need to construct it again when needed.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     collection classes  stream api  collection vs stream     Asked in 1 Companies


 Q2. How you debug and troubleshoot slowness with a REST call?Rest
 This question was recently asked at 'Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q3. When you build an angular application, what type of file it creates which we can deploy?Angular JS
 This question was recently asked at 'Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q4. What would you do if your rest services aren't responding fast enough ?Rest
 This question was recently asked at 'Symantec,Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 2 Companies


 Q5. What kind of deployable is created for the angular project ?Angular Js
 This question was recently asked at 'Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q6. What is life cycle of cloud deployment process ?Cloud Computing
 This question was recently asked at 'Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Google Cloud Platform (GCP)  Amazon Web Services (AWS)     Asked in 1 Companies


 Q7. What is JUnitRunner ?JUnit
 This question was recently asked at 'Barclays'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve          Asked in 1 Companies


 Q8. Difference between HashMap and Dictionary in Java ?Core Java
Ans. HashMap implements the Map interface while the Dictionary does not.

HashMap was introduced after HashTable and Dictionary.

Dictionary is currently obsolete in java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     hashmap  dictionary class


 Q9. difference between ArrayList and array ?Core Java
Ans. ArrayList is a variable length collection class whereas arrays are fixed length primitive structure.

We can use generics with arraylist but not with arrays.

We can store primitive data types within arrays but can't with ArrayList. In ArrayList that needs to be converted to Wrapper objects.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     arraylist  arrays  collection classes  collections      basic        frequent


 Q10. Why is String a class in Java ?Core Java
Ans. 1. Creating a class helps in specifying operations on the Strings like length , sub string , concatenation etc.

2. It acts as a Wrapper class for "Array of Characters" and hence facilitates it's usage in collections, assignment to null.

3. Immutability of String objects facilitates in reuse , security and caching.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     string class


 Q11. Does abstract class have public constructor? Core Java
Ans. Yes, an abstract class can have a constructor in Java.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class  public constructor     Asked in 1 Companies


 Q12. Difference between Base Class, Derived Class , Abstract Class and Concrete Class ?Core Java
Ans. Base Class is a relative term used to signify the Parent class in Parent - Child or Base - derived relationship.

Derived Class is a relative term used to signify the Child class in Parent - Child or Base - derived relationship.

Abstract Class is a class that is not allowed to be instantiated and hence can serve only a base class for it's usage.

Concrete Class is the class which is supposed to be instantiated and hence provide definition for all implementing interface methods and extending abstract methods.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     Base Class   Derived Class    Abstract Class   Concrete Class


 Q13. Can an abstract class be a derived class ?Core Java
Ans. Yes, an abstract class can extend another class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class


 Q14. What is the relationship between Base Class and Abstract Class ?Core Java
Ans. Abstract Class is a class that's only allowed to be a Base class for it's usage. It can never be instantiated on it's own.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     base class  abstract class      basic


 Q15. Differences between class not found exception and noclassdef found error ?Core Java
Ans. ClassNotFoundException is an exception that occurs when we try to load a class at run time using Class.forName() or loadClass() methods and mentioned classes are not found in the classpath.

NoClassDefFoundError is an error that occurs when a particular class is present at compile time, but was missing at run time.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     exception handling  ClassNotFoundException  NoClassDefFoundError     Asked in 1 Companies


 Q16. Why line 4 in this code gives error saying "Cannot be referenced from a static context" ?

public class OuterClass {

public static void main(String[] args){
InnerClass innerClass = new InnerClass();
}

class InnerClass {

}
}
Core Java
Ans. InnerClass is a non static inner class and hence can only be instantiated using instance of the outer class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     inner class


 Q17. What is TypeCasting ?Core Java
Ans. Assigning a value of one type to a variable of another type is known as Type Casting.

Example :

int x = 10;
byte y = (byte)x;

In Java, type casting is classified into two types, Widening Casting(Implicit) widening-type-conversion and Narrowing Casting (Explicitly done) narrowing-type-conversion.

Widening or Automatic type converion - Automatic Type casting take place when,the two types are compatible and the target type is larger than the source type

Example :

public class Test {
public static void main(String[] args) {
int i = 100;
long l = i; //no explicit type casting required
float f = l;//no explicit type casting required
System.out.println("Int value " i);
System.out.println("Long value " l);
System.out.println("Float value " f);
}
}

Narrowing or Explicit type conversion - When you are assigning a larger type value to a variable of smaller type, then you need to perform explicit type casting.

Example :

public class Test{
public static void main(String[] args) {
double d = 100.04;
long l = (long)d; //explicit type casting required
int i = (int)l;//explicit type casting required
System.out.println("Double value " d);
System.out.println("Long value " l);
System.out.println("Int value " i);
}
}

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     typecasting  type casting     Asked in 23 Companies


 Q18. Does Java generate .class file for interfaces ? Core Java
Ans. Yes

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     .class file  java byte code  interfaces


 Q19. Why Concurrent Collection Classes are fail-fast in Java ?Core Java
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     concurrent collection classes   fail fast   fail-fast  collections  collection classes      expert


 Q20. Create an event class in Java.Core Java
 This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     event class


 Q21. What could be the reasons for restricting inheritance using final class ?Core Java
Ans. 1. Enforcing composition over inheritance
2. Restricting overriding of certain methods
3. Final methods are faster than regular instance methods
4. Enforcing Immutability

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     final class   reasons for final class   restricting inheritance  object oriented programming (oops)  oops concepts      expert


 Q22. Does use of Final class enforces composition over Inheritance in Java ? Core Java
Ans. Yes, to a certain extent. But the objective for Final class could be beyond just enforcing composition as certain classes might have been created without inheritance or composition in mind.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     final class   composition  object oriented programming (oops)  oops concepts  inheritance  object oriented programming (oops)  oops concepts  composition  object oriented programming (oops)  oops concepts vs inheritance  object oriented programming (oops)  oops concepts      expert


 Q23. Why Java has final class ?Core Java
 This question was recently asked at 'Avis'.This question is still unanswered. Can you please provide an answer.


 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     final class   final keyword     Asked in 1 Companies      basic


 Q24. Can we have interface as a replacement for utility class ? Core Java
Ans. Yes, With Java 8 we can use Interfaces as collection of utility methods through the use of default methods.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java 8  interfaces  utility class   utility classes


 Q25. Can we have multiple inheritance in java using abstract class ?Core Java
Ans. No

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     abstract class   multiple inheritance  object oriented programming (oops)  oops concepts     Asked in 2 Companies


 Q26. Which are the thread safe / synchronized / concurrent classes in java collections ?Core Java
Ans. Stack
Properties
Vector
BlockingQueue
ConcurrentMap
ConcurrentNavigableMap

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     collections  concurrent classes


  Q27. Explain OOps concepts.Core Java
Ans. There are four main OOP concepts in Java. These are:

Abstraction. Abstraction means using simple things to represent complexity. We all know how to turn the TV on, but we don?t need to know how it works in order to enjoy it. In Java, abstraction means simple things like objects, classes, and variables represent more complex underlying code and data. This is important because it lets avoid repeating the same work multiple times.

Encapsulation. This is the practice of keeping fields within a class private, then providing access to them via public methods. It?s a protective barrier that keeps the data and code safe within the class itself. This way, we can re-use objects like code components or variables without allowing open access to the data system-wide.

Inheritance. This is a special feature of Object Oriented Programming in Java. It lets programmers create new classes that share some of the attributes of existing classes. This lets us build on previous work without reinventing the wheel.

Polymorphism. This Java OOP concept lets programmers use the same word to mean different things in different contexts. One form of polymorphism in Java is method overloading. That?s when different meanings are implied by the code itself. The other form is method overriding. That?s when the different meanings are implied by the values of the supplied variables. See more on this below.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     oops  oops concepts     Asked in 16 Companies      basic        frequent


 Q28. What is abstraction ?Design
Ans. Abstraction is a process of hiding the implementation details and describing only the functionality to the user.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     bstraction  oops concepts  oops principle     Asked in 22 Companies


 Q29. What is the use of Object class ?Core Java
Ans. 1. Default definition for some of the methods , like equals, hashcode etc that gets carried to all objects even if you don't define anything. But that default definition is kind of like assigning 0 to integer, it just provide a safe state , nothing much for comparison.

2. Places where you have no idea about what object you may receive and just want to perform out of 8 basic methods of object class, something like printing their string representation ( defined by their toString method ), or equality ( using their equals method )

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     object class


 Q30. What are the benefits of immutability or Immutable classes ?Core Java
Ans. Immutable objects are thread-safe so you will not have any synchronization issues.Immutable objects are good for Map keys and Set elements, since these typically do not change once created.Immutability makes it easier to write, use and reason about the code (class invariant is established once and then unchanged)Immutability makes it easier to parallelize your program as there are no conflicts among objects.The internal state of your program will be consistent even if you have exceptions.References to immutable objects can be cached as they are not going to change.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     immutable  immutability classes   benefits of immutable  immutability classes     Asked in 1 Companies


next 30

Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: