Tuesday, April 15, 2008

JAVA ONLINE 6

1 . 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 n o t d e fi n e d i n t h e Ob j e c t c l a s s ? ( a) wa i t( ) ( b ) n o ti f y( ) ( c ) n o ti f yA l l ( ) ( d ) s l e e p (l o n g m i l l i s e c o n d s )

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 ) s t a rt ( ) ( c ) r u n ( ) ( d ) j o i n ( )

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) A r r ay B l o ck i n gQ u e u e ( b ) P r i o ri ty B l o ck i n gQ u e u e ( c ) L i n ke d B l o cki n g Q u e u e ( d ) P r i o ri ty Qu e u e

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) E r r or ( b ) T h r owa b l e ( c ) R u nt i m e E x c e p t i on ( d ) E x c e p t i o n

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 am 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 ) { S t r i n g s = “ ab c ”; S y s t e m . o u t. p r i nt l n (s . ch ar At (3 ) ) ; } } ( a) A r r ay I n d e x O u t O f B ou n d s 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 ) C l a s s C as t 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) 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 . ( 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 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 . ( 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 . C l i ck i n g t h e c l o s i n g b u t t on on th e u p p e r - ri g ht c o rn e r of a f r am e g e n e r at e s a (n ) e ve nt . ( a) W i n d ow E ve nt ( b ) C o m p o ne nt E ve nt ( c ) M o u s e M o t i on E ve nt ( d ) I t e m E ve nt

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 ve nt . ge t Po i nt ( ) . x ( b ) E ve nt . ge t Po i nt ( x , y ) ( c ) e v t . ge tX ( ) ( d ) e v t . ge tX Y ( )

9 . 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 J A p p l e t ? ( a) r e s i z a b l e ( b ) i c o n I m a ge ( c ) c o nte nt Pa n e ( d ) t i t l 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 nt ( d ) f o r e gr o u n d


1 1. Yo u c an c on s tr u c t a J S p l i t Pa n e u s i n g . ( a) n e w J S p l i tPan e ( C o m p o n e nt, C om p on e nt ) ( b ) n e w J S p l i tPan e ( ) ( c ) n e w J S p l i tPan e ( C o m p o n e nt [ ] ) ( d ) n e w J S p l i tPan e ( C o m p o n 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) 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. A J R a d i oB u tt o n M e nu I t e m is a s u b c l as s o f . ( a) J M e nu I t e m ( b ) A b s t r ac tB u t to n ( c ) J M e nu ( d ) J C o m p o n e nt

1 4. i s u s e d t o r e c e i ve i n p u t f r om th e u s e r . ( a) A n i n p u t d i al o g ( b ) A m e s s a ge 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 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) Fo nt ( b ) J Fr a m e ( c ) C o l or ( d ) C o m p o n e nt

1 6. To s e t a F l ow L ayo u t i n p an e l j p , you c a n u s e t h e m e t h o d . ( a) j p . s e tL ayo u t (n e w F l ow Layo u t ( F l ow L ayou t . c e nt e r ) ) ; ( b ) j p . s e tL ayo u t (n e w F l ow Layo u t ( )) ; ( c ) j p . s e tL ayo u t (n e w F l ow Layo u t ( F l ow L ayou t ) ) ; ( d ) j p . s e tL ayo u t (F l ow L ayou t ( ) );

1 7. T h e m e t h o d s e t s t h e b a ckg r ou n d c o l or t o ye l l ow i n J Fra m e f . ( a) s e t B ack g ro u n d ( C ol o r . Y E L L OW ) ( b ) s e t B ack g ro u n d ( C ol o r . ye l l ow ) ( c ) f . s e tB ack G r o u n d ( C ol o r . ye l l ow ) ( d ) f . s e tB ack 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) T h e p ai nt C o m p on e nt me th o d i s a u t om a t i c al l y i nvoke d by t h e J V M . Yo u s h o u l d n e ve r i nvoke i t d i r e c tl y. ( b ) W h e n e ve r a G U I c o m p o n e nt i s di s p l aye d , i t s G r ap h i c s o b j e c t i s a u t om a t i c al l y c r e at e d . ( c ) I nvok i n g r e p ai nt ( ) c a u s e s p ai nt C o m p on e nt to b e i nvo ke d by t h e J V M . ( d ) Yo u m ay c r e a te a G r a p h i c s o b j e c t u s i n g n e w G r a p h i c s ( ) .

1 9. D e f a u l t Li s tC e l l Re n de re r c a n d i s p l ay . ( a) b o t h s t r i n g an d i c on ( b ) a s t r i n g or an i c on ( c ) o n l y an i c on ( d ) o n l y a s t r i n g

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) c o n n e c t S t re am ( ) ; ( b ) g e t I n p u t S tr e a m ( ); ( c ) o b ta i n I n p u t S t re am ( ) ; ( d ) o p e n S t r e am ( ) ;

D A D B B A A C C A B B C A B B D D B D

JAVA ONLINE 5

1 . Yo u c an u s e t h e m e t h o d t o t e m p o ra r i l y t o re l e as e t i m e f or o t h e r t h r e a d s .
( a) s u s p e n d ( )
( b ) y i e l d ( )
( c ) s t o p ()
( d ) s l e e p (i nt m i l l i s e c on d s )

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) j o i n ( )
( b ) r u n ( )
( c ) s l e e p (l o n g)
( d ) s t a rt ( )

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 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 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 .
( b ) a b l o cki n g q u e u e h a s a c a p ac i ty.
( 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 ) 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 .

4 . 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 am 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 ) { S y s t e m . o u t. p r i nt l n (1 / 0 ) ; } }
( a) S t r i n gI n d e xO u t Of B ou n d s E x c e p t i on
( b ) C l a s s C a s t E x c e p t i o n
( c ) A r i t h m e t i c E x c e p t i on
( d ) A r r ay I n d e x O u tO f B o u n d s E x c e p ti o n

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 am 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 . t oS t r i n g( ) ) ; } }
( a) 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
( b ) A r r ay I n d e x O u t O f B ou n d s E x c e p t i o n
( c ) C l a s s C as t E x c e p t i on
( d ) A r i t h m e t i c E x c e p t i o n

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 o l 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 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 ) ; } fi n a l l y { S y s t e m . o u t. p r i nt l n (“ T h e fi n al l y c l au s e i s e x e c u t e d ”) ; } } }
( a) We l c om e t o J ava f ol l owe d by T h e fi n al l y c l au s e i s e x e c u t e d i n t h e n e x t l i n e ( b ) T h e fi n al l y c l au s e i s e x e c u t e d
( c ) R u nt i m e E r ro r
( d ) We l c om e t o J ava

7 . 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) I f a c o m p on e nt c an ge n e r a t e a n e ve nt , a ny s u b c l a s s of t h e c o m p o n e nt c an n o t g e n e r a te t h e s a m e ty p e of e ve nt.
( b ) a c o m p on e nt on w h i ch a n e ve nt i s ge n e ra t e d i s c a l l e d t h e s ou r c e ob j e c t .
( c ) E ve r y G U I c o m p on e nt c an ge n e ra t e M ou s e E ve nt , K e y E ve nt , Fo c u s E ve nt , a n d C o m p o n e ntE ve nt .
( d ) A l l t h e e ve nt c l as s e s ar e s u b c l a s s e s o f E ve nt Ob j e c t .





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 A c t i on C o m m an d ( )
( b ) p a ra m S t ri n g ( )
( c ) g e t I D ()
( d ) g e t M o d i fi e r s ( )

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 I n ac ti ve ( K e y E ve nt e )
( d ) ke y Re l e as e d (K e y E ve nt e )

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 he f o l l ow i n g m e th o d i s n o t va l i d ?
( a) c . p . fi r s t ( )
( b ) p . n e x t ( c )
( c ) p . l a s t (c )
( d ) p . p r e v i ou s (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 ) G r i d L ayou t
( c ) B ox Layo u t
( d ) F l ow Layo u t

1 2. A J M e nu I t e m i s a s u b c l a s s of .
( a) J C o nta i n e r
( b ) J M e nu
( c ) A b s t r ac tB u t to n
( d ) J B u t t o n

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

1 5. W h a t i s b e s t t o d e s c ri b e t h e r e l a t i on s h i p b e twe e n J C om p on e nt a n d J B u tt o n ? .
( a) C o m p o s i t i on
( b ) A s s o c i a t i on
( c ) A g gr e g at i o n
( d ) I n h e r i t a n c e









1 6. A n a l yz e t h e f ol l ow i n g c o d e . i m p o r t j ava. aw t . *; 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 { 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 ra m e = n e w J Fra m e ( “ M y Fr a m e ”) ; f r a m e . ge tC o nt e ntPa n e ( ) . ad d ( n e w J B u t t on ( “ OK ”) ) ; f r a m e . ge tC o nt e ntPa n e ( ) . ad d ( n e w J B u t t on ( “ C an c e l ”) ) ; f r a m e . s e t D e f a u l tC l os e Op e ra t i on ( J Fra m e . E X I T O N C L O S E ) ; f r a m e . s e t S i z e ( 2 00 , 2 00 ) ; f r a m e . s e t V i s i b l e ( t r u e ) ; } }
( a) B o t h b u t t on OK an d b u t to n C a n c e l ar e d i s p l aye d a n d b u t t o n OK i s d i s p l aye d o n t h e l e f t s i de o f b u t t on OK .
( b ) O n l y b u tt o n O K i s d i s p l aye d .
( c ) O n l y b u tt o n C a n c e l i s d i s p l aye d .
( d ) B o t h b u t t o n O K an d b u t t on C a n c e l ar e d i s p l aye d a n d b u t t on O K i s d i s p l aye d on t h e ri g ht s i d e o f b u t to n OK .

1 7. T h e m e t h o d c a n b e u s e d to g e t t h e w i d t h o f t h e c om p o n e nt c .
( a) c . g e t S i z e ( )
( b ) c . g e t H e i g ht ( )
( c ) c . g e t D i m e n s i on ( )
( d ) c . g e t W i d t h ()

1 8. T h e c o or d i n a te o f t h e u pp e r - l e f t c or n e r of a f r am e i s .
( a) ( 25 , 2 5 )
( b ) ( 10 , 1 0 )
( c ) ( 0, 0)
( d ) ( 10 0 , 1 00 )

1 9. I f yo u c re at e a J S p i n n e r ob j e c t w i th o u t s p e c i f y i n g a m o d e l , t h e s p i n n e r d i s p l ays .
( a) a s e q u e n c e o f n o n - n e g a ti ve i nt e g e r s
( b ) a s e q u e n c e o f p o s i t i ve i nt e g e r s
( c ) a s e q u e n c e o f i nt e g e r s
( d ) a s e q u e n c e o f d o u b l e val u e s

2 0. Yo u c an ob t a in t h e s e rve r s h os t n a m e by i nvok i n g o n a n a p p l e t.
( a) g e t C o d e B a s e ( ) . ge t H o s t ( )
( b ) g e t C o d e B a s e ( ) . h os t N a m e ( )
( c ) g e t C o d e B a s e ( ) . ge t H o s t N am e ()
( d ) g e t C o d e B a s e ( ) . h os t ( )

B C D C A
A A A D A
C C A C D
C D C C A

JAVA ONLINE 4

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

JAVA ONLINE 3

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) R u nt i m e E r ro r
( b ) 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 .
( c ) 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 .
( d ) 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 .

2 . W h e n yo u r u n t h e f ol l ow i n g p r og r am , w h at w i l l h a p p e n ? p u b l i c c l as s Te s t e x t e n d s T h r e a d { 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 ) { Te s t t = n e w Te s t ( ); t . s t ar t ( ) ; 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) N o th i n g i s d i s p l aye d .
( b ) A n i l l e g a l j ava .l a n g . I l l e g al T h r e ad S ta t e E xc e p ti o n m ay b e th r ow n b e c a u s e yo u j u s t s t ar t e d t h r e a d a n d t h re ad m i g ht have n o t ye t fi n i s h e d b e f o re you s t ar t i t a ga i n . ( c ) T h e p ro g ra m d i s p l ay s t e s t on c e . ( d ) T h e p r og ra m d i s p l ay s t e s t tw i c e .

3 . Which method on a condition should you invoke to causes the current thread to wait until the condition is signaled ?
( a) condition.wait( ) ; ( b ) condition.await (); ( c ) c o n d i t i on . wa i te d () ; ( d ) c o n d i t i on . wa i ti n g ( ) ;

4 . An instanceof describes the errors caused by your program and external circumstances . These errors can be caught and handled by your program .
( a) Runtime Exception ( b ) Error ( c ) Throwable ( d ) Exception

5 . 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 o l 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 { m e t h o d ( ); S y s t e m . o u t. p r i nt l n (” A f t e r t h e m e t h o d c a l l ”) ; } c a t ch ( N u mb e r Fo rm a t E x c e p t i o n e x ) { S y s t e m . o u t. p r i nt l n (” N u mb e r Fo r m at E x c e p t i o n ”) ; } c a t ch ( Ru nt i m e E x c e p t i o n e x ) { S y s t e m . o u t. p r i nt l n (” R u nt i m e E xc e p ti o n ” ); } } s t a ti c voi d me th o d ( ) { 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 ” ); } } (
a) T h e p r og ra m d i s p l ay s N u mb e rFor m a tE xc e p t i on f ol l owe d by A f t e r th e m e t h o d c a l l .
b) ( b ) T h e p r og ra m d i s p l ay s N u mb e rFor m a tE xc e p t i on f ol l owe d by R u nti m e E x c e p t i on .
c) ( c ) T h e p r og ra m d i s p l ay s N u mb e rFor m a tE xc e p t i on .
d) ( d ) 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 .


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 ” ); } c a t ch ( Ru nt i m e E x c e p t i o n e x ) { 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 ”) ; } } }
( 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 .
( 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 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 . ( 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 t h re e t i m e s .
( 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 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 .

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 L i s t e n e r ( p ) ; ( b ) a d d A c t i on L i s t e n e r ( p ) ; ( c ) j b t . a d d E ve nt L i s t e n e r ( p ) ; ( d ) j b t . a d d A c t i on E ve nt Li s te n e r (p ) ;

8 . To l i s t e n t o m ou s e m ove m e nt e ve nt s , th e l i s t e n e r mu s t i m p l e m e nt t h e i nt e r f ac e .
( a) W i n d ow Li s te n e r () ( b ) M o u s e L i s t e n e r ( ) ( c ) C o m p o ne nt L i s t e n e r ( )
( d ) M o u s e M o t i on L i s t e n e r( )

9 . T h e ge tK e y C o d e () m e t h o d of t h e K e yE ve nt r e t u r n s .
( a) t h e E B S D I C c o d e o f t h e ch ar a c t e r ( b ) a ch a ra c t e r ( c ) t h e A S C I I c o d e o f t h e ch ar a c t e r ( d ) t h e U n i c o d e c o d e o f th e ch ar a c t e r

1 0. cannot be shared by a GUI component ?
( a) A C ol o r o b j e c t ( b ) A G U I c om p o n e nt ( c ) A l ayo u t o b j e c t ( d ) A Font o b j e c t

11. You can construct a JTabbed Pane using .
( a) n e w J Ta b b e d Pa n e ( C o m p on e nt ) ( b ) n e w J Ta b b e d Pa n e ( C o m p on e nt [ ] ) ( c ) n e w J Ta b b e d Pa n e ( C o m p on e nt , C om p o n e nt ) ( d ) n e w J Ta b b e d Pa n e ( )

1 2. Which of the following method will not create a LineBorder?
( a) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 , t r u e ) ( b ) n e w L i n e B o rd e r( C o l o r. Y E LL OW , 3 ) ( c ) 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 )
( d ) n e w L i n e B o rd e r( )

1 3. Which of the following statement is false ?
( a) 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 M e nu . ( b ) Yo u c an ad d a J M e nu I t e m t o a J M e nu . ( c ) You can add a JMenu to a JMenuItem . ( 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 M e nu I te m .

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 nts a re t r u e ?
( a) J B u t t o n h a s a n a d d m e t h o d t h at e n ab l e s you t o a d d a n i n s ta n c e of A c t i on t o th e m e nu . ( b ) J B u t t o n h a s a n a d d m e t h o d t h at e n ab l e s you t o a d d a n i n s ta n c e of A c t i on L i s t e n e r t o th e m e nu . ( c ) J To o l B a r h a s a n a d d m e t h o d t h a t e n a b l e s yo u t o ad d an i n s t an c e of A c t i o n Li s te n e r t o t h e m e nu .
( d ) JTool Bar has an add method that enables you to add an instanceof Action to the menu .

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) Fo nt ( b ) C o m p o ne nt ( c ) C o l or ( d ) J Fr a m e

1 6. T h e d e f a u l t l ayou t ou t o f a c ont e nt Pan e i n a J Fr a m e i s .
( a) B o r d e r L ayou t ( b ) G r i d B a g Layo u t ( c ) F l ow Layo u t ( d ) G r i d L ayou t

1 7. T h e m e t h o d s e t s t h e b a ckg r ou n d c o l or t o ye l l ow i n J Fra m e f .
( a) f . s e tB ack g r ou n d ( C o l or . Y E L L OW ) ( b ) f . s e tB ack G r o u n d ( C ol o r . ye l l ow ) ( c ) s e t B ack g ro u n d ( C ol o r . ye l l ow ) ( d ) s e t B ack g ro u n d ( C ol o r . Y E L L OW )

1 8. G i ve n a G r a p h i c s ob j e c t g, t o d r aw an o u tl i n e o f a r e c t an g l e of w i d t h 20 an d h e i g ht 50 w i t h t h e u p p e r - l e f t c o r n e r a t ( 20 , 2 0) , yo u u s e
( a) g . d raw R e c t (2 0 , 2 0, 20 , 5 0) ( b ) g . d raw R e c t F i l l (2 0 , 5 0, 20 , 2 0) ( c ) g . d raw R e c t F i l l (2 0 , 2 0, 20 , 5 0) ( d ) g . d raw R e c t (2 0 , 5 0, 20 , 2 0)

1 9. J S p i n n e r fi r e s w h e n a n e w val u e 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 . aw t . A c t i on E ve nt ( c ) j ava . aw t . e ve nt. I te m E ve nt ( d ) j ava x. s w i n g. e ve nt . A d j u s t m e nt E ve nt

2 0. T h e m e t h o d i n t h e I n e t A d d r e s s c l a s s r e t u r n s th e I P ad d r e s s .
( a) g e t A d d re s s ( ) ( b ) g e t I PA d d r e s s ( ) ( c ) g e t I P ( ) ( d ) g e t H os t A d d r e s s ()


BBBDC DADDB DDCDD AAAAD

JAVA ONLINE 2

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 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 .
( b ) 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 . ( c ) R u nt i m e E r ro r ( d ) 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 .

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 ( 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 ) ; ( b ) 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 ) ;
( 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 ( 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 ) ; ( d ) 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( ) ;

3 . 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 s ta t e m e nt
( a) L o ck l o ck = n e w L o ck ( ); ( b ) L o ck l o ck = n e w R e e nt r ant L o ck ( f a l s e ) ; ( c ) L o ck l o ck = n e w R e e nt r ant L o ck ( t r u e ) ; ( d ) L o ck l o ck = n e w R e e nt r ant L o ck ( ) ;

4 . A n i n s t a n c e o f d e s c ri b e s s y s t e m e r r o rs . I f t h i s ty p e o f e r r or s o c c u rs , t h e r e i s l i t t l e you c a n d o b e yon d n o ti f yi n g t h e u s e r a n d t r y i ng t o t e r m i n a te t h e p r o gr a m g ra c e f u l l y.
( 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 ) T h r owa b l e

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 ) { i nt [ ] l i s t = n e w i nt [ 5] ; S y s t e m . o u t. p r i nt l n (l i s t[ 5 ] ) ; } }
( a) A r i t h m e t i c 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 r ay I n d e x O u t O f B ou n d s E x c e p t i o n ( d ) C l a s s C as t 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) 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 . ( 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 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 . ( 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 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 A c t i on L i s t e n e r ( p ) ; ( c ) a d d A c t i on L i s t e n e r ( p ) ; ( d ) j b t . a d d E ve nt L i s t e n e r ( p ) ;

8 . T h e i nte rf a c e s h o u l d b e i m p l e m e nt e d t o l i s t e n f or a b u tt o n a c t i on e ve nt . ( a) Fo c u s Li s te n e r ( b ) M o u s e L i s t e n e r ( c ) A c t i o n Li s te n e r ( d ) W i n d ow Li s te n e r

9 . 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 J A p p l e t ?
( a) c o nte nt Pa n e ( b ) t i t l e ( c ) r e s i z a b l e ( d ) i c o n I m a ge


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) b a ckg r ou n d ( b ) p r e f e r r e d S i z e ( c ) f o nt ( d ) f o r e gr o u n d


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 o n t op of e a ch o th e r. ( a) G r i d L ayou t ( b ) B ox Layo u t ( c ) B o r d e r L ayou t ( d ) O ve r l ayL ayo 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 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 ) 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 ) 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. H ow d o you di s p l ay a J Po p u p M e nu ?
( a) I nvoke t h e s h ow ( ) f ro m a J Po p u p M e nu .
( b ) I nvoke t h e s h ow ( C o m p o n e nt , x , y ) f r o m a J Po p u p M e nu . ( c ) I nvoke t h e s e t V i s i b l e ( t r u e ) f r o m a J Po p u pM e nu . ( d ) A d d t h e J Pop u p M e nu t o a c ont a i n e r.

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 m ay b e fl oa t ab l e .
( b ) 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. ( c ) 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 . ( d ) 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 .

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 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.
( b ) 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 . ( c ) 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 . ( d ) To d is 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 om 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 .

1 6. To s e t a F l ow L ayo u t i n p an e l j p , you c a n u s e t h e m e t h o d .
( a) j p . s e tL ayo u t (n e w F l ow Layo u t ( F l ow L ayou t . c e nt e r ) ) ;
( b ) j p . s e tL ayo u t (n e w F l ow Layo u t ( )) ; ( c ) j p . s e tL ayo u t (n e w F l ow Layo u t ( F l ow L ayou t ) ) ; ( d ) j p . s e tL ayo u t (F l ow L ayou t ( ) );

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) s e t For e g r ou n d ( C o l or . Y E L L OW ) ( b ) f . s e tFor e G ro u 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 ) f . s e tFor e g r ou n d ( C o l or . ye l l ow )

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, 10 0, 10 0 ) ( b ) g . d raw L i n e ( 0, 0, ge t W i d t h ( ) , ge tW i d t h ( ) ) ( c ) g . d raw L i n e ( 0, 0, ge t H e i g ht () , ge t H e i g ht( ) )
( 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 . aw t . A c t i on 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 x. s w i n g. e ve nt . C h a n ge E ve nt ( d ) j ava . aw t . I t e m E ve nt

2 0. T h e c l i e nt r e q u e s t s a c on n e c t i on t o a s e rve r u s i n g th e f o l l ow i n g s t a t 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 = n e w S o cke t( S e r ve r N am e ) ; ( c ) S o cke t s = s e r ve r S o cke t. a c c e pt ( ) ; ( d ) S o cke t s = s e r ve r S o cke t. g e t S o cke t ( ) ;


A C A C C A B C A B D C B B B B D D A A

JAVA ONLINE 1

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

Monday, April 14, 2008

EMWT ONLINE 12

1 . At t h e d i e l e c t ri c c on d u c t o r i nte rf ac e t h e wave
( a) C o m p l e t e r e fl e c ti o n t a ke s p l a c e ( b ) N o t r an s m i s s i on an d n o re fl e c t i on ta ke p l a c e . ( c ) C o m p l e t e t r an s m i s s i o n t ake s p l ac e ( d ) B o t h r e fl e c t i o n a n d t r an s mi s s i o n t ake s p l ac e

2 . Fo r n o r m al i n c i d e n c e , th e an g l e of i n c i d e n c e i s
( a) 0 0 ( b ) 1 80 0 ( c ) 4 5 0 ( d ) 9 0 0

3 . T h e an o t h e r n a m e o f B r e w s t e r a n gl e i s
( a) A n g l e o f r e fl e c ti o n ( b ) N o n p o l ar i z i n g a n gl e ( c ) A n g l e o f t r an s m i s s i o n ( d ) Po l ar i z i n g a n gl e

4 . T h e s u r f a c e r e s i s t an c e ( a) I n c r e a s e s w i t h c on d u c t i v i ty ( b ) D e c r e a s e s w i t h f r e q u e n c y ( c ) D e c r e a s e s w i t h f r e q u e n c y an d I n c r e as e s w i th c o n d u c t i vi ty ( d ) I n c r e a s e s w i t h f re q u e n c y

5 . A u n i f o r m p l an e wave tr ave l i n g i n a d i e l e c t r i c of re f r ac t i ve i n d e x 2 i s i n c i d e nt at t h e d i e l e c tr i c a i r s u r f a c e . T h e n th e c r i t i c a l a ng l e at t h e i nte rf a c e i s ( a) S i n - 1 ( 1 √ 2 ) ( b ) S i n - 1 ( √2 ) ( c ) Tan - 1 ( 1 √ 2 ) ( d ) S i n - 1 ( 1 2 )

6 . I f t h e d i s t a n c e b e twe e n t h e p l an e s i s in fi n i t e t h e n t h e wave i n t h a t d i r e c t i on i s
( a) I n c r e a s e s l i n e a r l y ( b ) N o n u n i f o r m ( c ) I n c r e a s e s e x p o n e nti a l l y ( d ) U n i f o r m

7 . Fo r a z d i r e c t e d T E wave
( a) H z = E z = 0 ( b ) E z = 0 ( c ) E = 0 ( d ) H z = 0

8 . O th e r n am e of T M wave i s
( a) E wave ( b ) H wave ( c ) U n i f o r m p l a ne wave ( d ) E & H wave

9 . Fo r a T E M wave
( a) H z = E z = 0 ( b ) E z = 0 ( c ) E z = 0 , H z = 0 ( d ) H z = 0

1 0. C o n s i d e r a wave of 3 G H z p r o p ag at i n g i n p a r al l e l c o n d u c t i n g p l at e s s e p a r at e d by 3 c m . T h e n t h e λ c i s
( a) 1 . 5 c m ( b ) 3 c m ( c ) 1 /3 c m ( d ) 6 c m

1 1. I n s ol v i n g t r an s m i s s i o n l i n e p r o b l e m s we u s e t h e f o l l ow i n g c i r c u i t q u ant i t i e s
( a) V a n d I ( b ) E an d H ( c ) D a n d B ( d ) J a n d E

1 2. I n a t r a n s m i s s i o n l i n e w h e n t e r m i n at i o n i m p e d a n c e i s e q u a l t o ch ar a c t e ri s ti c i m p e d a n c e of th a t l i n e t h e n th e r e fl e c t i o n c o e ffi c i e nt i s
( a) Z e ro ( b ) U n i ty ( c ) E q u a l t o t ra n s m i s s i on c o e ffi c i e nt ( d ) I n fi n i ty

1 3. Fo r a l o s s l e s s l i n e t h e l i n e ch ar a c t e r i s t i c s r e p e at f or e ve r y ( a) 3 λ / 4 ( b ) λ / 2 ( c ) λ ( d ) λ / 4

1 4. H y s t e r e s i s an d e d d y c u r r e nt l o s s e s i n l o ad i n g c oi l s l e ad s t o ( a) I n c r e a s e i n R ( b ) D e c r e a s e i n L ( c ) D e c r e a s e i n R ( d ) I n c r e a s e i n L

1 5. h i g h f r e q u e n c y l i n e h a s L = 0. 1 m H / K m , C = 0 . 1 m i c ro f a r ad s /K m . I f R & G ar e n e gl i g i b l e , t h e n ch a r ac te ri s ti c i m p e d a n c e i s
( a) 1 00 O h m s ( b ) 4 00 O h m s ( c ) 2 00 O h m s ( d ) 5 0 Oh m s

1 6. I f β l < π / 2 , t h e i n p u t i m p e d an c e o f a o p e n c i r c u i te d l i n e w i l l b e
( a) C a p ac i ti ve ( b ) C o m p l e x q u ant i ty ( c ) R e s i s t i ve ( d ) I n d u c t i ve

1 7. A λ / 8 l i n e m ay b e u s e d to t r a n s f o rm any r e s i s ta n c e t o an i m p e d an c e w i t h a m a g n i tu d e e q u al t o ( a) 1 / R 0 o f t h e l i n e
( b ) R 0 o f t h e l i n e ( c ) Z 0 o f t h e li n e ( d ) 1 /Z 0 o f t h e l i n e

1 8. I n a tr a n s m i s s i o n l i n e at a p oi nt o f Z m i n t h e r e i s a ( a) I m a x ( b ) I m i n ( c ) V m i n ( d ) V m a x

1 9. A s tu b w i t h a s h o r t c i r c u i t e d l o ad off e r s ( a) I n d u c t i ve r e a c t an c e ( b ) P u r e re s i s t an c e ( c ) I m p e d an c e ( d ) C a p ac i ti ve r e a c t a n c e

2 0. A c e r ta i n l ow l o s s l i n e h a s Z 0 = 4 00 o h m s . Fo r Z L = 2 00 o h m s , t h e S W R i s ( a) 1 / 2 ( b ) 4 ( c ) 1 /3 ( d ) 2
A A D D D D B D A D A A B A A A B C A D

About Me