Google Interview Question for Software Engineer / Developers


Country: United States




Comment hidden because of low score. Click to expand.
2
of 2 vote

Animals are mainly categorized into two :

(1)Vertebrates: Animals with backbone
(2)Invertebrates:Animals with no backbone (bacteria etc.)

abstract class Animal {
	
	abstract void feed();
	
	abstract void respire();
	
	abstract void reproduce();
	
}

abstract class Invertebrates extends Animal {}


abstract class Vertebrates extends Animal {
	abstract void move();
}


abstract class Mammals extends Vertebrates {}


abstract class Birds extends Vertebrates {}
	

abstract class Fish extends Vertebrates {}


abstract class Reptiles extends Vertebrates {}

- Serdar January 12, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I would change the "animal" class to an "interface"

- ben January 12, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 2 vote

The Animal Family can be broadly classified as below sub categories:
> Bird Family
> Mammal Family
> Insect Family
> Fish Family

Animals can be also classified based on many of their characteristics, such as:
> Carnivores vs Herbivores
> Scavengers
> Land vs. Water Animals
> Noctural or Night Animals
> Cold Blooded vs Warm Blooded Animals
> Vertebrates vs. Invertebrates
> Fly / Swim / Run
> Number Of Legs

class Animal {
   String Name ;
   List <Characteristic> Characteristics ;
   .....
};

class Characteristic {
   String Name;
   ...
};

class Carnivores : public Characteristic {
  bool isCarnivores ();
  ...
};

class Legs : public Characteristic {
  int NumberOfLegs ();
  ...
};

- R@M3$H.N January 08, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

class animal  //base of all
{
var parents[],childrens[],species,behaviors[]; //behaviours may contain it is carnivorous or hervivorous , color etc .
animal(){
}
~animal()
{
}
}

- kaushikfrnd January 08, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

For me makes sense to reuse all the effort made in taxonomy, I would create:

module Biology
      module Kingdom
        module Animalia
        .... all other kingdoms
      module Phylum
        module Chordata
        .... all other phylums
      module SubPhylum
        ...
      module SuperClass
        ...
      module Class
        module Mamalia
        .... all other classes
      module Order
        module Carnivora
        .... all other orders
      module Family
        module Felidae
        .... all other families
      module Genus
        module Panthera
        .... all other Genus
      module Species
        module Tiger
        .... would include Panthera, Felidae, Carnivora, Mamalia, Chordata and Animalia.

To ease the process of writing all this code I would try to fetch data from an API or maybe scrapping Wikipedia.

- Juan David Pastas January 09, 2014 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More