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!!!