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 ab s t r ac t c l a s s Te s t i m p l e m e nts R u n n ab l e { p u b l i c vo i d d o S o m e t h in g ( ) { } ; }
( a) T h e p ro g ra m w i l l n o t c om p i l e b e c au s e i t d o e s n ot c ont ai n ab s t r a c t m e t h o d s . ( b ) R u nt i m e E r ro r .
( c ) T h e p ro g ra m c om p i l e s fi n e . ( d ) T h e p ro g ra m w i l l n o t c om p i l e b e c au s e i t d o e s n ot i m p l e m e nt th e r u n ( ) m e t h o d .

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) r u n ( ) ( b ) j o i 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) 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 .
( b ) 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. ( c ) 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 qu 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 . ( d ) 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.

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 r e t u rn a p e r m i t t o a S e m a p h or e s ?
( a) r e l e a s e ( ) ( b ) r e t u r n () ( c ) s e n d ( ) ( d ) a d d ()

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 ) { 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 ) A r i t h m e t i c 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 ) 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

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 .
( b ) N o th i n g i s w r o ng . ( c ) 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 . ( 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 or a fi n a l l y b l o ck .

7 . P r e s s i n g a b u tt o n g e n e r at e s a (n ) e ve nt .
( a) A c t i o n E ve nt ( b ) I t e m E ve nt ( c ) M o u s e E ve nt ( d ) M o u s e M o t i on E ve nt

8 . T h e h an d l e r (e . g. , ac t i o n Pe r f or m e d ) i s a m e t h o d i n . ( a) b o t h s o u r c e a n d l i s t e n e r ob j e c t ( b ) t h e O b j e c t c l a s s ( c ) a s o u r c e o b j e c t ( d ) a l i s t e n e r ob j e c t

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

1 0. T h e p r e f e r r e d S i z e p ro p e r ty i s i g n o re d i n .
( a) B o r d e r L ayou t ( b ) F l ow Layo u t ( c ) G r i d L ayou t ( d ) Fo r a ny l ayou t

1 1. Yo u c an c on s tr u c t a J Ta b b e d Pa n e u s i n g .
( 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. 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 B e ve l B o r d e r ?
( a) n e w B e ve l B or d e r ( ) ( b ) n e w B e ve l B or d e r ( B e ve l B o r d e r . L OW E R E D ) ( c ) B o r d e r Fa c t or y. c r e a t e B e ve l B or d e r ( B e ve l B or d e r . R A I S E D ) ( d ) B o r d e r Fa c t or y. c r e a t e B e ve l B or d e r ( B e ve l B or d e r . L OW E R E D )



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

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) O n l y b u tt o n C a n c e l i s d i s p l aye d .
( b ) 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 de o f b u t to n OK . ( c ) 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 . ( d ) O n l y b u tt o n O K i s d i s p l aye d .

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 , 20 ) ) ( 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 ( n e w Font ( H e l ve t i c a , Fo nt. B OL D , 2 0 )) ( d ) c . s e tFont ( Fo nt( H e l ve ti c a, Font . B O L D, 20 ) )

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 o f a f r am e i s .
( a) ( 10 , 1 0 ) ( b ) ( 25 , 2 5 ) ( c ) ( 10 0 , 1 00 ) ( d ) ( 0, 0)

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 p o s i t i ve i nt e g e r s ( b ) a s e q u e n c e o f d o u b l e val u e 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 n o n - n e g a ti ve i nt e g e r 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 le t.
( a) g e t C o d e B a s e ( ) . ge t H o s t N am e ()
( 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 ( ) . h os t ( )
( d ) g e t C o d e B a s e ( ) . ge t H o s t ( )

CCBCD DADBC DAAAA ACDCD

0 comments:

Post a Comment