Hi Sanjeet,
18) Primitive type wrapper classes:
a) Allow primitive types to behave as reference types
b) Allow operator overloading to be implemented for primitive numeric types
c) Provide string parsing and conversion methods
d) Provide arithmetic operators such as plus and minus
e) Are provided for all primitive types, including void
your answer was : a c e
-----------------------------------------------
You answer is correct. There is a Void wrapper class.
--------------------------------------------------------
21) Methods for a Component are:
a) add()
b) setbounds()
c) setVisible()
d) setEnabled()
e) addComponent()
your answer was : b d
--------------------------------------------------
The answer is b,c,d. Please refer Exam cram , it lists the methods of Component& Container. b,c, d are component methods.
a is container method & there is no method called addcomponent().
however there are container methods getComponentCount() & getComponentAt(int x, int y).
---------------------------------------------------------------
I hv a doubt with yr other question.
23) Based upon the code below, what is true about the Applet constructed?
1. public LayoutApplet ( ) {
2. setLayout(new BorderLayout());
3. setFont(new Font("Serif", Font.PLAIN, 14));
4. add(BorderLayout.NORTH, new Button("North"));
5. add(BorderLayout.SOUTH, new Button("South"));
6. add("East", new Button("East"));
7. add("West", new Button("West"));
8. add(new Button("Center"));
9. }
a) Statement 2 is ignored and the default Layout Manager for an Applet is used.
b) There is a compile error on line 6: you cannot mix the use of Strings and Constants to specify the location of components.
c) There is a compile error on line 8: the location specification via a String or Constant is not provided.
d) Five push buttons are drawn, with the largest push button in the center.
e) The code compiles successfully
your answer was d ,e.
---------------------------------------------------------------
I tried compiling & running this code.
import java.awt.*;
import java.applet.Applet;
public class Layoutapplet extends Applet {
public void init(){
setLayout(new BorderLayout());
setFont(new Font("Serif", Font.PLAIN, 14));
add(BorderLayout.NORTH, new Button("North"));
add(BorderLayout.SOUTH, new Button("South"));
add("East", new Button("East"));
add("West", new Button("West"));
add(new Button("Center"));
}
}
And I got the 4 buttons . But there is no center button which says "Center". Can you explain..?
----------------------------------------------------------------
Thanks,
Hema