You are on page 1of 13

When a thread terminates its processing , into what state that thread enters?

Running state Waiting state Dead state Beginning state CORRECT ANSWER : Dead state

Which of the following statements is false a o!t o "ects? An instance of a class is an object Objects can access both static and instance data Object is the super class of all other classes Objects do not permit encapsulation CORRECT ANSWER : O "ects do not permit encaps!lation

What are the two parts of a #al!e of t$pe do! le? Significant Digits, Exponent Length, Denominator ode, !umerator CORRECT ANSWER : Significant Digits, E%ponent

What is an aggregate o "ect? An object "ith onl# primiti$e attributes An instance of a class "hich has onl# static methods

An instance "hich has other objects !one of the abo$e CORRECT ANSWER : An instance which has other o "ects

Which statement is tr!e? %ash&able is a sub class of Dictionar# Arra#List is a sub class of 'ector Lin(edList is a subclass of Arra#List 'ector is a subclass of Stac( CORRECT ANSWER : &ashTa le is a s! class of Dictionar$

Consider the following code snippet' What will e assigned to the #aria le fo!rthChar, if the code is e%ec!ted? String str( new String)*+a#a,-. Char fo!rthChar ( str'charAt)/-. )a* )$* thro"s String+ndexOutofBoundsException null characater CORRECT ANSWER : throws String0nde%O!tof1o!ndsE%ception

After the following code fragment , what is the #al!e in frame? String str.

0nt fname. Str(,foolish o$',. 2name(str'inde%Of)*fool,-. , ./ 0 CORRECT ANSWER : 34

Which of the statements is tr!e? &he default char data t#pe is a space1 ) ) 2 character3 &he default integer data t#pe is )int* and real data t#pe is )float* &he default integer data t#pe is )long* and real data t#pe is )float* &he default integer data t#pe is )int* and real data t#pe is )double* CORRECT ANSWER : The defa!lt integer data t$pe is 5int6 and real data t$pe is 5do! le6

A class can ha#e man$ methods with the same name as long as the n!m er of parameters or t$pe of parameters is different' This OO7 concept is 8nown as ethod +n$ocating ethod O$erriding ethod Labeling ethod O$erloading

CORRECT ANSWER : 9ethod O#erloading

Data0np!tStream is an e%ample of

Output stream +4O stream 5iltered stream 5ile stream CORRECT ANSWER : 2iltered stream

Which methods can access to pri#ate attri !tes of a class? Onl# Static methods of the same class Onl# instances of the same class Onl# methods those defined in the same class Onl# classes a$ailable in the same pac(age3 CORRECT ANSWER : Onl$ methods those defined in the same class

Which of the following statements a o!t the +a#a lang!age is tr!e? Both procedural and OO6 are supported in 7a$a3 7a$a supports onl# procedural approach to"ards programming3 7a$a supports onl# OO6 approach3 !one of the abo$e3 CORRECT ANSWER : 1oth proced!ral and OO7 are s!pported in +a#a'

What 8ind of thread is the :ar age collector thread is? !on daemon thread Daemon thread &hread "ith dead state !one of the abo$e CORRECT ANSWER : Daemon thread

What is the meaning of the ret!rn data t$pe #oid? An empt# memor# space is returned so that the de$elopers can utili8e it3 $oid returns no data t#pe3 $oid is not supported in 7a$a !one of the abo$e CORRECT ANSWER : #oid ret!rns no data t$pe'

Ass!me that the #al!e ;<=<'<= is of t$pe 5float6' &ow to assign this #al!e after declaring the #aria le 5interest6 of t$pe float? interest 9 :;-;3;interest 9 15loat2:;-;3;interest 9 :;-;3;- 1float2 interest 9 :;-;3;-f CORRECT ANSWER : interest ( ;<=<'<=f

To e%ec!te the threads one after another the (e#"ord s#nchroni8e is used the (e#"ord s#nchroni8able is used the (e#"ord s#nchroni8ed is used !one of the abo$e CORRECT ANSWER : the 8e$word s$nchroni>ed is !sed

&ow man$ n!meric data t$pes are s!pported in +a#a? < 0 = CORRECT ANSWER : ? What is the data t$pe for the n!m er <'?;@=? float double 5loat Double CORRECT ANSWER : do! le The class "a#a'lang'E%ecption is protected extends &hro"able implements &hro"able

seriali8able CORRECT ANSWER : e%tends Throwa le All the wrapper classes )0nteger, 1oolean, 2loat, Short, Aong, Do! le and Character- in +a#a are pri$ate are seriali8able are immutatable are final CORRECT ANSWER : are final The o "ect of Data0np!tStream is !sed to &o co$ert binar# stream into character stream &o co$ert character stream into binar# stream &o "rite data onto output object All of the abo$e CORRECT ANSWER : To co#ert inar$ stream into character stream

Which of the following is not a method of the Thread class' public $oid run12 public $oid start12 public $oid exit12 public final int get6riorit#12 CORRECT ANSWER : p! lic #oid e%it)-

Which of the following statements is preferred to create a string *Welcome to +a#a 7rogramming,? String str 9 >Welcome to 7a$a 6rogramming? String str 9 ne" String1 >Welcome to 7a$a 6rogramming? 2 String str@ str 9 >Welcome to 7a$a 6rogramming? String str@ str 9 ne" String 1>Welcome to 7a$a 6rogramming? 2 CORRECT ANSWER : String str ( *Welcome to +a#a 7rogramming,

Which of the following is s$nchroni>ed? Set Lin(edList 'ector Wea(%ash ap CORRECT ANSWER : Bector

:i#en the following code snippet: 0nt salariesCD. 0nt inde% ( E. Salaries ( new int salariesC/D. While )inde% F /G SalariesCinde%D(4EEEE. 0nde%HH.

I What is the #al!e of salariesC;D? 0,,,, A,,,, /A,,, /,,,, CORRECT ANSWER : 4EEEE Which of the methods sho!ld e implemented if an$ class implements the R!nna le interface? start12 run12 "ait12 notif#12 and notif#All12 CORRECT ANSWER : r!n)-

Select all thetr!e statements from the following' AbstractSet extends AbstractBollection AbstractList extends AbstractBollection %ashSet extends AbstractSet 'ector extends AbstractList All of the abo$e CORRECT ANSWER : All of the a o#e

0f res!lt ( =H;J@, what is the #al!e and t$pe of 5res!lt6 #aria le?

/C, b#te -A, b#te /C, int -A, int CORRECT ANSWER : 4K, int

The code snippet 0f )*Welcome,'trim)- (( *Welcome,'trim)-compile and displa# >EDual? compile and displa# >!ot EDual? cause a compiler error compile and displa# !ELL CORRECT ANSWER : compile and displa$ *EL!al,

Which of the following statements declare class sample to elong to pa$roll'admindept pac8age ? pac(age pa#roll@pac(age admindept@ import pa#roll3F@ pac(age pa#roll3admindept3Sample@ import pa#roll3admindept3F@ pac(age pa#roll3admindept@ CORRECT ANSWER : pac8age pa$roll'admindept. What is the #al!e of 5n!m er6 after the following code fragment e%ec!tion?

0nt n!m er ( E. 0nt n!m er= ( 4=. While )n!m er F n!m er= G N!m er ( n!m er H 4. I

A /-/ /: CORRECT ANSWER : 4=

Wich of the following is not a ret!rn t$pe?

boolean $oid public Button CORRECT ANSWER : p! lic Which of these statements is tr!e?

Lin(edList extends List AbstractSet extends Set %ashSet extends AbstractSet Wea(%ash ap extends %ash ap CORRECT ANSWER : &ashSet e%tends A stractSet

Ass!me that 2ile is an a stract class and has to20AE)- method MMMMM''

.MM Binar# 5ile +mage 5ile Both 5ile and Binar# 5iles !one of the abo$e CORRECT ANSWER : 0mage 2ile Which of the following is considered as a l!e print MM''arr Object Blass ethod Real data t#pes CORRECT ANSWER : Class

You might also like