File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Jxam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Jxam" Watch "Jxam" New topic
Author

Jxam

Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
Hi,
These questions are from Jxam mock exam and i think given answers are not correct.
Q#1
Choose the class that can hold multiple equal objects in an ordered way.
A. Map
B. Collection
C. List
D. Set
E. Vector
Given answer is 'C' but List is not a class, it is a interface. Vector is a class that implements List interface. i think answer should be 'E'.

Q#2
Given the following definition:
String s = null;

Which code fragment will cause an exception of type NullPointerException to be thrown.
A. if ((s != null) & (s.length()>0))
B. if ((s != null) && (s.length()>0))
C. if ((s != null) | (s.length()>0))
D. if ((s != null) | | (s.length()>0))
Given answer are 'A','B','C','D'. but i think 'B' is not correct ( LHS will give u false then RHS will not be executed).
Q#3
Which of the following are defined in the Object class?
A. toString()
B. equals(Object o)
C. public static void main(String arg[])
D. System.out.println()
E. wait()
given answer are 'B' and 'E'. what is wrong with 'A'?
please do verify.
vivek
[This message has been edited by Vivek Shrivastava (edited August 05, 2000).]
[This message has been edited by Vivek Shrivastava (edited August 06, 2000).]
Gopinath Rajgopal
Ranch Hand

Joined: Jun 26, 2000
Posts: 31
Vivek,
I agree with you.....
1. List is an interface and not a class.
2. Yes, the boolean expression short circuits if s is null
3. toString() is a method in Object class.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Q#1 :The elements in vector are not ordered. If they just say List class, the only List class we have is java.awt.List.Probably, the question should be rephrased.
Q#2 : you are right.
Q#3 : you are right.

[This message has been edited by vasansrini (edited August 05, 2000).]
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Vivek,
Why do you think that the answer to question 1 should be 'D'.
Even Set is an interface.
In fact except Vector, all the other possible alternatives are interfaces.
Rgds,
Shashank
KN
Ranch Hand

Joined: Aug 13, 2000
Posts: 66
Shashank,
You are right. Set is also an interface but it can't have equal objects ( which is mentioned in the question 1). It stores unique objects.
Thanks,
Kiran.
Vivek Shrivastava
Ranch Hand

Joined: Jun 03, 2000
Posts: 277
That was typo. i have edited my first posting.
vivek
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jxam