Friday, October 26, 2007

Crazy Questions at Google Job Interview

A friend of mine had an interview a couple weeks ago with Google Inc. He provided me a list of just some of the questions he was asked. I’ve added a few more from others I have talked to who had interviews with the internet giant, Google, as well. See if you can answer them. Many are open ended with several right answers, therefore I did not provide the answers.

1. How many golf balls can fit in a school bus?

2. You are shrunk to the height of a nickel and your mass is proportionally reduced so as to maintain your original density. You are then thrown into an empty glass blender. The blades will start moving in 60 seconds. What do you do?

3. How much should you charge to wash all the windows in Seattle?

4. How would you find out if a machine’s stack grows up or down in memory?

5. Explain a database in three sentences to your eight-year-old nephew.

6. How many times a day does a clock’s hands overlap?

7. You have to get from point A to point B. You don’t know if you can get there. What would you do?

8. Imagine you have a closet full of shirts. It’s very hard to find a shirt. So what can you do to organize your shirts for easy retrieval?

9. Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and announces that at least one husband has been unfaithful. What happens?

10. In a country in which people only want boys, every family continues to have children until they have a boy. if they have a girl, they have another child. if they have a boy, they stop. what is the proportion of boys to girls in the country?

11. If the probability of observing a car in 30 minutes on a highway is 0.95, what is the probability of observing a car in 10 minutes (assuming constant default probability)?

12. If you look at a clock and the time is 3:15, what is the angle between the hour and the minute hands? (The answer to this is not zero!)

13. Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it�s only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?

14. You are at a party with a friend and 10 people are present including you and the friend. your friend makes you a wager that for every person you find that has the same birthday as you, you get $1; for every person he finds that does not have the same birthday as you, he gets $2. would you accept the wager?

15. How many piano tuners are there in the entire world?

16. You have eight balls all of the same size. 7 of them weigh the same, and one of them weighs slightly more. How can you find the ball that is heavier by using a balance and only two weighings?

17. You have five pirates, ranked from 5 to 1 in descending order. The top pirate has the right to propose how 100 gold coins should be divided among them. But the others get to vote on his plan, and if fewer than half agree with him, he gets killed. How should he allocate the gold in order to maximize his share but live to enjoy it? (Hint: One pirate ends up with 98 percent of the gold.)

Do you still think you have what it takes to work for Google?

Saturday, October 20, 2007

Aptitude Questions and Answers !!!

Aptitude Questions and Answers !!!

If 2x-y=4 then 6x-3y=?

(a)15
(b)12
(c)18
(d)10

Ans. (b)

If x=y=2z and xyz=256 then what is the value of x?

(a)12
(b)8
(c)16
(d)6

Ans. (b)

Pipe A can fill in 20 minutes and Pipe B in 30 mins and Pipe C can empty the same in 40 mins. If all of them work together, find the time taken to fill the tank

(a) 17 1/7 mins
(b) 20 mins
(c) 8 mins
(d) none of these

Ans. (a)

Thirty men take 20 days to complete a job working 9 hours a day. How many hour a day should 40 men work to complete the job?

(a) 8 hrs
(b) 7 1/2 hrs
(c) 7 hrs
(d) 9 hrs

Ans. (b)

Find the smallest number in a GP whose sum is 38 and product 1728

(a) 12
(b) 20
(c) 8
(d) none of these

Ans. (c)

A boat travels 20 kms upstream in 6 hrs and 18 kms downstream in 4 hrs. Find the speed of the boat in still water and the speed of the water current?

(a) 1/2 kmph
(b) 7/12 kmph
(c) 5 kmph
(d) none of these

Ans. (b)

A goat is tied to one corner of a square plot of side 12m by a rope 7m long. Find the area it can graze?

(a) 38.5 sq.m
(b) 155 sq.m
(c) 144 sq.m
(d) 19.25 sq.m

Ans. (a)

Mr. Shah decided to walk down the escalator of a tube station. He found that if he walks down 26 steps, he requires 30 seconds to reach the bottom. However, if he steps down 34 stairs he would only require 18 seconds to get to the bottom. If the time is measured from the moment the top step begins to descend to the time he steps off the last step at the bottom, find out the height of the stair way in steps?

Ans.46 steps.

The average age of 10 members of a committee is the same as it was 4 years ago, because an old member has been replaced by a young member. Find how much younger is the new member ?

Ans.40 years.

ABCE is an isosceles trapezoid and ACDE is a rectangle. AB = 10 and EC = 20. What is the length of AE?

Ans. AE = 10.

In the given figure, PA and PB are tangents to the circle at A and B respectively and the chord BC is parallel to tangent PA. If AC = 6 cm, and length of the tangent AP is 9 cm, then what is the length of the chord BC?

Ans. BC = 4 cm.

Three cards are drawn at random from an ordinary pack of cards. Find the probability that they will consist of a king, a queen and an ace.

Ans. 64/2210.

A number of cats got together and decided to kill between them 999919 mice. Every cat killed an equal number of mice. Each cat killed more mice than there were cats. How many cats do you think there were ?

Ans. 991.

If Log2 x - 5 Log x + 6 = 0, then what would the value / values of x be?

Ans. x = e2 or e3.

The square of a two digit number is divided by half the number. After 36 is added to the quotient, this sum is then divided by 2. The digits of the resulting number are the same as those in the original number, but they are in reverse order. The ten's place of the original number is equal to twice the difference between its digits. What is the number?

Ans. 46

Can you tender a one rupee note in such a manner that there shall be total 50 coins but none of them would be 2 paise coins.?

Ans. 45 one paisa coins, 2 five paise coins, 2 ten paise coins, and 1 twenty-five paise coins.

A monkey starts climbing up a tree 20ft. tall. Each hour, it hops 3ft. and slips back 2ft. How much time would it take the monkey to reach the top?

Ans.18 hours.

What is the missing number in this series?
8 2 14 6 11 ? 14 6 18 12


Ans. 9

A certain type of mixture is prepared by mixing brand A at Rs.9 a kg. with brand B at Rs.4 a kg. If the mixture is worth Rs.7 a kg., how many kgs. of brand A are needed to make 40kgs. of the mixture?

Ans. Brand A needed is 24kgs.

A wizard named Nepo says "I am only three times my son's age. My father is 40 years more than twice my age. Together the three of us are a mere 1240 years old." How old is Nepo?

Ans. 360 years old.

One dog tells the other that there are two dogs in front of me. The other one also shouts that he too had two behind him. How many are they?

Ans. Three.

A man ate 100 bananas in five days, each day eating 6 more than the previous day. How many bananas did he eat on the first day?

Ans. Eight.

If it takes five minutes to boil one egg, how long will it take to boil four eggs?

Ans. Five minutes.

The minute hand of a clock overtakes the hour hand at intervals of 64 minutes of correct time. How much a day does the clock gain or lose?

Ans. 32 8/11 minutes.

Solve for x and y: 1/x - 1/y = 1/3, 1/x2 + 1/y2 = 5/9.

Ans. x = 3/2 or -3 and y = 3 or -3/2.

Daal is now being sold at Rs. 20 a kg. During last month its rate was Rs. 16 per kg. By how much percent should a family reduce its consumption so as to keep the expenditure fixed?

Ans. 20 %.

Find the least value of 3x + 4y if x2y3 = 6.

Ans. 10.

Can you find out what day of the week was January 12, 1979?

Ans. Friday.

A garrison of 3300 men has provisions for 32 days, when given at a rate of 850 grams per head. At the end of 7 days a reinforcement arrives and it was found that now the provisions will last 8 days less, when given at the rate of 825 grams per head. How, many more men can it feed?

Ans. 1700 men.

From 5 different green balls, four different blue balls and three different red balls, how many combinations of balls can be chosen taking at least one green and one blue ball?

Ans. 3720.

Three pipes, A, B, & C are attached to a tank. A & B can fill it in 20 & 30 minutes respectively while C can empty it in 15 minutes. If A, B & C are kept open successively for 1 minute each, how soon will the tank be filled?

Ans. 167 minutes.

For a motorist there are three ways going from City A to City C. By way of bridge the distance is 20 miles and toll is $0.75. A tunnel between the two cities is a distance of 10 miles and toll is $1.00 for the vehicle and driver and $0.10 for each passenger. A two-lane highway without toll goes east for 30 miles to city B and then 20 miles in a northwest direction to City C.

1. Which is the shortest route from B to C


(a) Directly on toll free highway to City C
(b) The bridge
(c) The Tunnel
(d) The bridge or the tunnel
(e) The bridge only if traffic is heavy on the toll free highway

Ans. (a)


2. The most economical way of going from City A to City B, in terms of toll and distance is to use the


(a) tunnel
(b) bridge
(c) bridge or tunnel
(d) toll free highway
(e) bridge and highway

Ans. (a)


3. Jim usually drives alone from City C to City A every working day. His firm deducts a percentage of employee pay for lateness. Which factor would most influence his choice of the bridge or the tunnel ?


(a) Whether his wife goes with him
(b) scenic beauty on the route
(c) Traffic conditions on the road, bridge and tunnel
(d) saving $0.25 in tolls
(e) price of gasoline consumed in covering additional 10 miles on the bridge

Ans. (a)


4. In choosing between the use of the bridge and the tunnel the chief factor(s) would be:

I. Traffic and road conditions
II. Number of passengers in the car
III. Location of one's homes in the center or outskirts of one of the cities
IV. Desire to save $0.25

(a) I only
(b) II only
(c) II and III only
(d) III and IV only
(e) I and II only

The letters A, B, C, D, E, F and G, not necessarily in that order, stand for seven consecutive integers from 1 to 10
D is 3 less than A
B is the middle term
F is as much less than B as C is greater than D
G is greater than F

1. The fifth integer is

(a) A
(b) C
(c) D
(d) E
(e) F

Ans. (a)


2. A is as much greater than F as which integer is less than G

(a) A
(b) B
(c) C
(d) D
(e) E

Ans. (a)


3. If A = 7, the sum of E and G is

(a) 8
(b) 10
(c) 12
(d) 14
(e) 16

Ans. (a)

4. A - F = ?

(a) 1
(b) 2
(c) 3
(d) 4
(e) Cannot be determined

Ans. (a)


5. An integer T is as much greater than C as C is greater than E. T can be written as A + E. What is D?

(a) 2
(b) 3
(c) 4
(d) 5
(e) Cannot be determined

Ans. (a)


6. The greatest possible value of C is how much greater than the smallest possible value of D?

(a) 2
(b) 3
(c) 4
(d) 5
(e) 6

Ans. (a)

1. All G's are H's
2. All G's are J's or K's
3. All J's and K's are G's
4. All L's are K's
5. All N's are M's
6. No M's are G's



1. If no P's are K's, which of the following must be true?


(a) All P's are J's
(b) No P is a G
(c) No P is an H
(d) If any P is an H it is a G
(e) If any P is a G it is a J

Ans. (a)


2. Which of the following can be logically deduced from the conditions stated?


(a) No M's are H's
(b) No M's that are not N's are H's
(c) No H's are M's
(d) Some M's are H's
(e) All M's are H's

Ans. (a)


3. Which of the following is inconsistent with one or more of the conditions?


(a) All H's are G's
(b) All H's that are not G's are M's
(c) Some H's are both M's and G's
(d) No M's are H's
(e) All M's are H's

Ans. (a)


4. The statement "No L's are J's" is

I. Logically deducible from the conditions stated
II. Consistent with but not deducible from the conditions stated
III. Deducible from the stated conditions together with the additional statement "No J's are K's"

(a) I only
(b) II only
(c) III only
(d) II and III only
(e) Neither I, II nor III

Ans. (a)

In country X, democratic, conservative and justice parties have fought three civil wars in twenty years. TO restore stability an agreement is reached to rotate the top offices President, Prime Minister and Army Chief among the parties so that each party controls one and only one office at all times. The three top office holders must each have two deputies, one from each of the other parties. Each deputy must choose a staff composed of equally members of his or her chiefs party and member of the third party.

1. When Justice party holds one of the top offices, which of the following cannot be true


(a) Some of the staff members within that office are justice party members
(b) Some of the staff members within that office are democratic party members
(c) Two of the deputies within the other offices are justice party members
(d) Two of the deputies within the other offices are conservative party members
(e) Some of the staff members within the other offices are justice party members.

Ans. (a)


2. When the democratic party holds presidency, the staff of the prime minister's deputies are composed

I. One-fourth of democratic party members
II. One-half of justice party members and one-fourth of conservative party members
III. One-half of conservative party members and one-fourth of justice party members.

(a) I only
(b) I and II only
(c) II or III but not both
(d) I and II or I and III
(e) None of these

Ans. (a)


3. Which of the following is allowable under the rules as stated:


(a) More than half of the staff within a given office belonging to a single party
(b) Half of the staff within a given office belonging to a single party
(c) Any person having a member of the same party as his or her immediate superior
(d) Half the total number of staff members in all three offices belonging to a single party
(e) Half the staff members in a given office belonging to parties different from the party of the top office holder in that office.

Ans. (a)


4. The office of the Army Chief passes from Conservative to Justice party. Which of the following must be fired.


(a) The democratic deputy and all staff members belonging to Justice party
(b) Justice party deputy and all his or hers staff members
(c) Justice party deputy and half of his Conservative staff members in the chief of staff office
(d) The Conservative deputy and all of his or her staff members belonging to Conservative party
(e) No deputies and all staff members belonging to conservative parties.

Ans. (a)

Thursday, October 4, 2007

The most frequently asked General Interview Questions

The most frequently asked General Interview Questions

Tell me about yourself?
The most often asked question in interviews. You need to be short in your answer. Let the answer contain work-related items unless instructed otherwise. Talk about things you have done and jobs you have held that relate to the position you are interviewing for. Start with the first one till the present.

Why should we hire you?
Point out how your assets meet what the organization needs. Do not mention any other candidates to make a comparison.

Why did you leave your last job?
Be as positive as possible. Never refer to a major problem with management, supervisors, co-workers, or the organization. If you do, you will be the one looking bad. Talk about leaving for a positive reason such as an opportunity, a chance to do something special, or other forward-looking reasons.

What do you know about this organization?
This question is one reason to know something on the organization before the interview. Learn basic things about the organisation like where they have been, and where they are going. What are the current issues, and who are the major players?

What experience do you have in this field?
Speak about specifics that relate to the position you are applying for. If you do not have specific experience, get as close as you can.

Do you know anyone who works for us?
Be aware of the policy on relatives working for the organization. This can affect your answer even though they asked about friends not relatives. Be careful to mention a friend only if they are well thought of.

Explain how you would be an asset to this organization?
You should be anxious for this question. It gives you a chance to highlight your best points as they relate to the position being discussed. Give a little advance thought to this relationship.

How long would you expect to work for us if hired?
Specifics here are not good. Something like this should work:
"I'd like it to be a long time." or
"As long as we both feel I'm doing a good job."

Wednesday, October 3, 2007

Top 50 C, C++ Interview Questions asked in Interviews!

  1. What does static variable mean?
  2. What is a pointer?
  3. What is a structure?
  4. What are enumerations?
  5. Describe about storage allocation and scope of global, extern, static, local and register variables?
  6. What are register variables? What are the advantage of using register variables?
  7. What is difference between Structure and Unions?
  8. What the advantages of using Unions?
  9. What are the advantages of using pointers in a program?
  10. What is the difference between Strings and Arrays?
  11. In a header file whether functions are declared or defined?
  12. What is a far pointer? where we use it?
  13. How will you declare an array of three function pointers where each function receives two ints and returns a float?
  14. What is a NULL Pointer? Whether it is same as an uninitialized pointer?
  15. What is a NULL Macro? What is the difference between a NULL Pointer and a NULL Macro?
  16. What does the error ‘Null Pointer Assignment’ mean and what causes this error?
  17. What is near, far and huge pointers? How many bytes are occupied by them?
  18. How would you obtain segment and offset addresses from a far address of a memory location?
  19. If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?
  20. Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
  21. What are bit fields? What is the use of bit fields in a Structure declaration?
  22. To which numbering system can the binary number 1101100100111100 be easily converted to?
  23. Which bit wise operator is suitable for checking whether a particular bit is on or off?
  24. Which bit wise operator is suitable for turning off a particular bit in a number?
  25. Which bit wise operator is suitable for putting on a particular bit in a number?
  26. Which bit wise operator is suitable for checking whether a particular bit is on or off?
  27. Which header file should you include if you are to develop a function which can accept variable number of arguments?
  28. Can you write a function similar to printf()?
  29. How can a called function determine the number of arguments that have been passed to it?
  30. Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
  31. How would you use the functions sin(), pow(), sqrt()?
  32. How would you use the functions memcpy(), memset(), memmove()?
  33. How would you use the functions fseek(), freed(), fwrite() and ftell()?
  34. How would you obtain the current time and difference between two times?
  35. How would you use the functions randomize() and random()?
  36. How would you implement a substr() function that extracts a sub string from a given string?
  37. What is the difference between the functions rand(), random(), srand() and randomize()?
  38. What is the difference between the functions memmove() and memcpy()?
  39. How do you print a string on the printer?
  40. Can you use the function fprintf() to display the output on the screen?
  41. What is a linklist and why do we use it when we have arrays? - I feel the correct answer should be linklist is used in cases where you don’t know the memory required to store a data structure and need to allocate is dynamically on demand.
  42. How do you detect a loop in linked list?
  43. What is the difference between main() in C and main() in C++?
  44. what will be printed out when the following code is executed:

    main()
    {
    printf("%x",-1<<4);
    }

  45. In header files whether functions are declared or defined?
  46. What are the differences between malloc() and calloc()?
  47. What are macros? What are the advantages and disadvantages?
  48. Difference between pass by reference and pass by value?
  49. What is static identifier?
  50. Where are the auto variables stored?

Important Questions on Servlets along with Answers!

Q What is a servlet? Explain its lifecyle.

A The Servlets are server side java programs, which are used to generate dynamic web content for a web clients. They reside inside a servlet container on a web server or an application server. The servlet container provides them a runtime environment.

If an instance of servlet is non existent then web container loads the servlet class and creates an instance of the servlet.Once the servlet instantiates, web container calls init() method on it to initialize the servlet.This process of initialization can be customized to allow servlet to read persistent configuration data,initialize resources like database connections etc. by overriding init() method of Servlet interface.If initialization of a servelet fails it throws UnavailableException.

Once initialization is done, web container invokes the service method, passing a request and response object depending upon incoming request.

If the container needs to remove the servlet(e.g.when web container is shutting down), it finalizes the servlet by calling the servlet's destroy method.

The javax.servlet.Servlet interface defines the three life-cycle method:-

public void init(ServletConfig config) throws ServletException

public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException

public void destroy()


Q What is the difference between CGI and servlets?

A In traditional CGI, a new process is started with each client request and this will correspond to initiating a heavy OS level process each time when a client request comes. While in case of servlets JVM handles client requests at a web server end and each client request correspond to thread which consumes less resources as compared with CGI process, thus making CGI inefficient. In Java servlet, there is only a single instance, which answers all requests concurrently. This saves memory and allows a Servlet to easily manage persistent data.Java servlets resides in Servlet engine and are executed within sandbox making it more secure and robust.


Q What is a middleware and what is the functionality of Webserver?

A A middleware in a 3-tier architecture sits in the middle of a client's machine and a database server. A middleware is where all the business related logic resides and it is also known as Web Application Server. (e.g. WebLogic from BEA, WebSphere from IBM, Oracle 9iAS from Oracle etc.)In distributed programming divide and rule is the name of the game and in this paradigm a middleware has a good share of responsibilities viz. load balancing, database connection pooling, security, transaction management related services, web and enterprise component deployment services, content management related services etc.


Q Can there be more than one instance of a servlet at one time ?

A It is important to note that there can be more than one instance of a given Servlet class in the servlet container. For example, this can occur where there was more than one servlet definition that utilized a specific servlet class with different initialization parameters. This can also occur when a servlet implements the SingleThreadModel interface and the container creates a pool of servlet instances to use.


Q Why there are no constructors in servlets?

A A servlet is just like an applet in the respect that it has an init() method that acts as a constrcutor. Since the servlet environment takes care of instantiating the servlet, an explicit constructor is not needed. Any initialization code you need to run should be placed in the init() method since it gets called when the servlet is first loaded by the servlet container.


Q What is a Servlet Context?

A A ServletContext interface empowers a servlet to view its environment. A servlet can use this interface to get following informations:

- Initial Web Application Parameters
- Application Scope for binding objects
- Virtual Directory Translation
- A common mechanism for Logging information

Each vendor provides specific ServletContext object but they all provide the same functionality defined by the ServletContext interface.


Q What is meant by Session tell me something about HttpSession?

A A web client makes a request to a web server over HTTP. As long as a client interacts with the server through a browser on his or her machine,this interaction is called as session. HTTP is a stateless protocol. A client's each request is treated as a fresh one with no info of client to the server and the moment browser is closed, session is also closed. In an online shopping or web cart kind of application where session related information is critical for successive purchases made by a client, there have been suggested several techniques for session tracking in Java Servlets as mentioned below:

-Hidden form fields
-URL Rewriting
-Cookies
-HttpSession object

HttpSession is an interface, which belongs to javax.servlet.http. * package This provides a facility to identify a user across the several pages' requests by looking up the HttpSession object associated with the current request.
This is done by calling the getSession method of HttpServletRequest. If this returns null, you can create a new session, but this is so commonly done that there is an option to automatically create a new session if there isn't one already. Just pass true to getSession. Thus, your first step usually looks like this:

HttpSession session = request.getSession (true);

To ensure the session is properly maintained, this method must be called at least once before any output is written to the response.

You can add data to an HttpSession object with the putValue() method:

public void HttpSession.putValue(String name, Object value)

This method binds the specified object value under the specified name. Any existing binding with the same name is replaced.

To retrieve an object from a session, use getValue():

public Object HttpSession.getValue(String name)

This methods returns the object bound under the specified name or null if there is no binding.

You can also get the names of all of the objects bound to a session with getValueNames():

public String[] HttpSession.getValueNames()

This method returns an array that contains the names of all objects bound to this session or an empty (zero length) array if there are no bindings.

Finally, you can remove an object from a session with removeValue():

public void HttpSession.removeValue(String name)

This method removes the object bound to the specified name or does nothing if there is no binding. Each of these methods can throw a java.lang.IllegalStateException if the session being accessed is invalid.


Q What is the difference between GenericServlet and HTTPServlet?

A GenericServlet is an abstract class that defines a generic, protocol-independent servlet.Any protocol dependent servlet has to extend this class in order to provide a specific implementaion and override service method.e.g . HTTPServlet class extends GenericServlet class.

GenericServlet has a service(ServletRequest req, ServletResponse res) method which is called by the servlet container to allow the servlet to respond to a request.

HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP 1.0) plus doPut(), doOptions(), doDelete(), doTrace() methods (HTTP 1.1). Both these classes are abstract.


Q What is the difference between doGet and doPost methods of HttpSe?

A A GET or POST request is sent to servlet in order to expedite the request by calling corresponding doGet() and doPost() methods.
doGet is called in response to an HTTP GET request. This happens when users click on a link, or enter a URL into the browser's address bar. It also happens with some HTML FORMs (those with METHOD="GET" specified in the FORM tag).
doPost is called in response to an HTTP POST request. This happens with some HTML FORMs (those with METHOD="POST" specified in the FORM tag).
Both methods are called by the default (superclass) implementation of service in the HttpServlet base class. You should override one or both to perform your servlet's actions. You probably shouldn't override service().
There is a restriction of numbers of parameters to be sent through doGet method around 2k of data can be sent and moreover whole of URL is to be mentioned in case of doGet as mentioned below:
http://www.xyz.com/servlet?param1=value1&param2=value2&...&paramN=valueN
So it is always better to use doPost() when sending parameters from a FORM as it doesn't show off information related with password on the network etc.


Q Why do GenericServlet and HttpServlet class implement Serializable interface?

A In order to support HTTP session states, all servlet session data must be serializable.Moreover, servlets need to communicate over the network to Java objects(e.g. in Applet-Servlet communication),in such scenarios it becomes necessary to enable serialization of objects' states through implementation of Serializable interface.This is the way GenericServlet and HttpServlet classes have been designed by their designers to make them capable of serialization.