Author Topic:   Mock Exam quesions
JavaUser2
unregistered
posted March 07, 2000 04:20 PM           
Hi,

Can somebody please give me the answers for these?

How can you write a line of code for an applet's init() method that determines how wide the applet is?

a) int width = this.getY();
b) int width = this.getSize().w;
c) int width=getSize();
d) int width = getSize().w;
e) int width = getWidth();

2) Which statements accurately describe the following line of code?
select all valid answers.

String [][]s = new String[10][];
a) This line of code is illegal
b) s is a two dimensional array containing 10 rows and 10 columns
c) s is an array of 10 arrays
d) Each element is set to ""
e) Each element is uninitialized and must be initialized before it is referenced.

My answer for this: c,e. I don't have the actual answers

Rolf Weasel
ranch hand
posted March 07, 2000 05:28 PM             
the 10 array references are initialized to null.

maha anna
bartender
posted March 07, 2000 07:00 PM             
a)int width = this.getY(); //NO getY() returns the y coordinate
b) int width = this.getSize().w; //NO getSize() returns Dimention,but it doesn't have a field as 'w' (Dimention has got 'width' as field)
c) int width=getSize(); //NO, refer to b)
d) int width = getSize().w; //NO refer to b)
e) int width = getWidth(); //YES returns the width of the comp.
regds
maha anna.
Jim,
I saw your request in Marcus forum. Is this what you wanted to know?. Instead of < symbol put & l t ;(no space in bet) and for > symbol put & g t ( no space in bet). But in the other forum it is not displayed properly.

<PRE>


All your info typed , displayed as it is...
All your info typed , displayed as it is...
All your info typed , displayed as it is...

</PRE>

[This message has been edited by maha anna (edited March 07, 2000).]

Jim Yingst
sheriff
posted March 07, 2000 10:22 PM             
Thanks, m.a. The thing is, I know how to do that here, I just can't figure out how to do it in Marcus's forum. The software works differently there, and the & lt ; and & gt ; don't work. Also, here you can also just type "< pre >", and the spaces are enough to convince the browser that it's not an actual HTML tag, rather it's something to display. But there, everything between the "<" and ">" gets eaten.

|