</p> 6. Button three = new Button(“Three”);
" l7 g8 F& t- w# t) l/ t$ g8 G, H 7. setLayout(new FlowLayout());. N" {) X+ L3 X7 } ~+ U3 m$ X. `
8. add(one);
& i5 c4 l; V9 w5 r! C 9. add(two);
* E g: W x. R, e: u7 H: n: t 10. add(three);
! `2 s+ C( @3 C x# l 11. setSize(1000,1000);+ d, y0 k+ Q2 ^% c
12. setVisible(true);
5 X% e6 Z! h; s 13. two.setVisible(false);
, I; y& f+ E3 Z8 D$ N) { 14. }* v& r. b0 S, F, l; ]/ U U
15. public static void main(String args[]) {
) @: C; b, \ i 16. TestFrame tf = new TestFrame();5 `( M, K0 \+ ~* X6 v- x9 f9 d
17. }
) v) a! W/ r. z( b- H' f+ \$ | 18. }7 Q" D+ P8 O2 c/ @' F3 j$ l' c
Select one correct answer
$ y. h/ b+ K* j( m" y& @8 |3 [. Q, Q a. If the above code runs, the buttons - one and three are laid out in a single row from left to right with a gap in between.; F. H: r$ k6 N! X) }
b. If the above code runs, the buttons - one and three are laid out in a single row from left to right with no gap in between.
4 g( f# v0 v% X1 \) B/ v: ] c. Code does not compile - a component can not be hidden after being added to a container.; S( ?5 a% r0 _& n- ?, @ J
d. Code gets compiled successfully but throws runtime Exception - a component can not be hidden after being added to a container.
" Z& F9 _8 C# \4 Z {3 v1 g" b& [' u- x4 @. f. [* z) I
Q84.What is the result of attempting to compile and run the following piece of code?4 \9 X% q" i* U _
1. import java.awt.*;
7 A0 k1 x7 X! I a- j 2. public class TestFrame extends Frame {: N; u) I4 T# T0 {, V
3. public TestFrame() {
- a( a3 ^; K# S4 E, Y1 s5 R* V 4. CheckboxGroup chg = null;6 R0 z7 ]; |- D: d/ Z5 J
5. Checkbox ch = new Checkbox(“Test”,true,chg);3 s3 X Q( b' [5 n
6. setLayout(new FlowLayout());
: o$ X: B) C3 n3 w" `. b 7. add(ch);
" a9 ^1 c- ~" p Y 8. pack();
9 z% Z6 W- ^$ u4 p 9. setVisible(true);9 C7 D r ]3 C- v; Q' w
10. }
! q, n: Q" d0 S6 V 11.
; S/ s+ Y/ j7 ?% S T6 f 12. public static void main(String args[]) {
9 F/ o5 f3 z0 ` 13. TestFrame tf = new TestFrame();# t; u ^& \2 W K1 P
14. }
& P+ b R, @( T7 Z) V; ]3 S 15. }' v; b. o; L) N+ }
[Select one correct answer]
* k6 {7 i* y0 U* f a. It will cause a compilation error as the checkbox group is null in the constructor.9 y2 R% p; J1 U
b. It will compile successfully but throws a runtime exception because the checkbox group is null in the constructor of the check box." \3 z7 @8 J/ o1 O( B; ]" V
c. It will compile and run successfully. The checkbox appears as a single radio button which is always true1 a4 S6 \. `. O6 K' |, f
d. It will compile and run successfully. The checkbox bears its original appeareonent can not be hidden after being added to a container.
H: A; N( Y- G: `4 B% T0 n' q
6 @$ }6 U1 F; P Q84.What is the result of attempting to compile and run the following piece of code?
8 M6 e9 ]+ L3 T3 g% P a, ?0 W- p6 s0 U7 m
1. import java.awt.*; |