Collections are used for the storage of some objects. There are different types of collections, which differ by assignment and implementation. The quiz checks theoretical knowledge on the subject, as well as the main functions of implementation.
What's the difference between collections and arrays?
Collections have no fixed length
Collections can be filled with elements of any types
There's no difference
In what package are collections recorded?
java.collection
java.util
java.list
What interfaces inherit Collection?
Queue
List
None, this is the basic interface
What interfaces do inherit Collection?
Queue, List, Set
Queue, List, Set, Map
Deque, Set, Map
What does AbstractList do?
Extends the List class with abstract functions
Creates an abstract list of List type
Extends the AbstractCollection class and uses the List interface to create collections in the form of lists
What interface is designed for creating data structures in the form of a dictionary where each element has a certain key and a value?
List
Dictionary
Map
Is it possible to delete an element from a list of List type by its name?
Yes, using listname.remove("element");
Yes, using listname.delete("element");
No, it's impossible
How do you check the element presence in the List collection?
if(listname.exist("element))
if(listname.contains("element"))
if("element" exists in listname)
What will happen after code execution: listname.set(1, "Something"); ?
The first element of the listname collection will be replaced with the Something value
The second element of the listname collection will be replaced with the Something value
Between the first and second element of the listname collection the Something element will be added
How to add an elementat the start of the Deque collection?
deque.add("element");
deque.addtostart("element");
deque.push("element");
For what is LinkedList collection used?
Creating the List list with links
Uniting work functionality with the List list and Deque queue functionality
Creating the Map collection with List collection functionality
How are elements sorted in SortedSet?
Descending
Ascending
In an order set by the programmer
What's the difference between ArrayList and LinkedList?
ArrayList is a list implemented based on an array, and LinkedList is a classical linked list based on objects with links between them
ArrayList is an array with list functionality, and LinkedList is an array with list and queue functionality
ArrayList is a regular list, and LinkedList is a list with queue functionality
How does the ArrayList size change when deleting an element from it?
Decreases by one
Decreases by the size of the deleted element
Doesn't change
How do you decrease the ArrayList size after deleting an element from it then?
Using the trimToSize() command
Using the compress() command
You can't
You know the subject at Junior level
Probably, you've only started to learn collections and don't know yet everything you need. Make sure to get to the bottom of the subject and train using problems before shifting to the next subject. You'll succeed for sure! Share the quiz with friends to find out their level of knowledge :)
You know the subject at Middle level
You know how to use collections, however, more complex issues can bring you to your wit's end. We recommend you to remember your mistakes, read articles on the subject and sort out in the given examples and then solve several problems. Good luck! Share the quiz with friends to find out their level of knowledge :)
You know the subject in perfection
You easily use collections where it's necessary, use correct types and work with the already created collections. Congrats, you can safely shift to more complex subjects! Share the quiz with friends to find out their level of knowledge :)