Java was created by Patrick Naughton and James Gosling back in 1995 and it is still highly popular to this day. It is a programming language that is used to formulate algorithms as well as to help create computer programs that can apply them. Do you think you are a pro when it comes to Java? If so, test your knowledge out on the quiz below.
Q1. What is java.util.Collections?
A – An object
B – A class
C – An interface
D – None of the above
Q2. Reverse and shuffle are methods that are offered in:
A – Object
B – Collection
C – Collections
D – Apache Commons Collections
Q3. Which of the following allow for duplicate elements?
A – List
B – Set
C – All
D – None of the Above
Q4. Which of the following allows you to store null values and null keys?
A – Hashtable
B – HashMap
C – Both
D – None of the above
Q5. In a collection, what ensures type-safety?
A – Collection
B – Abstract classes
C – Generics
D – Interfaces
Q6. Which of the following is synchronized?
A – Vector
B – ArrayList
C – LinkedList
D – None of the above
Q7. Which of the following allow you to store a lot of null values?
A – Set
B – List
C – Neither
D – Both
Q8. Which of the following do not allow you to store null values?
A – LinkedHashSet
B – TreeSet
C – HashSet
D – None
Q9. What does a TreeMap implement?
A – Dictionary
B – AbstractMap
C – NavigableMap
D – HashMap
Q10. How can you remove elements from a collection?
A – Iterator
B – Enumeration
C – Both
D – None of the above
Q11. Which of the following is synchronized?
A – Hashtable
B – TreeMap
C – HashMap
D – None of the above
Q12. Which of the following will provide you with the best performance?
A – Interger
B – Double
C – String
D – All of the above
Q13. Which of the following helps to maintain insertion order?
A – Set
B – List
C – Both
D – Neither
Q14. Which of the following keywords have to be used in order to monitor exceptions?
A – Catch
B – Finally
C – Try
D – Throw
Q15. Which of the following keywords needs to be used in order to throw an exception manually?
A – Finally
B – Try
C – Catch
D – Throw
Q16. Out of the following, what uses less memory and is faster?
A – Iterator
B – Enumeration
C – ListEnumeration
D – ListIterator
Q17. How many default segments will you find in a Concurrent HashMap?
A – 32
B – 12
C – 4
D – 16
Q18. A Vector has a default capacity of what?
A – 8
B – 12
C – 10
D – 6
Q19. An ArrayList increases by how much after resizing?
A – 25%
B – 100%
C – 200%
D – 50%
Q20. How big is a long variable?
A – 32 bit
B – 16 bit
C – 8 bit
D – 4 bit
So How Did You Do?
You have finished the quiz and are now curious to see whether you really do know as much about Java as you thought. You can find the answers to all of the questions below.
Q1. B
Q2. C
Q3. A
Q4. B
Q5. C
Q6. A
Q7. D
Q8. B
Q9. C
Q10. D
Q11. A
Q12. A
Q13. B
Q14. C
Q15. D
Q16. B
Q17. A
Q18. C
Q19. D
Q20. A