• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

From Valiveru's mock exam

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All i doubt is whether rest of the answers are CORRECT or NOT !!
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right! Hopefully we won't get questions like this in the real exam.
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yeah right, hopefully we won't
 
Angela Narain
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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" !!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic