Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

From Valiveru's mock exam

 
Angela Narain
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think answer A is true.

This code will make the frame visible. However , it just displays the bar.
 
Angela Narain
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All i doubt is whether rest of the answers are CORRECT or NOT !!
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right! Hopefully we won't get questions like this in the real exam.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah right, hopefully we won't
 
Angela Narain
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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" !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic