Monday, April 16, 2012


1 . W h i ch o f th e f o l l ow i n g e x p r e s s i on s mu s t b e tr u e i f yo u c r e a te a t h r e ad u s i n g T h r e a d = n e w T h r e ad ( o b j e c t) ?
( a) o b j e c t i n s t an c e of A p p l e t ( b ) o b j e c t i n s t an c e of Ru n n a b l e ( c ) o b j e c t i n s t an c e of Fr a m e ( d ) o b j e c t i n s t an c e of T h r e a 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 m e th o d o n a c on d i t i on s h o u l d you i nvoke to wa ke a l l wa i ti n g t h r e a d s .
( a) c o n d i t i on . s i g n al ( ) ; ( b ) c o n d i t i on . s i g n al A l l ( ) ; ( c ) c o n d i t i on . wa ke A l l ( ) ; ( d ) c o n d i t i on . wa ke ( ) ;

4 . A J ava e x c e p ti o n i s an i n s t an c e o f .
( a) T h r owa b l e ( b ) R u nt i m e E x c e p t i on ( c ) E x c e p t i o n ( d ) E r r or

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

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) 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 .
( b ) 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 .
( 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 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 .


7 . W h i ch o f th e f o l l ow i n g i s n ot a c or r e c t a s s e rt i o n s t a t e m e nt?
( a) a s s e r t ( i < 1 0) ; ( b ) a s s e r t s u m > 1 0 && s u m < 5 * 1 0 : “s um i s ” + s u m ; ( c ) a s s e r t ( i > 1 0) ; ( d ) a s s e r t “ s u m i s ” + s u m ;


8 . To ge t th e x c o o rd i n a t e o f t h e m ou s e p o i nt e r f o r t h e M o u s e E ve nt e vt , yo u u s e .
( a) e v t . ge tX Y ( ) ( b ) E ve nt . ge t Po i nt ( x , y ) ( c ) e v t . ge tX ( ) ( d ) E ve nt . ge t Po i nt ( ) . x


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) To s t ar t a t i m e r , i nvoke t i m e r . s t a rt ( ) . ( b ) 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 . ( c ) To s t op a ti m e r , i nvo ke t i m e r. s to p ( ) . ( 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. W h i ch o f th e f o l l ow i n g a r e t op - l e ve l c o nt ai n e r s (i . e . c a n n ot e e mb e d e d i n a n ot h e r c ont ai n e r) ?
( a) J A p p l e t ( b ) J Pa n e l ( c ) J D i al o g ( d ) J O p ti n Pa n e

1 1. W h i ch o f th e f o l l ow i n g a r e t h e i nval i d m e t h o d s i n J Tab b e d Pan e ?
( a) g e t Ta b b e d C o u nt( ) ( b ) g e t T i t l e At( i n d e x ) ( c ) g e t To o l T i p Te x t At (i n d e x) ( d ) g e t Ta b P l a c e m e nt ( )


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) n e w E t ch e d B o ar d e r ( ) ( b ) 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 ) ( c ) 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 ) ( d ) 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 ( )

1 3. A J C h e ck B ox M e nu I te m i s n ot a s u b c l as s o f .
( a) J M e nu ( b ) J C o m p o n e nt ( c ) J M e nu I t e m ( d ) A b s t r ac tB u t to n

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 o p t i on d i al o g ( c ) A n i n p u t d i al o g
( d ) A c on fi r m a ti o n d i a l og

1 5. W h i ch o f th e f o l l ow i n g c l a s s e s a r e n o t i n t h e j ava. aw t p ackag e ?
( a) J Fr a m e ( b ) C o l or ( c ) Fo nt ( d ) C o m p o n e nt

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 = ne w Te s t ( ) ; J Fr a m e f 2 = ne w Te s t ( ) ; J Fr a m e f 3 = ne 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) 2 . ( b ) 3 . ( c ) 0 . ( d ) 1 .

1 7. T h e m e t h o d s e t s t h e f o r e gr o u n d c o l o r t o ye l l ow i n J Fr am e f .
( a) f . s e tFor e G ro u n d ( C o l or . ye l l ow )
( b ) f . s e tFor e g r ou n d ( C o l or . ye l l ow )
( c ) s e t For e g r ou n d ( C o l or . ye l l ow )
( d ) s e t For e g r ou n d ( C o l or . Y E L L OW )

1 8. 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 ob t ai n t h e l e a d i n g , as c e nt , d e s c e nt, an d h e i ght f or a f ont f r o m a Fo nt M e t r i c s o b j e c t
. ( b ) Yo u c an c r e at e a Fo nt M e tr i c u s i n g n e w Fo nt M e tr i c s () ( c ) Yo u c an ob t ai n a Fo ntM e t ri c s f r o m a Fo nt o b j e c t u s i n g t h e g e t Fo ntM e t ri c s ( ) m e t h o d . ( d ) A f ont d e t e r m i n e s t h e f o nt m e t r i c s .

1 9. T h e c o m p o n e nt f or s t o ri n g an d h a n d l i n g d a t a, k n ow n as , c o nt ai n s t h e a c t u al c o nte nt s o f t h e c o m p on e nt .
( a) a c o ntr o l l e r ( b ) a C o nta i n e r ( c ) a m o d e l ( d ) a v i e w

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 c l a s s . U R L;
( a) S e r ve r ; ( b ) S e r ve r S o cke t ; ( c ) U R L; ( d ) S e r ve r S tr e a m ;


BABAC CDCBC AAADA BBBCC

0 comments:

Post a Comment