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 From Valiveru's  mock exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "From Valiveru Watch "From Valiveru New topic
Author

From Valiveru's mock exam

Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Following is a question from Valiveru's exam :
Question 5.
If you want to create java GUI application using AWT, you constructed a frame calling
Frame f = new Frame();
What methods you need to call on the Frame f to make it visible.

A.f.setVisible(true);
B.f.setSize(true);
C.Both A & B
D.There is no need to call any methods on f explicitly to
make it visible.

I had answered A,
But the correct Answer is C.
Now how can that be, i have nt' come across any such method
as B ?
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I think answer A is true.

This code will make the frame visible. However , it just displays the bar.
Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
All i doubt is whether rest of the answers are CORRECT or NOT !!
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Hi Angela...
A si true since otherwise you may not see the Frame instance on the screen.
B is true, in fact as is, the invocation is wrong because setSize(boolean b) does not exist, but I think the author thought setSize(int a, int b), I don't know. But this method allows to give set the size of the Frame so that it is not 0 wide and 0 tall.
C. C is therefore true
I agree that the way this question is asked is really really ambiguous. Maybe you should let the author know the fact...
Hope it helps
Val

SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

What methods you need to call on the Frame f to make it visible.

the question is about which methods you NEED to call on the frame.
I don't think C is true because you don't HAVE to call setSize() to make the frame visible!
[This message has been edited by Mathias P.W Nilsson (edited September 07, 2001).]
[This message has been edited by Mathias P.W Nilsson (edited September 07, 2001).]
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
You're right Mathias, BUT:
Since the author thought that both A and B were true, and in fact he totally messed up B by writing something that do not even exist in the API, I don't think that the author put very much attention to the exact meaning of the words he/she was writing... Any insights ??
Val
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You're right! Hopefully we won't get questions like this in the real exam.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
yeah right, hopefully we won't
Angela Narain
Ranch Hand

Joined: Apr 14, 2001
Posts: 327
Actually i had performed "sort of good"
in the test, but seeing this answer i got surprised with my result which was not that "sort of good" !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: From Valiveru's mock exam