Java Collection Quiz 1 - Java Online Test | Java Question and Answers
Finish Quiz
0 of 20 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Information
Java Collection Quiz 1 – Java Online Test | Java Question and Answers. Free Java Collection Quiz, This is free online test series 1 and there are no charges for this online test. Take our Free JDBC Online Quiz – Learning JDBC in simple and easy steps using this beginner’s Online Test. Java Collection Test Quiz 1 questions and Answers 2019. Java online Test Quiz 1. Java Collection Quiz 1 Free Mock Test 2019. Java Collection Test Quiz 1 questions and Answers in PDF. The Java online mock test paper is free for all students. Java Collection Test is very useful for exam preparation and getting for Rank. Java Collection Test Quiz 1 questions and Answers in English. Java Collection Mock test for topic via Collection Mode. Here we are providing Java Collection Mock Test in English Now Test your self for “Java Collection Test in English” Exam by using below quiz…
This paper has 20 questions.
Time allowed is 25 minutes.
The Java Collection Mock Test is Very helpful for all students. Now Scroll down below n click on “Start Quiz” or “Start Test” and Test yourself.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 20 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Average score |
|
Your score |
|
Categories
- Not categorized 0%
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Answered
- Review
-
Question 1 of 20
1. Question
How do you get immutable object of a collection ? For example if you were to write an API which return a List or a Set or a Map when a method is called, but you also want that you don´t want the client of your API to add or delete any object in the returned collection ?
Correct
Incorrect
-
Question 2 of 20
2. Question
Which collection class allows you to grow or shrink its size and provides indexed access to its elements, but whose methods are not synchronized? (Choose all that apply.)
Correct
Incorrect
-
Question 3 of 20
3. Question
If you were to use a List implementation,but not sure which one to, bacause the requirement is not yet clear. In this case which List implementation will you use ?
Correct
Incorrect
-
Question 4 of 20
4. Question
Which implementation of Set would you choose if the you want the iterator of set would give you objects in the order it were inserted ?
Correct
Incorrect
-
Question 5 of 20
5. Question
Tree Set maintains which order?
Correct
Incorrect
-
Question 6 of 20
6. Question
What is the data structure that a Set uses to store its elements ?
Correct
Incorrect
-
Question 7 of 20
7. Question
which of the following are false about Collections and Collection ?
Correct
Incorrect
-
Question 8 of 20
8. Question
If you were to store objects into an implementation of List which happens only once in the entire life cycle of the product, but reading these objects inside the List implementation is quite high, then which one would you use?
Correct
Incorrect
-
Question 9 of 20
9. Question
Enumeration is an interface helps to iterate collection,but it can´t remove any element the collection it is iterating
Correct
Incorrect
-
Question 10 of 20
10. Question
What is the output of the following program ?
import java.util.HashSet;class Animal {
public int i=12;public Animal(){
i=13;
}
public String toString(){
return “Animal”+i;
}
}
public class Test {
public static void main(String [] args) throws Exception {
HashSet s= new HashSet();
s.add(new Animal());
s.add(new Animal());
for(Animal a : s){
System.out.println(a);
}
}
}Correct
Incorrect
-
Question 11 of 20
11. Question
Is Hash Map synchronized?
Correct
Incorrect
-
Question 12 of 20
12. Question
Set allows at most one null element ?
Correct
Incorrect
-
Question 13 of 20
13. Question
Is Hashtable synchronized?
Correct
Incorrect
-
Question 14 of 20
14. Question
Which of the following implementation will you use if you were to insert elements at any position in the collection ?
Correct
Incorrect
-
Question 15 of 20
15. Question
What is the output of the following program ?
import java.util.HashMap;
import java.util.Map;
public class MapTest {
public static void main(String aga[]){
Map m= new HashMap();
m.put(null, “Test”);
m.put(null,”Fest”);
System.out.println(m);
}
}Correct
Incorrect
-
Question 16 of 20
16. Question
What is the default capacity of java.util.Hash Map?
Correct
The default capacity of HashMap is 16.
Incorrect
The default capacity of HashMap is 16.
-
Question 17 of 20
17. Question
What is the output?
- import java.util.*;
- public class Test4{
- public static void main(String a[] {
- Map s = new HashMap();
- s.put(“1”,“one”);
- s.put(“3”,“three”);
- s.put(“2”,“two”);
- System.out.println(s);
- }
- }
Choose the one below:
Correct
HashMap class makes no guarantees over the iteration order;i.e it does not guarantee that the order will remain constant over time. Hence the order of retrieval changes over execution to execution.
Incorrect
HashMap class makes no guarantees over the iteration order;i.e it does not guarantee that the order will remain constant over time. Hence the order of retrieval changes over execution to execution.
-
Question 18 of 20
18. Question
What is the output?
- import java.util.*;
- public class Test4{
- public static void main(String a[]){
- Map s = new Linked Hash Map();
- s.put(“1”,“one”);
- s.put(“3”,“three”);
- s.put(“2”,“two”);
- System.out.println(s);
- }
- }
Choose the one below:
Correct
This Linked Hash Map class defines the iteration ordering, which is normally the order in which keys were inserted into the map. So for above code snippet it returns [1=one,3=three,2=two] as an output.
Incorrect
This Linked Hash Map class defines the iteration ordering, which is normally the order in which keys were inserted into the map. So for above code snippet it returns [1=one,3=three,2=two] as an output.
-
Question 19 of 20
19. Question
What is the output?
- import java.util.*;
- public class Test2{
- public static void main(String a[]{
- Map s = new Hashtable();
- s.put(null,null);
- System.out.println(s);
- }
- }
Correct
As Hash table does not allow to insert null as a key, hence if you insert null as key it will give Null Pointer Exception at run time.
Incorrect
As Hash table does not allow to insert null as a key, hence if you insert null as key it will give Null Pointer Exception at run time.
-
Question 20 of 20
20. Question
Can null value be added to a List?
Correct
Yes, it is possible to add null value to any List.
Incorrect
Yes, it is possible to add null value to any List.