## 1. What is a LinkedHashMap in Java?

a) A type of array
b) A type of linked list
c) A type of set
d) A hash table and linked list implementation of the Map interface

d) A hash table and linked list implementation of the Map interface

### Explanation:

LinkedHashMap is a Map implementation that maintains a linked list of the entries in the map, in the order in which they were inserted.

## 2. How does LinkedHashMap maintain the order of elements?

a) Using a hash table
b) By sorting the keys
d) Using an array

### Explanation:

LinkedHashMap maintains the insertion order of its entries through a doubly-linked list.

## 3. Can a LinkedHashMap contain duplicate keys?

a) Yes
b) No
c) Only integer keys can be duplicated
d) Only string keys can be duplicated

b) No

### Explanation:

Like any other Map implementation, LinkedHashMap cannot have duplicate keys.

## 4. What is the default initial capacity of a LinkedHashMap?

a) 8
b) 10
c) 12
d) 16

d) 16

### Explanation:

The default initial capacity of a LinkedHashMap is 16.

## 5. Which method is used to access elements in a LinkedHashMap?

a) access()
b) get()
c) retrieve()
d) find()

b) get()

### Explanation:

The get() method is used to access elements in a LinkedHashMap by their key.

## 6. Can a LinkedHashMap contain null values and null key?

a) Yes
b) No
c) Only null values, not null key
d) Only null key, not null values

a) Yes

### Explanation:

LinkedHashMap allows one null key and multiple null values.

## 7. What is the time complexity of basic operations like put and get in a LinkedHashMap?

a) O(1)
b) O(log n)
c) O(n)
d) O(n^2)

a) O(1)

### Explanation:

Basic operations like put and get have a constant time complexity in a LinkedHashMap.

## 8. How does a LinkedHashMap differ from a HashMap in Java?

### Explanation:

The main difference between LinkedHashMap and HashMap is that LinkedHashMap maintains the insertion order of entries.

## 9. How do you remove all entries from a LinkedHashMap?

a) clear()
b) removeAll()
c) empty()
d) deleteAll()

a) clear()

### Explanation:

The clear() method is used to remove all the mappings from a LinkedHashMap.

## 10. Is the iteration order over a LinkedHashMap predictable?

a) Yes, it follows insertion order
b) No, it's random
c) Yes, it follows natural ordering
d) No, it follows hash code ordering