Monday, April 16, 2012

1 . T h e f o l low i n g m e t h o d i n t h e T h r e a d c l a s s i s n o t d e p r e c a t e d :
( a) r e s u m e ( ) ; ( b ) s t o p () ; ( c ) s u s p e n d ( ); ( d ) y i e l d ( )

2 . S u p p o s e t h e r e ar e t h r e e Ru n n a b l e t a s k s , t as k 1 , t as k 2 , t as k 3 . H ow do yo u r u n t h e m i n a t h r e ad p o ol w i t h 2 fi xe d t h r e ad s ?
( a) E x e c u t o rS e rv i c e e xe c u to r = E x e c u t o rs . n e w F i x e d T h r e a d Po ol ( 2) ; e x e c u to r . e x e c u t e ( t as k 1 ) ; e xe c u - t or . e x e c u t e ( t a s k 2) ; e xe c u to r . e x e c u t e ( t as k3 ) ; ( b ) n e w T h r e ad ( t a s k 1) . s t a rt ( ) ; n e w T h r e a d (t a s k 2) . s t a rt ( ) ; n e w T h r e a d (t a s k 3) . s t a r t( ) ; ( c ) E x e c u t o rS e rv i c e e xe c u to r = E x e c u t o r s . n e w F i x e d T h r e a d Po ol ( 1) ; e x e c u to r . e x e c u t e ( t as k 1 ) ; e xe c u - t or . e x e c u t e ( t a s k 2) ; e xe c u to r . e x e c u t e ( t as k3 ) ; ( d ) E x e c u t o rS e rv i c e e xe c u to r = E x e c u t o r s . n e w F i x e d T h r e a d Po ol ( 3) ; e x e c u to r . e x e c u t e ( t as k 1 ) ; e xe c u - t or . e x e c u t e ( t a s k 2) ; e xe c u to r . e x e c u t e ( t as k3 ) ;

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) a b l o ck in g q u e u e h a s a c a p ac i ty.
( b ) T h e B l o ck i n gQ u e u e i nt e r f a c e i s t h e d e r i ve d i nt e r f a c e f o r al l c on c re te b l o cki n g q u e u e c l a s s e s . ( c ) A b l o ck i n g q u e u e c au s e s a t h r e ad t o b l o ck w h e n you t ry to a d d a n e l e m e nt t o a f u l l q u e u e . ( d ) A b l o ck i n g q u e u e c au s e s a t h r e a d t o b l o ck w h e n you t ry to r e m ove an e l e m e nt f r o m a n e m p ty q u e u e .

4 . A n i n s t an c e o f d e s c ri b e s p r o gr a m m i n g e r r or s , s u ch as b ad c a s t i n g, a c c e s s i n g an ou t - of - b o un d s a r ray, an d nu m e r i c e r r o rs .
( a) R u nt i m e E x c e p t i on ( b ) T h r owa b l e ( c ) E r r or ( d ) E x c e p t i o n

5 . A m e th o d mu s t d e c l a re t o t h row .
( a) ch e cke d e x c e p ti o n s ( b ) u n ch e cke d e x c e p ti o n s ( c ) E r r or ( d ) R u nt i m e E x c e p t i on

6 . W h i ch o f th e f o l l ow i n g i s n ot an a d va nt ag e o f J ava e x c e p ti o n h a n d l i n g?
( a) J ava s e p a r at e s e x c e p t i on h an d l i n g f r o m n o r m al p r o c e s s i n g t as k s .
( b ) E x c e p t i o n h a n d l i n g m ake s i t p os s i b l e f or t h e c a l l e r’ s c a l l e r t o h a n d l e t h e e xc e p t i on .
( c ) E x c e p t i o n h a n d l i n g i m p rove s p e r f o r m an c e .
( d ) E x c e p t i o n h an d l i n g s i m p l i fi e s p r og r am m i n g b e c a u s e t h e e r r or - re p or t i n g a n d e r r or - h a n d l i n g c o d e c an b e p l a c e d a t t h e c a t ch b l o ck .

7 . W h i ch o f th e f o l l ow i n g i s f a l s e ?
( a) E x c e p t i o n h a n d l i n g d e a l s w i t h u nu s u a l c i r c u m s ta n c e s d u r i n g p r og r am e x e c u t i o n . A s s e r t i on s a r e i nt e n d e d t o e n s u r e t h e c o r re c t n e s s of t h e p r og r am .
( b ) U s e as s e r t i on s t o re affi r m a s s u m p t i o n s .
( c ) u s e as s e r t i on s f o r ar g u m e nt ch e ck i n g i n p u b l i c m e t ho d s . ( d ) E x c e p t i o n h a n d l i n g ad d r e s s e s r o b u s t n e s s w h e r e a s a s s e r t i o n a d d re s s e s c o rr e c tn e s s .

8 . T h e m e t h o d i n t h e A c t i on E ve nt r e t u r n s t h e a c t i o n c o m m an d of t h e b u t t on . ( a) g e t I D ()
( b ) g e t M o d i fi e r s ( )
( c ) p a ra m S t ri n g ( )
( d ) g e t A c t i on C o m m an d ( )

9 . To ch e ck w h e t h e r a D E L E T E ke y i s p re s s e d or r e l e as e d , w h i ch h a n d l e r s h ou l d b e u s e d ?
( a) ke y I n ac ti ve ( K e y E ve nt e )
( b ) ke y Re l e as e d (K e y E ve nt e ) ( c ) ke y A c t i ve ( K e yE ve nt e ) ( d ) ke y Typ e d (K e y E ve nt e )

1 0. W h i ch o f th e f o l l ow i n g p r o p e r ti e s a r e i n G r i d Layo u t ?
( a) l ayo u t ( b ) h g ap ( c ) a l i gn m e nt ( d ) v i s i b l e

1 1. E ve r y l ayo u t m an a ge r i s a n i n s ta n c e of .
( a) t h e L ayo u tM an a ge r c l a s s ( b ) t h e L ayo u t i nte rf ac e
( c ) t h e L ayo u tM an a ge r i nte rf ac e ( d ) t h e L ayo u t c l a s s



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 an E t ch e d B o r d e r?
( a) B o r d e r Fa c t or y. c r e a t e E t ch e d B or d e r ( C ol o r . Y E L L OW , C ol o r . RE D )
( b ) n e w E t ch e d B o ar d e r ( )
( c ) B o r d e r Fa c t or y. c r e a t e E t ch e d B or d e r ( ) ( d ) n e w E t ch e d B o r d e r (C ol o r . Y E L LOW , C o l o r. R E D )


1 3. Yo u c an n o t s e t a m n e m on i c p r op e r ty o n .
( a) a J m e nu B a r ( b ) a J M e nu I t e m ( c ) a J R ad i o B u t t on M e nu I te m
( d ) a J C h e ck B ox M e nu I t e m

1 4. a s k s a q u e s t i o n a n d r e q u i r e s t h e u s e r t o r e s p o n d w i th an ap p r o p ri a t e b u t t on .
( a) A m e s s a ge d i al o g ( b ) A n i n p u t d i al o g
( c ) A c on fi r m a ti o n d i a l og ( d ) A n o p t i on d i al o g

1 5. W h i ch o f th e f o l l ow i n g a r e s u b c l as s e s of j ava. aw t . C om p on e nt ?
( a) S w i n g u s e r i nt e r f a c e c l a s s e s
( b ) H e l p e r c l a s s e s s u ch a s C ol o r a n d Fo nt ( c ) A l l U t i l i ty c l a s s e s ( d ) L ayou t m an a ge r s

1 6. 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 or p l a c i n g t h e f ra m e ’ s u p p e r l e f t c o rn e r t o (2 0 0, 1 0 0) ?
( a) f r a m e . s e t L o c at i o n (1 0 0, 20 0) ( b ) f r a m e . s e t L o c at i o n (1 0 0, 10 0)
( c ) f r a m e . s e t L o c at i o n (2 0 0, 10 0) ( d ) f r a m e . s e t L o c at i o n (2 0 0, 20 0)


1 7. T h e m e t h o d s e t s t h e f o nt ( H e l ve ti c a, 20 - p o i nt b o l d ) i n c o m p o n e nt C .
( a) c . s e tFont ( n e w Font ( ”H e l ve t i c a ” , Fo nt. B OL D , 2 0 ))
( b ) c . s e tFont ( n e w Font ( ”h e l ve t i c a ”, B O L D, 20 ) ) ( c ) c . s e tFont ( Fo nt( ” H e l ve ti c a” , Font . B O L D, 20 ) ) ( d ) c . s e tFont ( n e w Font ( ”H e l ve t i c a ” , Fo nt. b ol d , 20 ) )

1 8. G i ve n a G r ap h i c s ob j e c t g, to d r aw a l i n e f r om t h e u p p e r l e f t c o rn e r t o th e b o tt o m r i g ht c or n e r , yo u u s e
( a) g . d raw L i n e ( 0, 0, ge t W i d t h ( ) , ge tW i d t h ( ) )
( b ) g . d raw L i n e ( 0, 0, ge t H e i g ht () , ge t H e i g ht( ) )
( c ) g . d raw L i n e ( 0, 0, 10 0, 10 0 )
( d ) g . d raw L i n e ( 0, 0, ge t W i d t h ( ) , ge tH e i ght ( ))

1 9. J C o mb oB ox 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 . A c t i on E ve nt ( d ) j ava . aw t . I t e m E ve nt

2 0. To c r e at e an I n p u t S tr e a m t o r e a d f r o m a fi l e o n a We b s e r ve r , yo u u s e t h e m e t h o d i n t h e U RL c l as s .
( a) o b ta i n I n p u t S t re am ( ) ; ( b ) c o n n e c t S t re am ( ) ; ( c ) o p e n S t r e am ( ) ; ( d ) g e t I n p u t S tr e a m ( );

DABAA CCDBB ABACA CADCC

0 comments:

Post a Comment