Java - Collections - Interview Questions and Answers on Iterator

Q1.  What is an Iterator?

Ans. Iterator is an interface that provides methods to iterate over any Collection. 

Q2.  What is a Cursor ?

Ans. It's a facility that allows traversal over the records pulled from a table or combination of tables. Its like iterator in Java.

Q3.  What is CopyOnWriteArrayList ?

Ans. Its a type of ArrayList in which all Write operations , i.e add and set are performed by creating a new copy. This array never changes during the lifetime of the iterator, so it never throws ConcurrentModificationException

Q4. Iterator is a / an ...

 a.Abstract Class
 b.Concrete Class
 c.Interface
 d.Package

Ans.Interface