Java Multiple Choice Questions & Answers – A Door to Success
Free Java courses with 37 real-time projects - Learn Java
Today, we have come with Java multiple choice questions. These Java multiple choice questions will help you to test yourself in Java Programming Language.
Answers all these java multiple choice questions and follow the link to get a better understanding.
So, let’s start Java Multiple Choice Questions. Do not miss to attempt other java quizzes as well from the series of 7 quiz on java:
- Java Quiz – 3
- Java Quiz – 4
- Java Quiz – 5
- Java Quiz – 6
Quiz Summary
0 of 19 Questions completed
Questions:
Information
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 must first complete the following:
Results
Results
0 of 19 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- Current
- Review / Skip
- Answered
- Correct
- Incorrect
- Question 1 of 19
1. Question
Iterator returned by Hashtable on key, value and entry are?
CorrectIncorrect - Question 2 of 19
2. Question
Iterator returned by ConcurrentHashMap on key, value and entry is?
CorrectIncorrect - Question 3 of 19
3. Question
Iterator returned by LinkedHashMap on key, value and entry is?
CorrectIncorrect - Question 4 of 19
4. Question
Iterator returned by TreeMap on key, value and entry is?
CorrectIncorrect - Question 5 of 19
5. Question
Iterator returned by ConcurrentSkipListMap on key, value and entry is?
CorrectIncorrect - Question 6 of 19
6. Question
Which Set implementation is sorted and synchronized?
CorrectIncorrect - Question 7 of 19
7. Question
TreeMap –
CorrectIncorrect - Question 8 of 19
8. Question
What will be the output of the following code –
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;public class MyClass
{
public static void main(String args[])
{
Map<Integer,String> hashMap = new HashMap<Integer,String>();
hashMap.put(11,”a”);
Collections.unmodifiableMap(hashMap);
hashMap.put(12,”b”);
System.out.println(hashMap);
}
}CorrectIncorrect - Question 9 of 19
9. Question
What will be the output of the following code –
import java. util.Hashtable;
import java. util.Map;
public class hashTableBlog {
public static void main (String args[])
{
Map<Integer,String> hashtable = new Hashtable<Integer,String>();
hashtable.put(11,”a”);
hashtable.put(null,”c”);
hashtable.put(null,null);System.out.println(hashtable.size());
System.out.println(hashtable);
}
}CorrectIncorrect - Question 10 of 19
10. Question
What will be the output of the following code –
import java. util.HashMap;class newEmployee
{
private String name;
public newEmployee (String name)
{
this.name = name;
}
@Override
public int hashCode()
{
return 1;
}
}class EmployeeClass
{
public static void main(String args[])
{
HashMap hm=new HashMap();
hm.put(new newEmployee(“a”),”emp1″);
hm.put(new newEmployee(“b”),”emp2″);
hm.put(new newEmployee(“a”),”emp1 overridden”);System.out.println(hm.size());
System.out.println(hm.get(new newEmployee(“a”)));
}}
CorrectIncorrect - Question 11 of 19
11. Question
What will be the output of the following code –
import java. util.HashMap;class newEmployee
{
private String name;
public newEmployee (String name)
{
this.name = name;
}
@Override
public int hashCode()
{
return 1;
}
}class EmployeeClass
{
public static void main(String args[])
{
HashMap<newEmployee,String> hm=new HashMap<newEmployee,String>();
hm.put(new newEmployee(“a”),”emp1″);
hm.put(new newEmployee(“b”),”emp2″);
hm.put(new newEmployee(“a”),”emp1 overridden”);System.out.println(hm.size());
System.out.println(hm.get(new newEmployee(“a”)));
}}
CorrectIncorrect - Question 12 of 19
12. Question
What will be the output of the following code –
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;public class MyClass
{
public static void main(String args[])
{
PriorityQueue<Integer> q = new PriorityQueue<Integer>();
q.add(1);
q.add(2);
q.add(3);
System.out.println(q.poll());
System.out.println(q.offer(4));
q.add(1);
q.remove(2);
System.out.println(q.peek());
System.out.println(q);
}
}CorrectIncorrect - Question 13 of 19
13. Question
Which Map is synchronized?
CorrectIncorrect - Question 14 of 19
14. Question
concurrentSkipListMap permits
CorrectIncorrect - Question 15 of 19
15. Question
Which of these helps insert elements at a specific position in a collection?
CorrectIncorrect - Question 16 of 19
16. Question
Complexity of ArrayList get method
CorrectIncorrect - Question 17 of 19
17. Question
Which of these is sorted by default
CorrectIncorrect - Question 18 of 19
18. Question
Which of these maintains insertion order?
CorrectIncorrect - Question 19 of 19
19. Question
Which maintains insertion order?
CorrectIncorrect
This was all about the Java Multiple Choice Questions Quiz. Hope the quiz was useful to you.
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google
Answer of below question is showing wrongly.
Iterator returned by Hashtable on key, value and entry are?
–> It should be Fail-safe because it doesn’t throw concurrentmodificationexception.
Answer given is correct
You can go through the documentation https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html
q-11 is wrong anser it should be 4(3 null)
I think the same