Welcome to the solutions for this week’s Sunday quiz! Today’s topic is data structures. If you want to participate in our weekly quizzes, make sure to follow us on Instagram. So let’s start with the Sunday Quiz Solution:
Q1 (Easy): What does FiFo stand for?
FiFo stands for “First in First out”. It is a method where the first item received is the first item to leave. IT can be applied to many use cases for example in a supermarket where the products received earlier are the ones that go off quicker.
Q2 (Easy): What organizing method does a stack use?
A stack uses the LiFo method. When an item is added to a stack it is always placed on top of the others. When an item is taken it will always receive the item at the top. That means the last item to join the stack is the first one to leave resulting in “Last in first out”
Q3 (Medium): What type of List is best for random read accesses?
The best/fastest list for random read accesses is an ArrayList. No matter which item you want to access it will return you the item in the time O(1). On the other hand, adding an item in a random place within the list is worse as it’s moving every item on the right side by one entry.
Q4 (Medium): What is special about Sets in Java?
Sets represent the mathematical “Quantity”. Every item inserted has to be unique – so no duplicates exist. This is compared to lists a special feature that can be used to one’s advantage if you only want to have unique items.
Q5 (Hard): Which methods exist for ArrayLists?
The ArrayList is a list that relies on an Array as it’s base. That’s why the correct answer is:
That was this week’s Sunday Quiz Solution. Hopefully, you have enjoyed it. If so leave us a like on our Instagram and follow for more content. If you are interested in more of such topics we recommend our blog. Here is our latest article about a Text RPG-Game