1 . The following method in the Thread class is not deprecated :
( a) y i e l d ( )
( b ) s u s p e n d ( );
( c ) r e s u m e ( ) ;
( d ) s t o p () ;
2 . W h i ch o f th e f o l l ow i n g m e t h o d i s a s t at i c i n j ava . l an g . T h r e a d ?
( a) s l e e p (l o n g)
( b ) r u n ( )
( c ) s t a rt ( )
( d ) j o i n ( )
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) O n c e yo u i nvo ke t h e awai t m e t h o d o n a c on d i t i on , th e l o ck i s a u to m at i c a l l y re l e as e d . O n c e t h e c o n d i t i on i s r i ght , t h e th r e a d r e - ac q u i r e s t h e l o ck a n d c o nti nu e s e x e c u t i n g .
( b ) A c on d i t i o n i s a s s o c ia t e d w i th a l o ck.
( c ) To i nvoke m e t h o d s o n a c o n d i ti o n , t h e l o ck mu s t b e ob t a i n e d fi r s t .
( d ) T h e s i g n al m e th o d on a c on d i t i o n c a u s e s t h e l o ck f o r t h e c on d i t i on t o b e r e l e as e d.
4 . T h e f o l l ow i n g c o d e c au s e s J ava t o t h row . i nt nu mb e r = I nt e g e r . M A X VA L U E + 1 ;
( a) E x c e p t i o n
( b ) R u nt i m e E x c e p t i on
( c ) E r r or
( d ) N o E x c e p t i o n s
5 . A n a l yz e t h e f ol l ow i n g p r og r am . 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 t r i n g s = ” 5. 6 ”; I nt e g e r . p ar s e I nt ( s ) ; / / C a u s e a N u mb e rFor m a t E x c e p t i o n 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 ” ); } c a t ch ( E x c e p t i on e x ) { S y s t e m . o u t. p r i nt l n (e x) ; } } }
( a) A n e xc e p t i on i s r ai s e d d u e t o 2 / i ;
( b ) T h e p r og ra m c om p i l e s a n d r u n s w i t h o u t e x c e p t i o n s .
( c ) T h e p r og ra m h a s a c om p i l a t i on e r ro r .
( d ) A n e xc e p t i on i s r ai s e d d u e t o I nte ge r . p a rs e I nt (s );
6 . W h a t i s w ro n g i n t h e f ol l ow i n g p r og r am ? 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 ri n g [ ] a r gs ) { 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 ” ); } } }
( a) Yo u c an n o t h ave a t r y b l o ck w i t h o u t a c a tch b l o ck or a fi n a l l y b l o ck .
( b ) A m e th o d c al l th a t d o e s n ot d e c l ar e e x c e p t i o ns c a n n ot b e p l a c e d i n s i d e a t r y b l o ck .
( c ) N o th i n g i s w r o ng .
( d ) Yo u c an n o t h ave a t r y b l o ck w i t h o u t a c a tch b l o ck .
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 s u m > 1 0 && s u m < 5 * 1 0 : “s um i s ” + s u m ;
( b ) a s s e r t ( i < 1 0) ;
( c ) a s s e r t “ s u m i s ” + s u m ;
( d ) a s s e r t ( i > 1 0) ;
8 . To b e a l i s te ne r f o r A c t i on E ve nt , a n o b j e c t mu s t b e an i n s t an c e o f .
( a) W i n d ow Li s te n e r
( b ) A c t i o n E ve nt
( c ) E ve nt Ob j e c t
( d ) A c t i o n Li s te n e r
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 A c t i ve ( K e yE ve nt e )
( b ) ke y Typ e d (K e y E ve nt e )
( c ) ke y Re l e as e d (K e y E ve nt e )
( d ) ke y I n ac ti ve ( 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 i n j ava. aw t . C om p o n e nt m ay e ff e c t l ayou t ?
( a) p r e f e r r e d S i z e
( b ) b a ckg r ou n d
( c ) f o r e gr o u n d
( d ) f o nt
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 T i t l e At( i n d e x )
( b ) g e t Ta b b e d C o u nt( )
( 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 r d e r (C ol o r . Y E L LOW , C o l o r. R E D )
( 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 ) n e w E t ch e d B o ar d e r ( )
( 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 ( C ol o r . Y E L L OW , C ol o r . RE D )
1 3. i s th e a c t i on t h a t c a u s e s a p o p u p m e nu t o b e d i s p l aye d .
( a) Po p u p r e a c ti o n
( b ) Po p u p e ve nt
( c ) Po p u p t r i gg e r
( d ) Po p u p a c t io n
1 4. a l l ow s yo u t o c r e a t e c u s to m b u t t on s .
( a) A n o p t i on d i al o g
( b ) A m e s s a ge 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
15. 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) 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
( b ) L ayou t m an a ge r s
( c ) S w i n g u s e r i nt e r f a c e c l a s s e s
( d ) A l l U t i l i ty c l a s s e s
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) 1 .
( b ) 0 .
( c ) 2 .
( d ) 3 .
1 7. To s p e c i f y a f ont t o b e b o l d a n d i t al i c , u s e t h e f o nt s tyl e va l u e
( a) Fo nt . I TA L I C
( b ) Fo nt . B O LD
( c ) Fo nt . P L A I N
( d ) Fo nt . B O LD + Fo nt . I TA L I C
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 n c i r c l e w i t h r ad i u s 2 0 c e nte re d a t ( 50 , 5 0) , yo u u s e
( a) g . d raw O val ( 5 0, 50 , 2 0 , 20 )
( b ) g . d raw O val ( 3 0, 30 , 2 0 , 2 0)
( c ) g . d raw O val ( 3 0, 30 , 4 0 , 40 )
( d ) g . d raw O val ( 5 0, 50 , 4 0 , 4 0)
1 9. A l i s te n e r o f a J L i s t mu s t im p l e m e nt .
( a) j ava x. s w i n g. e ve nt . A d j u s t m e nt L i s t e n e r
( b ) t h e j ava . aw t . A c t i o n L i s t e n e r i nt e r f ac e
( c ) j ava x. s w i n g. e ve nt . C h a n ge L i s t e n e r
( d ) t h e j ava . aw t . I t e m L i s t e n e r i nte rf ac e
2 0. T h e s e r ve r l i s t e n s f or a c on n e c t i on r e q u e s t f r om a c l i e nt u s i n g t h e f ol l ow i n g s t at e m e nt :
( a) S o cke t s = n e w S o cke t( S e r ve r N am e , p o rt ) ;
( b ) S o cke t s = s e r ve r S o cke t. g e t S o cke t ( )
( c ) S o cke t s = n e w S o cke t( S e r ve r N am e ) ;
( d ) S o cke t s = s e r ve r S o cke t. a c c e pt ( )
A A D D D A C D C A B C C A C D D C C D
( a) y i e l d ( )
( b ) s u s p e n d ( );
( c ) r e s u m e ( ) ;
( d ) s t o p () ;
2 . W h i ch o f th e f o l l ow i n g m e t h o d i s a s t at i c i n j ava . l an g . T h r e a d ?
( a) s l e e p (l o n g)
( b ) r u n ( )
( c ) s t a rt ( )
( d ) j o i n ( )
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) O n c e yo u i nvo ke t h e awai t m e t h o d o n a c on d i t i on , th e l o ck i s a u to m at i c a l l y re l e as e d . O n c e t h e c o n d i t i on i s r i ght , t h e th r e a d r e - ac q u i r e s t h e l o ck a n d c o nti nu e s e x e c u t i n g .
( b ) A c on d i t i o n i s a s s o c ia t e d w i th a l o ck.
( c ) To i nvoke m e t h o d s o n a c o n d i ti o n , t h e l o ck mu s t b e ob t a i n e d fi r s t .
( d ) T h e s i g n al m e th o d on a c on d i t i o n c a u s e s t h e l o ck f o r t h e c on d i t i on t o b e r e l e as e d.
4 . T h e f o l l ow i n g c o d e c au s e s J ava t o t h row . i nt nu mb e r = I nt e g e r . M A X VA L U E + 1 ;
( a) E x c e p t i o n
( b ) R u nt i m e E x c e p t i on
( c ) E r r or
( d ) N o E x c e p t i o n s
5 . A n a l yz e t h e f ol l ow i n g p r og r am . 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 t r i n g s = ” 5. 6 ”; I nt e g e r . p ar s e I nt ( s ) ; / / C a u s e a N u mb e rFor m a t E x c e p t i o n 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 ” ); } c a t ch ( E x c e p t i on e x ) { S y s t e m . o u t. p r i nt l n (e x) ; } } }
( a) A n e xc e p t i on i s r ai s e d d u e t o 2 / i ;
( b ) T h e p r og ra m c om p i l e s a n d r u n s w i t h o u t e x c e p t i o n s .
( c ) T h e p r og ra m h a s a c om p i l a t i on e r ro r .
( d ) A n e xc e p t i on i s r ai s e d d u e t o I nte ge r . p a rs e I nt (s );
6 . W h a t i s w ro n g i n t h e f ol l ow i n g p r og r am ? 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 ri n g [ ] a r gs ) { 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 ” ); } } }
( a) Yo u c an n o t h ave a t r y b l o ck w i t h o u t a c a tch b l o ck or a fi n a l l y b l o ck .
( b ) A m e th o d c al l th a t d o e s n ot d e c l ar e e x c e p t i o ns c a n n ot b e p l a c e d i n s i d e a t r y b l o ck .
( c ) N o th i n g i s w r o ng .
( d ) Yo u c an n o t h ave a t r y b l o ck w i t h o u t a c a tch b l o ck .
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 s u m > 1 0 && s u m < 5 * 1 0 : “s um i s ” + s u m ;
( b ) a s s e r t ( i < 1 0) ;
( c ) a s s e r t “ s u m i s ” + s u m ;
( d ) a s s e r t ( i > 1 0) ;
8 . To b e a l i s te ne r f o r A c t i on E ve nt , a n o b j e c t mu s t b e an i n s t an c e o f .
( a) W i n d ow Li s te n e r
( b ) A c t i o n E ve nt
( c ) E ve nt Ob j e c t
( d ) A c t i o n Li s te n e r
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 A c t i ve ( K e yE ve nt e )
( b ) ke y Typ e d (K e y E ve nt e )
( c ) ke y Re l e as e d (K e y E ve nt e )
( d ) ke y I n ac ti ve ( 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 i n j ava. aw t . C om p o n e nt m ay e ff e c t l ayou t ?
( a) p r e f e r r e d S i z e
( b ) b a ckg r ou n d
( c ) f o r e gr o u n d
( d ) f o nt
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 T i t l e At( i n d e x )
( b ) g e t Ta b b e d C o u nt( )
( 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 r d e r (C ol o r . Y E L LOW , C o l o r. R E D )
( 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 ) n e w E t ch e d B o ar d e r ( )
( 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 ( C ol o r . Y E L L OW , C ol o r . RE D )
1 3. i s th e a c t i on t h a t c a u s e s a p o p u p m e nu t o b e d i s p l aye d .
( a) Po p u p r e a c ti o n
( b ) Po p u p e ve nt
( c ) Po p u p t r i gg e r
( d ) Po p u p a c t io n
1 4. a l l ow s yo u t o c r e a t e c u s to m b u t t on s .
( a) A n o p t i on d i al o g
( b ) A m e s s a ge 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
15. 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) 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
( b ) L ayou t m an a ge r s
( c ) S w i n g u s e r i nt e r f a c e c l a s s e s
( d ) A l l U t i l i ty c l a s s e s
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) 1 .
( b ) 0 .
( c ) 2 .
( d ) 3 .
1 7. To s p e c i f y a f ont t o b e b o l d a n d i t al i c , u s e t h e f o nt s tyl e va l u e
( a) Fo nt . I TA L I C
( b ) Fo nt . B O LD
( c ) Fo nt . P L A I N
( d ) Fo nt . B O LD + Fo nt . I TA L I C
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 n c i r c l e w i t h r ad i u s 2 0 c e nte re d a t ( 50 , 5 0) , yo u u s e
( a) g . d raw O val ( 5 0, 50 , 2 0 , 20 )
( b ) g . d raw O val ( 3 0, 30 , 2 0 , 2 0)
( c ) g . d raw O val ( 3 0, 30 , 4 0 , 40 )
( d ) g . d raw O val ( 5 0, 50 , 4 0 , 4 0)
1 9. A l i s te n e r o f a J L i s t mu s t im p l e m e nt .
( a) j ava x. s w i n g. e ve nt . A d j u s t m e nt L i s t e n e r
( b ) t h e j ava . aw t . A c t i o n L i s t e n e r i nt e r f ac e
( c ) j ava x. s w i n g. e ve nt . C h a n ge L i s t e n e r
( d ) t h e j ava . aw t . I t e m L i s t e n e r i nte rf ac e
2 0. T h e s e r ve r l i s t e n s f or a c on n e c t i on r e q u e s t f r om a c l i e nt u s i n g t h e f ol l ow i n g s t at e m e nt :
( a) S o cke t s = n e w S o cke t( S e r ve r N am e , p o rt ) ;
( b ) S o cke t s = s e r ve r S o cke t. g e t S o cke t ( )
( c ) S o cke t s = n e w S o cke t( S e r ve r N am e ) ;
( d ) S o cke t s = s e r ve r S o cke t. a c c e pt ( )
A A D D D A C D C A B C C A C D D C C D
0 comments:
Post a Comment