Sei sulla pagina 1di 4

Nombre:________________________

Pregunta1:
importjava.util.*;
classMain{
publicstaticvoidmain(Stringargs[]){
Objecta1=newLinkedList(),b1=newTreeSet();
Objectc1=newTreeMap();
System.out.print((a1instanceofCollection)+",");
System.out.print((b1instanceofCollection)+",");
System.out.print(c1instanceofCollection);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:false,false,false
b.
Prints:false,false,true
c.
Prints:false,true,false
d.
Prints:false,true,true
e.
Prints:true,false,false
f.
Prints:true,false,true
g.
Prints:true,true,false
h.
Prints:true,true,true
i.
Noneoftheabove

Pregunta2:
Eachelementmustbeunique.
Containsnoduplicateelements.
Elementsarenotkey/valuepairs.
Accessinganelementcanbealmostasfastasperforminga
similaroperationonanarray.
Whichoftheseclassesprovidesthespecifiedfeatures?

a.
LinkedList
b.
TreeMap
c.
TreeSet
d.
HashMap

e.
HashSet
f.
LinkedHashMap
g.
Hashtable
h.
Noneoftheabove

Pregunta3:

Entriesareorganizedaskey/valuepairs.

Duplicateentriesreplaceoldentries.
Whichinterfaceofthejava.utilpackageoffersthespecified
behavior?

a.
List
b.
Map
c.
Set
d.
Noneoftheabove

Pregunta4:
importjava.util.*;
classMain{
publicstaticvoidmain(Stringargs[]){
Objecta=newHashSet();
System.out.print((ainstanceofSet)+",");
System.out.print(ainstanceofSortedSet);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:false,false
b.
Prints:false,true
c.
Prints:true,false
d.
Prints:true,true
e.
Noneoftheabove

Pregunta5:
Whichofthefollowingclassesoverrideboththeequalsand
hashCodemethods?

a.
java.lang.Byte
b.
java.lang.Integer

c.
java.util.Vector
d.
java.lang.String
e.
java.lang.StringBuffer

Pregunta6:

Entriesarenotorganizedaskey/valuepairs.

Generallyacceptsduplicateelements.

Entriesmaybeaccessedbymeansofanindex.
Whichinterfaceofthejava.utilpackageoffersthespecified
behavior?

a.
List
b.
Map
c.
Set
d.
Noneoftheabove

Pregunta7:
Whichofthefollowingaretruestatements?

a.
TheEnumerationinterfacewasintroducedwiththe
collectionsframeworkwithJava1.2.
b.
TheEnumerationinterfacedeclaresonlytwomethods:
hasMoreElementsandnextElement.
c.
TheIteratorinterfaceextendstheEnumerationinterface.
d.
TheIteratorinterfacedeclaresatotalofthreemethods.

Pregunta8:
classMain{
publicstaticvoidmain(String[]args){
inti1=Math.round(0.5f);
inti2=Math.round(1.5d);
System.out.print(i1+","+i2);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:0,1
b.
Prints:0,2
c.
Prints:1,1

d.
Prints:1,2
e.
Compiletimeerror
f.
Runtimeerror
g.
Noneoftheabove

Pregunta9:
classA{
publicstaticvoidmain(Stringargs[]){
byteprimitiveByte=1;//1
Byteb1=newByte(primitiveByte);//2
Byteb2=newByte(1);//3
System.out.print(b1.byteValue()+b2.byteValue());
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:2
b.
Prints:11
c.
Compiletimeerrorat1
d.
Compiletimeerrorat2
e.
Compiletimeerrorat3
f.
Runtimeerror
g.
Noneoftheabove

Pregunta10:
classA{
publicstaticvoidmain(String[]args){
Booleanb1=newBoolean(true);//1
Booleanb2=newBoolean(false);//2
Booleanb3=newBoolean(TRUE);//3
Booleanb4=newBoolean(FALSE);//4
Booleanb5=newBoolean("TrUe");//5
Booleanb6=newBoolean("fAlSe");//6
}}
Compiletimeerrorsaregeneratedatwhichlines?

a.
1
b.
2
c.
3

d.
4
e.
5
f.
6

Pregunta11:
Whichofthefollowingclassinstancecreationexpressionswould
generateacompiletimeerror?

a.
newShort(1)
b.
newShort('1')
c.
newShort('b''a')
d.
newShort((short)1(short)2)
e.
newShort((byte)1)
f.
newShort((short)1)

Pregunta12:
classMain{
publicstaticvoidmain(String[]args){
Strings1="A",s2="a",s3="b";
s1.toLowerCase();s3.replace('b','a');
System.out.print((s1.equals(s2))+","+(s2.equals(s3)));
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:false,false
b.
Prints:false,true
c.
Prints:true,false
d.
Prints:true,true
e.
Compiletimeerror
f.
Runtimeerror
g.
Noneoftheabove

Pregunta13:
classMain{
publicstaticvoidmain(String[]args){
Strings1="ABCDE";
System.out.print(s1.substring(1,2)+s1.substring(3));
}}

Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:AABC
b.
Prints:ACDE
c.
Prints:ABABC
d.
Prints:ABCDE
e.
Prints:BABCD
f.
Prints:BDE
g.
Prints:BCABCD
h.
Prints:BCDE
i.
Compiletimeerror
j.
Runtimeerror
k.
Noneoftheabove

Pregunta14:
classA{
publicstaticvoidmain(Stringargs[]){
Integeri1=newInteger(1);
Integeri2=newInteger(i1);
System.out.print(i1.equals(i2));
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:false
b.
Prints:true
c.
Compiletimeerror
d.
Runtimeerror
e.
Noneoftheabove

Pregunta15:
Whichoftheinstancecreationexpressionsproducearuntimeerror?

a.
newFloat('A')
b.
newFloat("A")
c.
newFloat(1L)
d.
newFloat("1L")
e.
newFloat(0x10)
f.
newFloat("0x10")

g.
newFloat("010")

Pregunta16:
Whichofthefollowingarenotmethodsofthejava.lang.Stringclass?

a.
append
b.
concat
c.
delete
d.
insert
e.
replace
f.
substring
g.
valueOf

Pregunta17:
Whichofthefollowingmethodsarestaticmembersofthe
java.lang.Doubleclass?

a.
doubleValue
b.
floatValue
c.
intValue
d.
longValue
e.
parseDouble
f.
toString(double)
g.
valueOf

Pregunta18:
Whichofthefollowingarecommandlineswitchesusedtoenable
assertionsinnonsystemclasses?

a.
ea
b.
ae
c.
aon
d.
aoff
e.
enableassertions
f.
assertionsenable
g.
assertionson
h.
assertionsoff

Pregunta19:
Whichofthefollowingisthrowntoindicatethatanassertionhas
failed?

a.
AssertError
b.
AssertException
c.
AssertionError
d.
AssertionException
e.
Noneoftheabove

Pregunta20:
classMain{
publicstaticvoidmain(String[]args){
inti=0,j=9;
do{
i++;
if(j<i++){break;}
}while(i<5);
System.out.print(i+","+j);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:5,4
b.
Prints:6,3
c.
Prints:6,6
d.
Prints:7,2
e.
Runtimeerror
f.
Compiletimeerror
g.
Noneoftheabove

Potrebbero piacerti anche