File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Mock Exam Errata and the fly likes Urgent !! solve my problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Mock Exam Errata
Bookmark "Urgent !! solve my problems" Watch "Urgent !! solve my problems" New topic
Author

Urgent !! solve my problems

Karthikeyans
Greenhorn

Joined: May 24, 2001
Posts: 1
Can u please help me to find the corrcet answers fro the folowing
(A)
consider the following
1.public Object methoda()
{
2.Object o=new Object();
3.Object o1[]=new Object[1];
4.o1[0]=o;
5.o=null;
6.o=new Object();
7.o1[0]=null;
8.return o1[0];
}
when will the object o referenced earlier was
available for garbage collector.
a) just after line 4
b) just after line 5
c) just after line 6
d) just after line 7
e) never in this method
---------------------------------
(B)which will be used to encode chars for output
a) java.io.outputStream
b) java.io.OutputStreamWriter
c) java.io.encodedoutputwriter
d) java.io.encodedwriter
e) java.io.BufferedOutputStream
-----------------------------------
(C)
Which layout has to be used in the Panel if the
Panel has textArea Label, button vertically in a window and You want to
Increase the Height of textArea vertically?
------------------------------------
(D)
byte[] A,B[];
byte C[][],D[][];
byte[][] E;
Which of these will cause an Error?
P) A=B;
Q) B=C;
R) C=D;
S) Both P and Q;
T) Both R and S;

-------------------------
(E)
In a Panel a TextArea in the top and below it
Label another Button is added below the Label. Which
Layout is prefeered so that the TextArea occupies the
entire vertical free space when the Panel is resized?.
Options Given are
1)GridBagLayout
2)GridLayout
3)FlowLayout
4)BorderLayout
---------------------------------
(F)
In a Panel a TextArea in the top and below it
Label another Button is added below the Label. Which
Layout is prefeered so that the TextArea occupies the
entire vertical free space when the Panel is resized?.
Options Given are
1)GridBagLayout
2)GridLayout
3)FlowLayout
4)BorderLayout
-------------------------
(G)
class demo implements Runnable{
int i;
Thread t;
public demo(int d){
i=d;
}
public void run()
{
try{
Thread.sleep(50000);
}catch(InterruptedException e){}
}
}
class test1{
public static void main(String args[]){
demo d=new demo(5);
Thread t=new Thread(d);
t.start();
//
System.out.println(d.i);
}
}
56
Which of the following methods can reasonably put in
the commented line above to print the value 5?.
Given Options
t.wait()
t.notify()
t.join()
t.yield()
---------------------------------
Which of the following method will return degree
value"?.
Given Options
Math.cos(Math.toDegrees(42))
Math.cos(Math.toRadians(42))
Math.cosine(42)

chitra ratnawat
Greenhorn

Joined: May 24, 2001
Posts: 6
answers to your questions are
A answer is b just after line 5 :becauge when a object o is assigned null value earlier referenced will be garbage collected
B I dont know
C gridbaglayout because you can change the size of the cell in which textarea is placed.
D answer is T: becauge arrays are not initialised just reference variables of type array are declared and you can not equate reference variables.
E answer is b gridLayout : place the items vertically by choosing (3,1)grid.so when u will place textarea in the first row first column it will access the whole vertical range of first cell when panel is resized.
F is repeated by you(E)
G answer d: t.yield()
last ques. no answer is correct
in case1 Math.cos(Math.toDegrees(42)) will give cosign of degree angle return by Math.toDegrees(42)
in case2 it will return cosine of Radian angle
in case3 there is no such mathod in Math class
Math.cosine(42) is wrong
I hope it may help you
if answers are different than please send me the correct answers
chitra
[This message has been edited by chitra ratnawat (edited May 25, 2001).]
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Karthikeyans ..
(A) after line 7. Line 4 references the original object created in line 2. Line 5 sets the original reference to null; but as line 4 set also set a reference the object is still being pointed to. Line 7 sets the line 4 reference to null; net result, the original object is no longer being referenced and is therefore eligible for gc.
Hope that helps. In future, please post one question per thread; it's difficult keeping track of multiple questions in one thread.
Please read the JavaRanch Name Policy and re-register using a name that complies with the rules.
Thanks for your cooperation.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
 
subject: Urgent !! solve my problems
 
Similar Threads
Error!!!
about Layout Manager
Layout...
About GridLayout