wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubts on Dan's mock qns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubts on Dan Watch "Doubts on Dan New topic
Author

Doubts on Dan's mock qns

Viji be
Greenhorn

Joined: Aug 16, 2004
Posts: 23
Hello All!!
I havea doubt in Dan's Mock Qns.
As far as I know about random() is that it has a value >=0.0 and lessthan 1.0.AM I RIGHT!!!
But in dan's qnn:

QN:1
class SRC117 {
public static void main (String[] args) {
double d1 = Math.random();
boolean b1 = (d1 < 0.0), b2 = (d1 <= 0.0), b3 = (d1 == 0.0);
boolean b4 = (d1 >= 0.0), b5 = (d1 < 1.0), b6 = (d1 <= 1.0);
boolean b7 = (d1 == 1.0), b8 = (d1 >= 1.0), b9 = (d1 > 1.0);
}}
Which of the boolean variables will never be initialized to the value true?
a. b1
b. b2
c. b3
d. b4
e. b5
f. b6
g. b7
h. b8
i. b9
He said that the answers are: a,g,h,i
How can a random num be <=1.0?

Is there any topic in SCJp 1.4 that deals with Enumeration.Whats this?
Dan's Qns:
QN:2
10.import java.util.*;
class GFC116 {
public static void main (String[] args) {
Object x = new Vector().elements();
System.out.print((x instanceof Enumeration)+",");
System.out.print((x instanceof Iterator)+",");
System.out.print(x instanceof ListIterator);
}}
What is the result of attempting to compile and run the program?
a. Prints: false,false,false
b. Prints: false,false,true
c. Prints: false,true,false
d. Prints: false,true,true
e. Prints: true,false,false
f. Prints: true,false,true
g. Prints: true,true,false
h. Prints: true,true,true
i. None of the above
Ans:e
Anyone plz explain me on this topic.
Qn:3
How can we represent hexa num in BYTE?How will we shift these num?
class EBH025 {
public static void main (String args[]) {
int i1 = 0xffffffff, i2 = i1 << 33;
int i3 = i1 << (33 & 0x1f);
System.out.print(Integer.toHexString(i2) + ",");
System.out.print(Integer.toHexString(i3));
}}
Ans rints: fffffffe,fffffffe
Plz explain this scenario.

Does Dan's Mock exams in http://danchisholm.net/july21/comprehensive/index.html

and the mock exam book which he refers are the same?
Is it enough if we go thru the qns in that URl?
Anyone who have taken these mock test and SCJp1.4 , reply me.
THANKS!!!


Viji
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi,

With respect to Q1: "How can a random num be <=1.0?"
Dan asks which variable will never be initialised
to true, the case of
can be interpreted as
this means that b6 will always be initialised to true because
(d1 < 1.0) is always true. it doesn't imply that random() could
ever be == 1.0

Cheers,

Gian Franco


"Eppur si muove!"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubts on Dan's mock qns