• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Anyone plz do clear my doubts!!!

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 Chandrasekaran
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?



random returns a number n such that 0<=n<1 so yeah the number falls in the range <=1


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.



Enumuation is an interface returned by Vector from the elemnts method

elements

public Enumeration elements()

Returns an enumeration of the components of this vector. The returned Enumeration object will generate all items in this vector. The first item generated is the item at index 0, then the item at index 1, and so on.

Returns:
an enumeration of the components of this vector.
See Also:
Enumeration, Iterator


look at http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Enumeration.html


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


http://java.sun.com/j2se/1.4.2/docs/api/java/util/Enumeration.html
for the shift of an int only the last 5 bits and for long only the last 6 bits are considered(just mod by the number of bits).

I went through the tests in
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Enumeration.html
as well as the test that came with te book I am using (kathy and bates) as well as whizlabs. The best bet is study the basics as much as you can and do tests from different people. I did some of Dans tests, the questions are good but seem to cover only certain areas. Just study a book, then go through some of the study guide websites liten on this forum study what you missed and do as many tests as you can. Good luck
[ September 19, 2004: Message edited by: Inuka Vincit ]
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic