Monday, April 16, 2012


1 . A n a l yz e t h e f ol l ow i n g c o d e : p u b l i c c l as s Te s t i m p l e m e nt s Ru n n a b l e { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] a r gs ) { T h r e a d t = n e w T h r e a d (t h i s ) ; t . s t ar t ( ) ; } p u b l i c vo i d r u n ( ) { S y s t e m . o u t. p r i nt l n (t e s t ); } }
( a) T h e p ro g ra m c om p i l e s fi n e , b u t i t d o e s n o t p r i nt any t h i n g b e c a u s e t d o e s n o t i nvo ke t h e ru n ( ) m e t h o d .
( b ) R u nt i m e E r ro r ( c ) T h e p ro g ra m d o e s n o t c om p i l e b e c au s e t h i s c an n o t b e re f e r e n c e d i n a s t a ti c m e t h o d . ( d ) T h e p ro g ra m c om p i l e s a nd r u n s fi n e an d d i s p l ay s te s t o n t h e c on s o l e .

2 . W h i ch o f th e f o l l ow i n g s t a t e m e nt i s f al s e ?
( a) A s yn ch r o n i z e d i n s ta n c e m e t h o d d o e s n t a c q u i r e a l o ck o n t h e o b j e c t f o r w h i ch th e m e t h o d wa s i nvoke d .
( b ) A s yn ch r o n i z e d i n s ta n c e m e t h o d ac q u i r e s a l o ck on th e c l a s s o f th e ob j e c t f or w h i ch t h e m e t h o d wa s i nvoke d .
( c ) A s yn ch r o n i z e d s ta t e m e nt i s p l ac e d i n s i d e a s y n ch r on i z e d b l o ck. ( d ) A s yn ch r o n i z e d s ta t e m e nt c a n b e u s e d t o a c q u i re a l o ck on a ny ob j e c t , n ot j u s t t h i s o b j e c t , w h e n e x e c u t i n g a b l o ck of t h e c o d e i n a m e t h o d .


3 . Yo u c an n o t c r e a te a b l o ck i ng q u e u e u s i n g .
( a) P r i o ri ty B l o ck i n gQ u e u e ( b ) L i n ke d B l o cki n g Q u e u e ( c ) A r r ay B l o ck i n gQ u e u e ( d ) P r i o ri ty Qu e u e

4 . W h i ch o f th e f o l l ow i n g m e t h o d s c an b e u s e d t o o bt a i n a p e rm i t f ro m a S e m ap h o re s ? ( a) d e l e t e ( ) ( b ) g e t () ( c ) a s k () ( d ) a c q u i re ()

5 . W h a t e x c e p t i on ty p e d o e s th e f o l l ow i n g p r o gr a m t h row ? p u b l i c c l as s Te s t { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] ar g s ) { O b j e c t o = nu l l ; S y s t e m . o u t. p r i nt l n (o ) ; } }
( a) N o e x c e p t i o n ( b ) S t r i n gI n d e x Ou t O f B o u n d s E x c e pt i o n ( c ) A r i t h m e t i c E x c e p t i o n ( d ) A r r ay I n d e x O u t O f B ou n d s E xc e p t i on

6 . W h a t i s d i s p l aye d o n t h e c on s o l e w h e n r u n n i n g t h e f ol l ow i n g p ro g ra m ? c l a s s Te s t { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] ar g s ) { t r y { S y s t e m . o u t. p r i nt l n (We l c om e t o J ava ); i nt i = 0 ; i nt y = 2 /i ; S y s t e m . o u t. p r i nt l n (We l c om e t o J ava ); } fi n a l l y { S y s t e m . o u t. p r i nt l n (E n d of t he b l o ck ) ; } S y s t e m . o u t. p r i nt l n (E n d of t he b l o ck ) ; } }
( a) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck .
( b ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava two t i m e s f o l l owe d by E n d o f t h e b l o ck two t i m e s .
( c ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava an d E n d o f t h e b l o ck, a n d t h e n te rm i n a t e s b e c a u s e o f an u n h an d l e d e x c e p t i o n . ( d ) T h e p r og ra m d i s p l ay s We l c o m e t o J ava t h re e t i m e s f o ll owe d by E n d o f t h e b l o ck .

7 . W h i ch o f th e f o l l ow i n g s t a t e m e nts r e g i s t e r s a p a n e l o b j e c t p a s a l i s t e n e r f o r a b u t t on va ri a b l e j b t?
( a) j b t . a d d A c t i on E ve nt Li s te n e r (p ) ; ( b ) j b t . a d d E ve nt L i s t e n e r ( p ) ;
( c ) j b t . a d d A c t i on L i s t e n e r ( p ) ; ( d ) a d d A c t i on L i s t e n e r ( p ) ;

8 . E ve r y e ve nt ob j e c t h as t h e m e t h o d .
( a) g e t W h e n ( ) ( b ) g e t A c t i on C o m m an d ( )
( c ) g e t T i m e S t am p ( )
( d ) g e t S ou r c e ( )

9 . W h i ch o f th e f o l l ow i n g s t a t e m e nt i s f al s e ?
( a) Yo u n e e d n o t al way s s p e c i f y a l i s te n e r w h e n c r e at i n g a T i m e r ob j e c t . ( b ) To s t op a ti m e r , i nvo ke t i m e r. s to p ( ) . ( c ) To s t ar t a t i m e r , i nvoke t i m e r . s t a rt ( ) . ( d ) Yo u c an ad d mu l t i p l e l i s t e n e r s f or a T i m e r ob j e c t .

1 0. S u p p o s e th a t a c o nta i n e r c u s e s a C a rd L ayo u t m a n ag e r p . W h i ch of t h e f o l l ow i n g m e th o d i s n o t va l i d ?
( a) p . l a s t (c ) ( b ) c . p . fi r s t ( ) ( c ) p . p r e v i ou s (c ) ( d ) p . n e x t ( c )

1 1. i s a S w i n g l ayou t m a n a ge r t h a t a rr a n ge s c o m p o n e nts i n a r ow o r a c o l u m n . ( a) B o r d e r L ayou t ( b ) B ox Layo u t ( c ) G r i d L ayou t ( d ) F l ow Layo u t

1 2. W h i ch o f th e f o l l ow i n g m e t h o d w i l l n ot c r e at e a Li n e B o rd e r?
( a) n e w L i n e B o r de r( C o l o r. Y E LL OW , 3 , t r u e )
( b ) B o r d e r Fa c t or y. c r e a t e L i n e B o r d e r (C ol o r . Y E L LOW )
( c ) n e w L i n e B o r de r( ) ( d ) n e w L i n e B o r de r( C o l o r. Y E LL OW , 3 )


1 3. W h i ch o f th e f o l l ow i n g s t a t e m e nt i s f al s e ?
( a) Yo u c an ad d a J M e nu t o a J Pop u p M e nu .
( b ) Yo u c an ad d a J C h e ck B ox M e nu I te m t o a J Pop u p M e nu . ( c ) Yo u c an ad d a J M e nu I t e m t o a J Po p u p M e nu . ( d ) Yo u c an ad d a J R a d i oB u tt o n M e nu I t e m to a J Po p u p M e nu .

1 4. W h i ch o f th e f o l l ow i n g s t a t e m e nt i s i n c or r e c t ?
( a) A J To ol B ar i s a G U I c o m p o n e nt, s o i t c a n b e a d d e d t o a c o nt a i n e r . ( b ) A J To ol B ar m ay b e fl oa t ab l e .
( c ) Yo u c an n o t ad d any G U I c om p o n e nt t o a J To o l B a r. ( d ) Y O u c a n s e t or i e nt at i o n o f a J To ol B ar .

1 5. W h i ch o f th e f o l l ow i n g s t a t e m e nt i s f al s e ?
( a) A l l S w i n g G U I c om p o n e nt s a r e l i g htwe i g ht .
( b ) A c ont ai n e r s u ch a s J Fr am e i s a l s o a c o m p o n e nt. ( c ) To d i s t i ng u i s h n e w S w i n g c om p o n e nt c l a s s e s f r o m t h e i r AW T c ou nt e r p a rt s , S w i n g G U I c o m p o n e nt c l as s e s ar e n a m e d w i t h a p r e fi x J . ( d ) A u s e r i nt e r f ac e o b j e c t s u ch a s (b u t t on , l i s t ) c a n a p p e a r i n o n e c ont ai n e r .

1 6. H ow m a ny f r am e s ar e d i s p l aye d ? i m p o r t j avax . s w i n g . * ; p u b l i c c l as s Te s t e xt e n d s J Fr a m e { p u b l i c s t at i c vo i d m a i n (S t r i n g[ ] ar g s ) { J Fr a m e f 1 = n e w Te s t ( ) ; J Fr a m e f 2 = n e w Te s t ( ) ; J Fr a m e f 3 = n e w Te s t ( ) ; f 1 . s e t V i s i b l e ( t r u e ) ; f 2 . s e t V i s i b l e ( t r u e ) ; f 3 . s e t V i s i b l e ( t r u e ) ; } }
( a) 3 . ( b ) 1 . ( c ) 2 . ( d ) 0 .

1 7. T h e d e f a u l t l ayou t ou t o f a J Pa n e l i s . ( a) B o r d e r L ayou t ( b ) G r i d L ayou t ( c ) F l ow Layo u t ( d ) d e f a u l t L ayou t

1 8. G i ve n a G r a p h i c s o b j e c t g, t o d r aw a p o l y go n t o c on n e c t p oi nt s ( 3 , 3) , ( 4 , 10 ) , (1 0 , 20 ), ( 2 , 10 0 ), yo u u s e
( a) g . d raw Po l yl i n e ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4 )
( b ) g . d raw Po l yg on ( n e w i nt [ ] 3, 4, 1 0 , 2 , n e w i nt[ ] 3 , 1 0, 20 , 1 0 0, 4 ) ( c ) g . d raw Po l yl i n e ( n e w i nt [ ] 3, 4, 1 0 , 2 , n e w i nt[ ] 3 , 1 0, 20 , 1 0 0, 4 ) ( d ) g . d raw Po l yg on ( 3 , 4 , 1 0, 2, 3, 10 , 2 0, 10 0 , 4 )

1 9. J L i s t fi r e s w h e n a n e w i t e m i s s e l e c t e d .
( a) j ava x. s w i n g. e ve nt . C h a n ge E ve nt
( b ) j ava x. s w i n g. e ve nt . A d j u s t m e nt E ve nt ( c ) j ava . aw t . e ve nt. I te m E ve nt ( d ) j ava . aw t . A c t i on E ve nt

2 0. W h e n c r e at i n g a s e r ve r o n a p o r t t h at i s a l re ad y i n u s e , .
( a) t h e s e r ve r i s b l o cke d u nt i l t h e p o r t i s ava i l a b l e . ( b ) t h e s e r ve r e n c ou nt e r s a f at a l e r r or an d mu s t b e te r m i n a t e d .
( c ) t h e s e r ve r i s c r e a t e d w i t h n o p ro b l e m s .
( d ) j ava . n e t . B i n d E x c e p t i o n o c c u r s .


CADDA CCDAB BCACA ACBAD

0 comments:

Post a Comment