Interview Questions and Answers for 'Ancestry' | Search Java Interview Question -

Search Interview Questions

 2508 questions in repository.
 There are more than 200 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 'Ancestry' - 10 question(s) found - Order By Newest

Very frequently asked in different variations. Frequently asked in Deloitte ( 2 feedback ) , HCL Tech ( 3 feedback ) and Coginizant (CTS)
  Q1. Explain the scenerios to choose between String , StringBuilder and StringBuffer ?


What is the difference between String , StringBuilder and StringBuffer ?
Core Java
Ans. If the Object value will not change, use String Class because a String object is immutable.

If the Object value can change and will only be modified from a single thread, use StringBuilder because StringBuilder is unsynchronized(means faster).

If the Object value may change, and can be modified by multiple threads, use a StringBuffer because StringBuffer is thread safe(synchronized).

  Sample Code for String

  Sample Code for StringBuffer

  Sample Code for StringBuilder

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

   Like      Discuss      Correct / Improve     java   string class   string   stringbuilder   stringbuffer     Cognizant (CTS)   San Jose State University (SJSU)  HCL Technologies   Deloitte  Sophos  Hitachi  JPMorgan Chase  IBM  Kony Labs  Keystone  ebay  TIAA Financial Services  Ancestry   Rakuten      basic        frequent

Try 3 Question(s) Test

Frequently asked in face to face interviews.
  Q2. 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     Manvish eTech  Belvedere Trading  King UK  FinaTel  Goldman Sachs  Enlighten Software  Misys  Mahindra Comviva  ZapCom  Nucleus Software Exports  Enlighten  Sears  Mahindra Satyam  Insperity  General Motors  AVIS e Solutions  Paddy Power Betfair  TurningCloud  Polestar Solutions  BlueWhale Solutions  CitiusTech  Zuhlke  Comcast  KGFSL  Quickr  Paramatrix Technologies  CalSoft  OnMobile Global  NBCUniversal  Inventum Technologies  Hughes Systique  Flextronics  Geometric Soft  Check Point Software Technologies  ZapLabs  Indecomm Global Services  HTC Global  Quovantis Technologies  Mobiloitte  Riktam Technologies  DMX Technologies  Mojo Networks  Tata Elxsi  Ciena  ServiceNow  EverBridge  LendingClub  Virtusa Polaris  West Corporation  Ebay  Walmart  HomeAway  AllClear ID  Quinnox Software  Acquity Group  Cadence Design Systems  SmartPrix  Leidos  Zoho  Varian Medical Systems  HealthSparq  karya technology  Canopy Tax      basic        frequent

 Q3. Why shouldn't we use string concatenation extensively or in a loop ?Core Java2017-08-08 09:52:53

Ans. Because String being an immutable object creates a new object upon each concatenation cycle. If there is any such need , we should use String Builder whose objects are mutable.

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

   Like      Discuss      Correct / Improve     string  string immutable     Ancestry

 Q4. What do you do when told to do something that you don't agree with? General2017-08-24 19:58:50

 This question was recently asked at 'Ancestry,Sofi'.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          Ancestry  Sofi

 Q5. Which immutable classes have you worked with ? Can you name some immutable Collections ? How to make an immutable collection ?Core Java2017-08-28 17:11:22

Ans. string and wrapper class objects

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

   Like      Discuss      Correct / Improve     immutability  immutable classes   immutable collections     Ancestry  HCL Technologies  Tata Consultancy (TCS)

 Q6. What are the benefits of immutability or Immutable classes ?Core Java2017-08-28 19:36:18

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 classes   benefits of immutable classes     Ancestry

 Q7. What is the difference between SDLC and Agile ?Process2017-08-28 19:37:08

Ans. Here are the differences between Agile and Waterfall Methodology:

The software development process is divided into different phases in the Waterfall model while Agile methodology segregates the project development lifecycle into sprints

Waterfall is a structured software development methodology, and often times can be quite rigid, whereas the Agile methodology is known for its flexibility

According to the Waterfall model, software development is to be completed as one single project, which is then divided into different phases, with each phase appearing only once during the SDLC. However, the Agile methodology can be considered as a collection of many different projects, which are nothing but the iterations of the different phases focusing on improving the overall software quality with feedback from users or the QA team

If you want to use the Waterfall model for software development, then you have to be clear with all the development requirements beforehand as there is no scope of changing the requirements once the project development starts. The Agile methodology, on the other hand, is quite flexible, and allows for changes to be made in the project development requirements even after the initial planning has been completed

All the project development phases such as designing, development, testing, etc. are completed once in the Waterfall model while as part of the Agile methodology, they follow an iterative development approach.

As a result, planning, development, prototyping and other software development phases can appear more than once during the entire SDLC One of the major differences between Agile and Waterfall development methodology is their individual approach towards quality and testing.

In the Waterfall model, the Testing phase comes after the Build phase, but, in the Agile methodology, testing is typically performed concurrently with programming or at least in the same iteration as programming

While Waterfall methodology is an internal process and does not require the participation of customers, the Agile software development approach focuses on customer satisfaction and thus, involves the participation of customers throughout the development phase

The Waterfall model can be regarded as a stringently sequential process, however, the Agile methodology is a highly collaborative software development process, thereby leading to better team input and faster problem solving

The Waterfall model is best suited for projects which have clearly defined requirements and in which change is not expected at all, while Agile development supports a process in which the requirements are expected to change and evolve. Thus, if you are planning to develop a software that would require frequent overhauls and has to keep up with the technology landscape and customer requirements, Agile is the best approach to follow

The Waterfall model exhibits a project mindset and lays its focus strictly on the completion of project development, while Agile introduces a product mindset that focuses on ensuring that the developed product satisfies its end customers, and changes itself as the requisites of customers change

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

   Like      Discuss      Correct / Improve     sdlc  agile  adlc vs agile     Ancestry  HCL Technologies  Infosys

 Q8. What is the difference between Kan Ban and Agile ? Which one do you prefer ?Process2017-08-28 19:37:30

 This question was recently asked at 'Ancestry'.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     kanban  agile  kanban vs agile     Ancestry

 Q9. How is LinkedList collection class internally implemented ? Is it a Linked List or Doubly Linked List ? Core Java2017-08-28 19:40:39

 This question was recently asked at 'Ancestry'.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     linkedlist  internal implementation of linkedlist     Ancestry

Do you think these are the Best Java Frameworks ?

OpenXavaSPRING MVCApache StripesCheck everything
that is Best in Java

Click Here

  Q10. What is collection framework in Java ?Core Java2017-12-27 19:17:14

Ans. The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures. Although referred to as a framework, it works in a manner of a library. The JCF provides both interfaces that define various collections and classes that implement them.

  Sample Code for Map

  Sample Code for HashMap

  Sample Code for Treemap

  Sample Code for set

  Sample Code for hashset

  Sample Code for treeset

  Sample Code for list

  Sample Code for arraylist

  Sample Code for linkedlist

  Sample Code for queue

  Sample Code for priorityqueue

  Sample Code for concurrenthashmap

  Sample Code for vector

  Sample Code for stack

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

   Like      Discuss      Correct / Improve     collections     Tata Consultancy (TCS)  HCL Technologies  Ancestry  Cerner  Accenture  Global Logic  MasterCard  Vyom Labs      basic        frequent

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner

comments powered by Disqus

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:

X Close this

Ancestry: This company indeed has very good work ... Anonymous

Ancestry: Coding assignment comprising of 3 questions, 1 object oriented ... Anonymous

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   

Questions Asked: