Interview Questions and Answers for 'Ear' | 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 'Ear' - 41 question(s) found - Order By Newest

next 30
Very frequently asked. Among first few questions in almost all interviews. Among Top 5 frequently asked questions. Frequently asked in Indian service companies (HCL,TCS,Infosys,Capgemini etc based on multiple feedback ) and Epam Systems
  Q1. Difference between == and .equals() ?Core Java
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory.

x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object.

Sample code:

String x = new String("str");
String y = new String("str");

System.out.println(x == y); // prints false
System.out.println(x.equals(y)); // prints true

  Sample Code for equals

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

   Like         Discuss         Correct / Improve     java   string comparison   string   object class   ==    equals   object equality  operator   == vs equals   equals vs ==     Asked in 294 Companies      basic        frequent

Try 6 Question(s) Test


  Q2. Explain OOPs

or

Explain OOPs Principles

or

Explain OOPs Concepts

or

Explain OOPs features

or

Tell me something about OOPs
Core Java
Ans. OOPs or Object Oriented Programming is a Programming model which is organized around Objects instead of processes. Instead of a process calling series of processes, this model stresses on communication between objects. Objects that all self sustained, provide security by encapsulating it's members and providing abstracted interfaces over the functions it performs. OOP's facilitate the following features

1. Inheritance for Code Reuse
2. Abstraction for modularity, maintenance and agility
3. Encapsulation for security and protection
4. Polymorphism for flexibility and interfacing

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

   Like         Discuss         Correct / Improve     oops  oops features     Asked in 260 Companies      basic        frequent


Very frequently asked. Favorite question in Walk in Drive of many Indian service companies.
  Q3. What is the difference between ArrayList and LinkedList ?Core Java
Ans. Underlying data structure for ArrayList is Array whereas LinkedList is the linked list and hence have following differences -

1. ArrayList needs continuous memory locations and hence need to be moved to a bigger space if new elements are to be added to a filled array which is not required for LinkedList.

2. Removal and Insertion at specific place in ArrayList requires moving all elements and hence leads to O(n) insertions and removal whereas its constant O(1) for LinkedList.

3. Random access using index in ArrayList is faster than LinkedList which requires traversing the complete list through references.

4. Though Linear Search takes Similar Time for both, Binary Search using LinkedList requires creating new Model called Binary Search Tree which is slower but offers constant time insertion and deletion.

5. For a set of integers you want to sort using quicksort, it's probably faster to use an array; for a set of large structures you want to sort using selection sort, a linked list will be faster.

  Sample Code for ArrayList

  Sample Code for LinkedList

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

   Like         Discuss         Correct / Improve     collections   java   data structures   arraylist   linkedlist   arraylist vs linkedlist     Asked in 61 Companies      Basic        frequent

Try 1 Question(s) Test


Frequently asked in Cognizant (CTS)
  Q4. What is Serialization ? Why do we need it ?Core Java
Ans. Storing the state of an object in a file or other medium is called serialization.

Classes can communicate only if they are built together ( as they need Byte code for communication ). What if we need to enable communication between different applications ( i.e they have been built independently or even they reside at different locations ), We need a mechanism that will transfer the Bean state to a Medium than can be transferred to the receiving application.

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

   Like         Discuss         Correct / Improve     java   oops   serialization     Asked in 18 Companies      basic        frequent

Try 1 Question(s) Test


Advanced level question frequently asked in US based companies. Recently asked in EMC and Intuit.
  Q5. Can you provide some implementation of a Dictionary having large number of words ? Solution
Ans. Simplest implementation we can have is a List wherein we can place ordered words and hence can perform Binary Search.

Other implementation with better search performance is to use HashMap with key as first character of the word and value as a LinkedList.

Further level up, we can have linked Hashmaps like ,

hashmap {
a ( key ) -> hashmap (key-aa , value (hashmap(key-aaa,value)
b ( key ) -> hashmap (key-ba , value (hashmap(key-baa,value)
....................................................................................
z( key ) -> hashmap (key-za , value (hashmap(key-zaa,value)
}

upto n levels ( where n is the average size of the word in dictionary.

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

   Like         Discuss         Correct / Improve     java   collections   hashmap   binary search   search algorithm   advanced   architecture   data structure     Asked in 6 Companies        frequent

Try 1 Question(s) Test


Frequently asked to experienced developers. Recently asked in many US interviews.
  Q6. What is database deadlock ? How can we avoid them?Database
Ans. When multiple external resources are trying to access the DB locks and runs into cyclic wait, it may makes the DB unresponsive.

Deadlock can be avoided using variety of measures, Few listed below -

Can make a queue wherein we can verify and order the request to DB.

Less use of cursors as they lock the tables for long time.

Keeping the transaction smaller.

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

   Like         Discuss         Correct / Improve     java   database   architecture     Asked in 7 Companies      expert        frequent


Almost sure to be asked in every company using any Dependency Injection framework ( Spring, Guice etc )
  Q7. What is Dependency Injection or IOC ( Inversion of Control ) ?Design
Ans. It is a Design Pattern that facilitates loose coupling by sending the dependency information ( object references of dependent object ) while building the state of the object. Objects are designed in a manner where they receive instances of the objects from other pieces of code, instead of constructing them internally and hence provide better flexibility.

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

   Like         Discuss         Correct / Improve     design patterns   ioc ( Inversion of Control )  dependency injection     Asked in 83 Companies      intermediate        frequent


Frequently asked Generic Question.
  Q8. Why do you want to work for our company ?General
Ans. [Open Ended Answer]

Usually answered stating your keen interest in the role offered and challenges and opportunities the role offers.

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

   Like         Discuss         Correct / Improve          Asked in 42 Companies        frequent


 Q9. Design a Data Structure for a full text Search ?Design
 This question was recently asked at 'Myntra'.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     Full Text Search  Data Structure     Asked in 1 Companies      expert


Very frequently asked. Usually asked with questions related to String. Frequently asked at CTS / Cognizant
  Q10. What is an Immutable Object ?Core Java
Ans. Object that can't be changed after instantiation.

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

   Like         Discuss         Correct / Improve     java   oops   immutable  immutability     Asked in 27 Companies      basic        frequent

Try 2 Question(s) Test


 Q11. What are the pre-requisite for the collection to perform Binary Search ?
Ans. 1. Collection should have an index for random access.
2. Collection should have ordered elements.

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

   Like         Discuss         Correct / Improve     java   collections   search algorithm   search   binary search   at&t      intermediate


Very frequently asked if being interviewed for hibernate. Frequently asked in Tata Consultancy (TCS) and Overstock.com
  Q12. Difference between load and get ?Hibernate
Ans. If id doesnt exist in the DB load throws an exception whereas get returns null in that case.get makes the call to DB immediately whereas load makes the call to proxy.

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

   Like         Discuss         Correct / Improve     hibernate     Asked in 16 Companies      basic        frequent


  Q13. Difference between jar , war and ear ?Java EE
Ans. Jar is Java Archieve i.e compressed Class or Class / Java files.

War comprises of compressed Servlet class files,JSP FIles,supporting files, GIF and HTML files.

Ear comprise of compressed Java and web module files ( was files ).

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

   Like         Discuss         Correct / Improve     java   j2ee   jar   web development   war   ear   build management   release management     Asked in 12 Companies      basic        frequent


  Q14. What is database Normalization ?Database
Ans. https://en.wikipedia.org/wiki/Database_normalization

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

   Like         Discuss         Correct / Improve     normalization  database     Asked in 35 Companies      intermediate        frequent


 Q15. Explain various Searching and Sorting Algorithms ?Algorithm
 This question was recently asked at 'HeadStrong,ServiceNow'.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     Search Algorithm  Sorting Algorithm     Asked in 2 Companies      basic        frequent


 Q16. Write a Program to print factorial of a number using recursionCore Java
Ans. public class BuggyBread {
public static void main(String args[]) {
System.out.println(factorial(5));
}

private static int factorial(int number){
if(number == 1){
return 1;
} else {
return number * factorial(number - 1);
}
}
}

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

   Like         Discuss         Correct / Improve     recursion     Asked in 25 Companies


 Q17. What is a Webdriver ?Testing
Ans. Selenium WebDriver is a tool for automating web application testing.It helps in replicating the manual tester behavior like keyboard entry, mouse events etc and then matching the output against the expected.

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

   Like         Discuss         Correct / Improve     selenium  webdriver     Asked in 37 Companies


Very frequently asked. Usually asked in this format or as difference with interfaces / concrete classes.
  Q18. What is an abstract class ?Core Java
Ans. Abstract class is the class that is not supposed to be instantiated. The purpose of the class to only have extension to the derived class.

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

   Like         Discuss         Correct / Improve     abstract class     Asked in 6 Companies      basic        frequent


 Q19. Can we use Ordered Set for performing Binary Search ?
Ans. We need to access values on the basis of an index in Binary search which is not possible with Sets.

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

   Like         Discuss         Correct / Improve     java   sets   set   collections   binary search


 Q20. What is CopyOnWriteArrayList ?
Ans. Its a type of ArrayList in which all Write operations , i.e add and set are performed by creating a new copy. This array never changes during the lifetime of the iterator, so it never throws ConcurrentModificationException

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

   Like         Discuss         Correct / Improve     java   collections   list   arraylist   copyonwritearraylist   ConcurrentModificationException     Asked in 1 Companies


 Q21. What are the advantages and disadvantages of CopyOnWriteArrayList ?Core Java
Ans. This collections class has been implemented in such a manner that it can never throw ConcurrentModificationException. As it performs update and write operations by creating a new copy of ArrayList, It's slower compared to ArrayList.

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

   Like         Discuss         Correct / Improve     java   collections   list   arraylist   copyonwritearraylist   advantages-disadvantages   ConcurrentModificationException     Asked in 4 Companies      Expert


 Q22. Which of the following is usually not part of EAR file ?

a. Server Configuration files
b. HTML and Media Files
c. Application Configuration files
d. Class files
Ans. Server Configuration files

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

   Like         Discuss         Correct / Improve     ear   deployment   servers   java


Frequently asked in face to face interviews.
  Q23. Write a program to print fibonacci series.Core Java
Ans. int count = 15;
int[] fibonacci = new int[count];
fibonacci[0] = 0;
fibonacci[1] = 1;
for(int x=2; x < count; x++){
fibonacci[x] = fibonacci[x-1] + fibonacci[x-2];
}

for(int x=0; x< count; x++){
System.out.print(fibonacci[x] + " ");
}

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

   Like         Discuss         Correct / Improve     ebay   fibonacci series     Asked in 66 Companies      basic        frequent


  Q24. What is a Destructor ? Do we have Destructors in Java ?Core Java
Ans. Destructor is used to de-allocate memory allocated by objects.

There are no destructors in Java. Alternatively, Java provides Automatic garbage collection i.e automatically releasing the un-referenced memory.

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

   Like         Discuss         Correct / Improve     destructor  garbage collection     Asked in 11 Companies      Basic        frequent

Try 1 Question(s) Test


Frequently asked to Fresh graduates.
 Q25. Write a program to implement Binary search ?Core Java
Ans. http://algs4.cs.princeton.edu/11model/BinarySearch.java.html

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

   Like         Discuss         Correct / Improve     binary search  search     Asked in 5 Companies      basic        frequent

Try 1 Question(s) Test


 Q26. What is Spring Boot ?Spring Boot
Ans. Spring Boot is Springs convention-over-configuration solution for creating stand-alone, production-grade Spring-based Applications.

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

   Like         Discuss         Correct / Improve     Spring Boot     Asked in 7 Companies


  Q27. What is Maven ?Maven
Ans. Maven is a build automation tool used primarily for Java projects.

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

   Like         Discuss         Correct / Improve     maven  build     Asked in 6 Companies      basic        frequent


 Q28. Do you feel that its useless to define hashCode method for a class ?Core Java
Ans. Yes its useless if we are not going to use its objects within Hash collection, For example - HashSet , HashMap. HashCode is used internally by these collections for Search.

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

   Like         Discuss         Correct / Improve     hashcode  hash collections  search


  Q29. What are the core OOPs concepts ?Core Java
Ans. Abstraction, Encapsulation, Polymorphism , Composition and Inheritance

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

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


 Q30. What data structure will you use if we have to search an element in million of elements ?Data Structure
 This question was recently asked at 'Microsoft'.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     Search     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: