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. |
|
| ||||
Solution - Interview Questions and Answers for 'Yahoo' - 3 question(s) found - Order By Newest | ||||
Very frequently asked across all types of companies. | ||||
| ||||
Ans. Hashtable is synchronized whereas HashMap is not.HashMap allows null values whereas Hashtable doesnt allow null values. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   collections   hashmap   map   hashtable   hashmap vs hashtable Asked in 14 Companies basic   frequent | ||||
Try 2 Question(s) Test | ||||
Related Questions | ||||
Why HashTable has been deprecated ? | ||||
Can we use null as a key for a map collection ? | ||||
What is a Property class ? | ||||
Can we add duplicate keys in a HashMap ? What will happen if we attempt to add duplicate values ? | ||||
Which interface does java.util.Hashtable implement? | ||||
Which interface does java.util.Hashtable implement ? | ||||
Which of the following is false ? | ||||
Which of the collections allows null as the key ? a. HashTable b. HashMap c. TreeMap d. LinkedHashMap | ||||
Difference between concurrentHashMap and HashTable ? | ||||
Advanced level question frequently asked in US based companies. Recently asked in EMC and Intuit. | ||||
| ||||
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 | ||||
Related Questions | ||||
Which AWS services would you use if you have find a cheapest solution for an analytics application ? | ||||
If a company comes to you with a problem statement, how would you help provide a solution for it ? | ||||
While working on a web application, you are informed that there is no new data in Database for last few hours ? How would you go about debugging this problem ? | ||||
How would you test a Twitter application ? | ||||
Can we keep application configuration at different places and what could be the consideration for choosing multiple places for doing so ? | ||||
Give an example wherein you recommended some solution that fixed the problem in a much easier way ? | ||||
| ||||
Ans. public void checkIfAnagram(String str1,String str2){ boolean anagram = true; for(char c:str1.toCharArray()){ if(!str2.contains(String.valueOf(c))){ System.out.println("Strings are Anagrams"); anagram = false; } if(anagram == true){ System.out.println("Strings are not Anagrams"); } } } | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve   check if 2 strings are Anagrams Asked in 30 Companies basic   frequent | ||||
Related Questions | ||||
Difference between == and .equals() ? | ||||
Why is String immutable in Java ? | ||||
Explain the scenerios to choose between String , StringBuilder and StringBuffer ? or What is the difference between String , StringBuilder and StringBuffer ? | ||||
What are the difference between composition and inheritance in Java? | ||||
Explain OOPs or Explain OOPs Principles or Explain OOPs Concepts or Explain OOPs features or Tell me something about OOPs | ||||
What is a Lambda Expression ? What's its use ? | ||||
Why Char array is preferred over String for storing password? | ||||
What are different ways to create String Object? Explain. | ||||
Does garbage collection guarantee that a program will not run out of memory? | ||||
What is the difference between final, finally and finalize() ? | ||||