SCJP Test - 6 - Online Test

Test Difficulty Level: Medium

Syllabus of Test

Questions based on SCJP

Sample Question from this online test:

Question: 11. ArraryList a = new ArrayList();
12. a.add(“Alpha”);
13. a.add(“Bravo”):
14. a.add(“Charlie”);
15. a.add(“Delta”);
16.Iterator iter = a.iterator();
17.
Which two, added at line 17, print the names in the ArrayList in alphabetical order?
(Choose two)
A. for (int i=0; i< a.size(); i++)
System.out.println(a.get(i)));
B. for (int i=0; i< a.size(); i++)
System.out.println(a[i]);
C. while( iter.hasNext() )
System.out.println(iter.next()) ;
D. for (int i=0, i< a.size(); i++)
System.out.println(iter[i]);
E. for (int i=0; i< a.size(); i++)
System.out.println(iter.get(i));

Option A: A, C

Option B: A, B

Option C: A, D

Option D: A, E

To answer, click the "Start This Test" button below.

Start this Test






Comments

No comment yet. Be the first to post a comment.