Question 13
Assume you need to write an implementation of a stack that has 3 public methods: push, pop, and peek.
Assume your implementation uses an array to store the elements.
Where in the array should you remove the new elements?
either way-beginning and end are equally good
neither using an array to implement a stack is a bad idea
at the beginning of the array (index O)
at the end (after the last element)
Question 14
Assume you need to write a class called Marble.
In order to be able to sort all the marbles in your collection you decide to implement the interface Comparable<T>
Which of the following code segments should you use to Implement that class?
public class Marble<Marble> implements Comparable<> (...)
public class <Marble> Marble implements Comparable<> [...]
public <Marble> class Marble<> implements Comparable<>(...)
public class Marble implements Comparable<Marble>[...]
Question 15
Here is a sentence that is supposed to describe the value that is returned by the method compareTo from the interface Comparable<T>.
The method compareTo returns as this object is less than, equal to, or greater than the specified object.
Fill in the missing part with one of the options below.
a negative integer, zero, or a positive integer
1,0, or -1
1,0, or 1
a positive Integer, zero, or a negative integer