CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: Define Hash table?

Answer: Hash tables are good for doing a quick search on things.

For instance if we have an array full of data (say 100 items).If we knew the position that a specific item is stored in an array, then we could quickly access it. For instance, we just happen to know that the item we want it is at position 3; I can apply:
myitem=myarray[3];



There are many different hash functions. Some hash functions will take an integer key and turn it into an index. A common one is the division method.



Category J2EE Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.5) By 572 users
Added on 12/28/2012
Views 6461
Rate it!
Question: Define Hash table?
Answer:

Hash tables are good for doing a quick search on things.

For instance if we have an array full of data (say 100 items).If we knew the position that a specific item is stored in an array, then we could quickly access it. For instance, we just happen to know that the item we want it is at position 3; I can apply:
myitem=myarray[3];



There are many different hash functions. Some hash functions will take an integer key and turn it into an index. A common one is the division method. Source: CoolInterview.com

Answered by: Jatinder Jain | Date: 2/7/2008 | Contact Jatinder Jain Contact Jatinder Jain

HashTable is one of the implementations of Collections frame work and it implements Map interface.There are two main factors of HashTable one is initial capacity & load factor. We can pass these two parameter while creation of Hash table other wise it will create the same by asigning default values (i.e 11 & 0.75 respectively).
Hash Table is dynamic (i.e it can grow), when we specify initial capacity & load factor(i.e Hash Table ht=new HashTable(100,0.75))it doesn't mean that the Hash Table size is restricted to 100 only. but it creates a Hash Table with capacity of 100 & increases itself when the capacity is reached to 75 not to 100.
We can put an elements by using put(). It accepts 2 arguments one is key & a value. Source: CoolInterview.com

Answered by: Veeresh S Hampannavar | Date: 2/17/2008 | Contact Veeresh S Hampannavar Contact Veeresh S Hampannavar

Hashtable is a collection object ,is Synchronozed and it does not allow duplicate values but it allows null values. Source: CoolInterview.com

Answered by: Pavan Kumar Karicheti | Date: 3/11/2008 | Contact Pavan Kumar Karicheti Contact Pavan Kumar Karicheti

Defn: It is a data structure that associates keys with values. The primary operation it supports efficiently is a lookup: given a key (e.g. a person's name), find the corresponding value (e.g. that person's telephone number). It works by transforming the key using a hash function into a hash, a number that is used as an index in an array to locate the desired location ("bucket") where the values should be.

Feature:Hashtable is synchronized (thread-safe) and does not allow duplicate values. Source: CoolInterview.com

Answered by: explore | Date: 4/7/2008 | Contact explore Contact explore

Like Vector, Hashtable has been in from prehistoric Java times. For
fun, don?t forget to note the naming inconsistency: HashMap vs. Hashtable. Where?s
the capitalization of ?t?? Oh well, you won?t be expected to spell it. Anyway, just as
Vector is a synchronized counterpart to the sleeker, more modern ArrayList, Hashtable
is the synchronized counterpart to HashMap. Remember that you don?t synchronize a
class, so when we say that Vector and Hashtable are synchronized, we just mean that
the key methods of the class are synchronized. Another difference, though, is that
while HashMap lets you have null values as well as one null key, a Hashtable doesn?t
let you have anything that?s null. Source: CoolInterview.com

Answered by: parthiban | Date: 4/10/2008 | Contact parthiban Contact parthiban

Hashtable implements Map interface which is a collection of objects from where you can retrieve those objects with the help of key and value pair. Source: CoolInterview.com

Answered by: ramya | Date: 4/14/2008 | Contact ramya Contact ramya

HashTable is just like Hash Map,Collection having key(Unique),value pairs.
But there are two differeces between HashMap and HashTable -
1) HashTable is synchronized while HashMap is not.
2)HashMap allows one null key and multiple null values but HashTable doent allow any of them. Source: CoolInterview.com

Answered by: Payal | Date: 4/25/2008 | Contact Payal Contact Payal


If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
How can call the Session bean in to the Action class in struts?
View Answer
what is J2EE and what are the features of it?
View Answer
How can we done caching of servlet?
How can we log out from a page?
What is the difference between JspWriter & PrintWriter?
View Answer
What is the difference between application server & web server ?
View Answer
What is the difference and advantage of j2ee over java?
View Answer
how do we deploy an jsp application in tomcat?
View Answer
Can we write the code in the applet?
View Answer
What is meant by polymorphism in java?How can we achieve polymorphism?Explain with an example.
View Answer
can you tell me the steps for how to create and execute and run the Ejb simple stateless session application in websphere application server6.0 and Ide is RAD6.0
View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All J2EE Interview Questions & Answers - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.859375 Seconds