aspose file tools
The moose likes Mock Exam Errata and the fly likes Possible error in a mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Mock Exam Errata
Reply Bookmark "Possible error in a mock exam" Watch "Possible error in a mock exam" New topic
Author

Possible error in a mock exam

Gilles Marceau
Ranch Hand

Joined: Feb 17, 2007
Posts: 78
Hello guys,

i think i have found an error i a mock exam, which can be found at this
link : http://www.javabeat.net/javabeat/scjp5/mocks/MockExam02.php
Please be nice, if i am wrong, i am just a SCJP student, not a java guru.
This is about the question 11, reproduced here :

11. Given:


1. import java.util.*;
2. public class Fruits {
3. public static void main(String [] args) {
4. Set c1 = new TreeSet();
5. Set o1 = new TreeSet();
6. bite(c1);
7. bite(o1);
8. }
9. // insert code here
10. }
11. class Citrus { }
12. class Orange extends Citrus { }

Which, inserted independently at line 9, will compile? (Choose all that apply.)

A). public static void bite(Set<?> s) { }
B). public static void bite(Set<Object> s) { }
C). public static void bite(Set<Citrus> s) { }
D). public static void bite(Set<? super Citrus> s) { }
E). public static void bite(Set<? super Orange> s) { }
F). public static void bite(Set<? extends Citrus> s) { }
G). Because of other errors in the code, none of these will compile.


The right answers should be : A, E, and F, but i tried to compile the
answers A to F, and in fact, all of them compile ! Some of them with
warning (about unchecked conversion), some others without.

By the way, many thanks to K.Sierra and B.Bates for their books (i got
Java Head First, Design Pattern in Java, and the SCJP study guide book).

Feel free to correct me if i am wrong, after all, i am here to learn.

[ February 18, 2007: Message edited by: Gilles Marceau ]

[ February 18, 2007: Message edited by: Gilles Marceau ]
[ February 18, 2007: Message edited by: Gilles Marceau ]

SCJP 1.5<br />SCJD 1.6<br />SCBCD in progress...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Possible error in a mock exam
 
Similar Threads
mixing Generics & non-generics
Doubt About Mock Exam Question?
Sierra/Bates mock for 5.0 question 11
K &B Erratum? Regarding generics
SCJP Mock Exam Question