Core Java MCQ Questions – Java Online Challenge
Free Java courses with 37 real-time projects - Learn Java
Today, we will see Java MCQ part 5 from the series of 7 Java Quizzes. This part of Java MCQ contains Java multiple choice questions with their answers.
Also, bookmark other java quizzes to attempt before you appear for any java interview:
- Java Quiz – 4
- Java Quiz – 5
- Java Quiz – 6
- Java Quiz – 7
So, let’s start the Java MCQ online test.
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
In Iterator, hasMoreElements() method of Enumeration has been changed to:
CorrectIncorrect - Question 2 of 19
2. Question
TreeSet internally uses that one to store elements?
CorrectIncorrect - Question 3 of 19
3. Question
HashSet internally uses?
CorrectIncorrect - Question 4 of 19
4. Question
An attempt to add the null key to a TreeSet will result in:
CorrectIncorrect - Question 5 of 19
5. Question
TreeSet maintains which order?
CorrectIncorrect - Question 6 of 19
6. Question
Enumeration returned by ArrayList is
CorrectIncorrect - Question 7 of 19
7. Question
LinkedHashMap permits
CorrectIncorrect - Question 8 of 19
8. Question
Hashtable permits
CorrectIncorrect - Question 9 of 19
9. Question
How are you able to sort given HashMap on basis of values
CorrectIncorrect - Question 10 of 19
10. Question
The Comparator interface contains the method?
CorrectIncorrect - Question 11 of 19
11. Question
What will Collections.sort internally uses when number of elements are less than 7?
CorrectIncorrect - Question 12 of 19
12. Question
An attempt to add null key to a TreeMap will result in:
CorrectIncorrect - Question 13 of 19
13. Question
What will be the output of the following code –
import java.util.Map;
import java.util.TreeMap;public class TreeMapTest {
public static void main (String args[])
{
Map<Integer,String> m= new TreeMap<Integer,String>();
m.put(11, “audi”);
m.put(null, null);
m.put(11,”bmw”);
m.put(null,”fer”);System.out.println(m.size());
System.out.println(m);
}
}CorrectIncorrect - Question 14 of 19
14. Question
Which of those is synchronized and does not allow null elements?
CorrectIncorrect - Question 15 of 19
15. Question
Which of these is synchronised and isn’t sorted by natural order?
CorrectIncorrect - Question 16 of 19
16. Question
What will be the output of the following code –
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;public class ConcurrentSkipMapTest {
public static void main (String args[])
{
Map<Integer,String>concurrentSkipListMap= new ConcurrentSkipListMap<Integer,String>();
concurrentSkipListMap.put(11,”audi”);Iterator<Integer> keyIterator = concurrentSkipListMap.keySet().iterator();
while (keyIterator.hasNext())
{
System.out.print(keyIterator.next());
concurrentSkipListMap.put(13,”bmw”);
}
}}
CorrectIncorrect - Question 17 of 19
17. Question
What will be the output of the following code –
import java.util.EnumMap;
import java.util.Map;
public class EnumMapExample {
public enum Days
{
Monday;
}public static void main (String args[])
{
Map<Days,String> daysEnumMap = new daysEnumMap<Days,String>(Days.class);
daysEnumMap.put(Days.Monday,”Day1″);
daysEnumMap.put(Days.Tuesday,”Day2″);
System.out.println(“daysEnumMap.get(Days.Monday):”+ daysEnumMap.get(Days.Monday));
System.out.println(“daysEnumMap.containsKey(Days.Monday):”+
daysEnumMap.containsKey(Days.Tuesday)) ;
}}
CorrectIncorrect - Question 18 of 19
18. Question
What will be the output of the following code –
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;public class CopyOnWriteArrayListTest
{
public static void main (String args[])
{
List<String> copyOnWriteArrayList = new CopyOnWriteArrayList<String>();
copyOnWriteArrayList.add(” Ind “);
copyOnWriteArrayList.add(” usa “);
copyOnWriteArrayList.add(null);
for(String string : copyOnWriteArrayList)
{
System.out.print(string+””);
copyOnWriteArrayList.add(“newEle3”) ;
}
}
}CorrectIncorrect - Question 19 of 19
19. Question
In ListIterator, when a call to next() or previous(), if a call is made to set(E element) followed by add() or remove() what happens?
CorrectIncorrect
Here we come to the end of the interesting Java MCQ Online Test. Share your score and feedback in the comments section.
We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google