Interview Questions and Answers for 'Map' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

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.
Label / Company      Label / Company / Text

   



Interview Questions and Answers - Order By Newest

   next 30
 Q31. Can value be null in TreeMap ?Core Java
Ans. Yes.

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

   Like         Discuss         Correct / Improve     java   collections   treemap   yes-no


 Q32. Which interface TreeMap implements ?
Ans. TreeMap implements NavigableMap, SortedMap, Serializable and Clonable.

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

   Like         Discuss         Correct / Improve     java   collections   treemap


 Q33. How is HashSet maintained in memory by Java ?Core Java
Ans. HashSet is maintained as HashMap by Java with values of the HashSet as Keys of the HashMap and value of the HashMap as the constant PRESENT.

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

   Like         Discuss         Correct / Improve     ebay  java   collections   hashset   hashmap      expert


 Q34. Name few Collections Map implementations ?
Ans. AbstractMap
ConcurrentHashMap
ConcurrentSkipListMap
EnumMap
HashMap
IdentityHashMap
LinkedHashMap
SystemFlavorMap
TreeMap
WeakHashMap

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

   Like         Discuss         Correct / Improve     java   collections   map


 Q35. How do we specify the criteria if it involves mapping between two entities or join between tables ?Hibernate
Ans. The following code returns the list of Employee objects having employee name starting with A and Dept Name ( Department , Employee Mapped ).

session.createCriteria(Employee.class,"emp")
.createAlias("emp.department", "dept",Criteria.INNER_JOIN)
.add( Restrictions.like("name", "A%") )
.add(Restrictions.eq("dept.name","Finance")
.list();

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

   Like         Discuss         Correct / Improve     hibernate   hibernate criteria   hibernate table mapping


 Q36. Name few classes that implement Map interface ?
Ans. http://www.buggybread.com/2015/02/java-collections-classes-that-implement_82.html

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

   Like         Discuss         Correct / Improve     java   collections   map


 Q37. Difference between HashMap and WeakHashMap ?
Ans. WeakHashMap uses weak reference for keys, which means if the key object doesn't have any reference then both key/value mapping will become eligible for garbage collection.

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

   Like         Discuss         Correct / Improve     java   collections   hashmap   weakhashmap   difference between   garbage collection   ebay


 Q38. Which tree is used to implement TreeMap in Java?
Ans. Red Black Tree

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

   Like         Discuss         Correct / Improve     java   collections   treemap   map      expert


 Q39. If we add Enum constants to a sorted collection ( Treemap , TreeSet ), What will be the order in which they will be maintained ?

a. Sorted Collection wont maintain them in any order.
b. Insertion Order
c. Order in which constants are declared.
d. Natural Sorting Order.
Ans. Order in which constants are declared.

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

   Like         Discuss         Correct / Improve     enum   collections   sorted collections   treemap   treeset   compareto   comparable   java


 Q40. Which of the following is false ?

a. HashMap came before HashTable.
b. HashMap allows null values whereas Hashtable doesn’t allow null values.
c. HashTable and HashMap allow Key-Value pairs.
d. Hashtable is synchronized whereas HashMap is not.
Ans. HashMap came before HashTable.

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

   Like         Discuss         Correct / Improve     map   hashmap   hashtable   collection   java

Try 2 Question(s) Test


 Q41. Which of the collections allows null as the key ?

a. HashTable
b. HashMap
c. TreeMap
d. LinkedHashMap
Core Java
Ans. HashMap

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

   Like         Discuss         Correct / Improve     java   collections   map  hashtable     Asked in 2 Companies      basic        frequent


 Q42. Effective Java 6 , TreeMap implements ...

a. Map Interface
b. SortedMap Interface
c. NavigableMap Interface
d. SortedNavigableMap Interface
Ans. SortedMap Interface

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

   Like         Discuss         Correct / Improve     java   collections   map


 Q43. Which of the following is a valid flow in Hadoop ?

a. Input -> Reducer -> Mapper -> Combiner -> -> Output
b. Input -> Mapper -> Reducer -> Combiner -> Output
c. Input -> Mapper -> Combiner -> Reducer -> Output
d. Input -> Reducer -> Combiner -> Mapper -> Output
Ans. Input -> Mapper -> Combiner -> Reducer -> Output

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

   Like         Discuss         Correct / Improve     hadoop   map reduce


 Q44. MapReduce was devised by ...

a. Apple
b. Google
c. Microsoft
d. Samsung
Ans. Google

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

   Like         Discuss         Correct / Improve     hadoop   map reduce


 Q45. Which of the following is not a phase of Reducer ?

a. Map
b. Reduce
c. Shuffle
d. Sort
Ans. Map

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

   Like         Discuss         Correct / Improve     hadoop   map reduce


 Q46. What is the input to the Reduce function ?

a. One Key and One Value
b. Multiple Keys and Multiple associated Values
c. Multiple Keys and One associated values with each
d. One key and associated values.
Ans. One key and associated values.

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

   Like         Discuss         Correct / Improve     hadoop   bigdata   big data   map-reduce   map reduce   reduce function


 Q47. Which of the following is the implementation language for Map Reduce Framework ?

a. Big Data
b. Hadoop
c. Java
d. C++
Ans. Java

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

   Like         Discuss         Correct / Improve     hadoop   bigdata   big data   map-reduce   map reduce framework


Recently asked in Sophos
 Q48. Write a Method to get a map of words and their count by passing in the stringCore Java
Ans. http://javasearch.buggybread.com/CodeSnippets/searchCodeSamples.php?keyword=Method+to+get+a+map+of+words&category=code

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

   Like         Discuss         Correct / Improve     map  collections     Asked in 2 Companies      intermediate


 Q49. What is unmodifiable set / unmodifiable map ? How can we create one ?
Ans. It is an unmodifiable / read only view of the underlying collection. We can use

Collections.unmodifiableSet(Set set)
Collections.unmodifiableMap(Map map)
Collections.unmodifiableCollection(Collection collection)

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

   Like         Discuss         Correct / Improve     collections  set  unmodifiable set  map  unmodifiable map  unmodifiablemap  unmodifiableset  Collections.unmodifiableCollection  Collections.unmodifiableMap  Collections.unmodifiableSet


 Q50. What is IdentityHashMap ?Core Java
Ans. IdentityHashMap is a class that implements AbstractMap and provides a data structure with Elements having Key Value pair, just like HashMap. It is similar to HashMap except that it uses reference equality when comparing elements.

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

   Like         Discuss         Correct / Improve     IdentityHashMap  map  hashmap  collections


 Q51. What is the difference between filter and filter-mappings xml tag within deployment descriptor ?Java EE
Ans. filter tag speficies the filter name and respective class for handling filter action whereas filter mapping maps the filter to the url patterns ( specifying the url that needs to be intercepted )

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

   Like         Discuss         Correct / Improve     deployment descriptor  web.xml  filters  filter mapping


 Q52. Difference between concurrentHashMap and HashTable ?Core Java
Ans. HashTable locks the complete collection to provide synchronization whereas ConcurrentHashMap only locks segments to achieve synchronization and hence better efficient and faster.

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

   Like         Discuss         Correct / Improve     concurrentHashMap  HashTable  Map  Collections     Asked in 2 Companies


 Q53. isnt the use of HashTable and ConcurrentHashMap the same, i.e providing synchronized map collection ?Core Java
Ans. Yes, they both aim at providing synchronized access to the Map collection. The only difference is in their implementation. ConcurrentHashMap came after HashTable and hence technically more efficient as it doesn't lock the complete map while accessing it.

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

   Like         Discuss         Correct / Improve     HashTable  ConcurrentHashMap  map  Collections


 Q54. Difference between Mutex and Semaphore? Operating System
 This question was recently asked at 'Veritas'.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     Mutex vs Semaphore     Asked in 1 Companies


 Q55. What is the difference between CountingSemaphore and a CountDownLatch?Operating System
 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     CountingSemaphore  CountDownLatch


 Q56. What is the difference between Java SE Map and Apache Commons MultiMap ? How can we implement functionality similar to multimap using Java SE map ?Core Java
Ans. We can have duplicate keys within MultiMap whereas we cannot have duplicate keys within Java Util Map.

We can have a Map with value as a "collection of values" instead of single value to have a similar function as Multimap.

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

   Like         Discuss         Correct / Improve     Apache commons multimap  map vs multimap


 Q57. If a Map needs to be accessed simultaneously by multiple threads, which collection class should be used ? Core Java
Ans. ConcurrentHashMap

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

   Like         Discuss         Correct / Improve     map  concurrenthashmap  multithreading


 Q58. Create a custom hashmap using synchronization.Core Java
 This question was recently asked at 'Deutsche Bank'.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     hashmap  coding     Asked in 1 Companies      advanced


 Q59. What is the difference between TreeSet and TreeMap ?Core Java
Ans. TreeSet contains only values as elements whereas TreeMap contains Key value pairs.

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

   Like         Discuss         Correct / Improve     reeMap  TreeSet  Collections  sorted collection     Asked in 1 Companies        rare


 Q60. How to sort objects based on one of the field ?Core Java
Ans. Using comparable and comparator and sorted collections like TreeSet or TreeMap.

or

use stream api from java 8 onwards which internally refers to comparable and comparator through lambda expressions

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

   Like         Discuss         Correct / Improve     sort  sorting  comprator  comparable  treeset  treemap  sorting collections     Asked in 1 Companies      Basic        frequent


previous 30   next 30

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: