Вы находитесь на странице: 1из 4

Alumno:___________________________

Fecha:______________

Pregunta1:
classMain{
staticStringm1(inti){return"I";}
staticStringm1(longi){return"L";}
staticStringm1(floati){return"F";}
staticStringm1(doublei){return"D";}
publicstaticvoidmain(String[]args){
System.out.print(m1(Math.abs(1.0f))+m1(Math.abs(1.0d)));
System.out.print(m1(Math.sqrt(1.0f))+m1(Math.sqrt(1.0d)));
}}

Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:IIII
b.
Prints:ILIL
c.
Prints:LLLL
d.
Prints:FDFD
e.
Prints:FDDD
f.
Prints:DDFD
g.
Prints:DDDD
h.
Noneoftheabove

Pregunta2:

classMain{
publicstaticvoidmain(String[]args){
System.out.print(Math.floor(3.6)+","+Math.ceil(3.6)+",");
System.out.print(Math.floor(3.6)+","+Math.ceil(3.6));
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:3.0,4.0,3.0,4.0
b.
Prints:3.0,4.0,4.0,3.0
c.
Prints:4.0,3.0,3.0,4.0
d.
Prints:4.0,3.0,4.0,3.0
e.
Prints:4.0,4.0,3.0,3.0
Compiletimeerror
f.

g.
Runtimeerror
h.
Noneoftheabove

Pregunta3:
WhichofthesewordsbelongtothesetofJavakeywords?

a.
Double
b.
goto
c.
min
d.
extern
e.
new
f.
signed
g.
finally
h.
const
i.
and
j.
array
k.
do

Pregunta4:

classMain{
publicstaticvoidmain(String[]args){
Stringa="abcd";//1
Stringb="'\u0041'";//2
Stringc="\u0041";//3
Stringd="\uD7AF";//4
System.out.print(a+b+c+d);//5
}}
Acompiletimeerrorisgeneratedatwhichline?

a.
1
b.
2
c.
3
d.
4
e.
5
f.
Noneoftheabove

Pregunta5:
classMain{
publicstaticvoidmain(String[]args){
booleanb=true;

if(b=false){System.out.print("A");
}elseif(b){System.out.print("B");
}else{System.out.print("C");}
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:A
b.
Prints:B
c.
Prints:C
d.
Runtimeerror
e.
Compiletimeerror
f.
Noneoftheabove

Pregunta6:
classColorExceptionextendsException{}
classWhiteExceptionextendsColorException{}
classWhite{
voidm1()throwsColorException{thrownewWhiteException();}
voidm2()throwsWhiteException{}
publicstaticvoidmain(String[]args){
Whitewhite=newWhite();
inta,b,d,f;a=b=d=f=0;
try{white.m1();a++;}catch(ColorExceptione){b++;}
try{white.m2();d++;}catch(WhiteExceptione){f++;}
System.out.print(a+","+b+","+d+","+f);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:0,1,0,0
b.
Prints:1,1,0,0
c.
Prints:0,1,1,0
d.
Prints:1,1,1,0
e.
Prints:1,1,1,1
f.
Compiletimeerror
g.
Runtimeerror
h.
Noneoftheabove

Pregunta7:
classLevel1ExceptionextendsException{}
classLevel2ExceptionextendsLevel1Exception{}
classLevel3ExceptionextendsLevel2Exception{}

classBrown{
publicstaticvoidmain(Stringargs[]){
inta,b,c,d,f;a=b=c=d=f=0;
intx=2;
try{
switch(x){
case1:thrownewLevel1Exception();
case2:thrownewLevel2Exception();
case3:thrownewLevel3Exception();
}a++;}
catch(Level3Exceptione){b++;}
catch(Level2Exceptione){c++;}
catch(Level1Exceptione){d++;}
finally{f++;}
System.out.print(a+","+b+","+c+","+d+","+f);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:0,0,0,1,1
b.
Prints:0,0,1,1,1
c.
Prints:0,1,1,1,1
d.
Prints:1,1,1,1,1
e.
Prints:0,0,1,0,1
f.
Prints:0,1,0,0,1
g.
Prints:1,0,0,0,1
h.
Compiletimeerror
i.
Runtimeerror
j.
Noneoftheabove

Pregunta8:

importjava.util.*;
classMain{
publicstaticvoidmain(String[]args){
Objecti=newArrayList().listIterator();
System.out.print((iinstanceofList)+",");
System.out.print((iinstanceofIterator)+",");
System.out.print(iinstanceofListIterator);
}}
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

Pregunta9:
InadditiontoimplementingtheListinterface,whichofthefollowingalso
providesmethodstoget,addandremoveelementsfromtheheadandtail
ofthelistwithoutspecifyinganindex?

a.
Collection
b.
ArrayList
c.
LinkedList
d.
List
e.
Vector
f.
Noneoftheabove

Pregunta10:
classMain{
publicstaticvoidmain(String[]args){
shortx3=0;shortx4=1;
shortb1=Math.min(x3,x4);//1
intc1=Math.min(0,1);//2
longd1=Math.min(0L,+1L);//3
System.out.print(b1+","+c1+","+d1);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:0,0,0
b.
Compiletimeerrorat1
c.
Compiletimeerrorat2
d.
Compiletimeerrorat3
e.
Runtimeerror
f.
Noneoftheabove

Pregunta11:
classC{
publicstaticvoidmain(Stringargs[]){
Strings1="1",s2="2";
Byteb1=Byte.parseByte(s1);
Byteb2=Byte.parseByte(s2);
System.out.print(b1.byteValue()+b2.byteValue());
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:3
b.
Prints:12
c.
Compiletimeerror
d.
Runtimeerror
e.
Noneoftheabove

Pregunta12:
Whichofthemethodinvocationexpressionswouldproducearuntime
error?

a.
Long.parseLong("1")
b.
Long.parseLong("1L")
c.
Long.parseLong("010")
Long.parseLong("0x10")
d.
e.
Long.parseLong("1.0")

Pregunta13:
Whichofthemethodinvocationexpressionswouldproducearuntime
error?

a.
Long.parseLong("1")
b.
Long.parseLong("+1")
c.
Long.parseLong("01")
d.
Long.parseLong("1L")
e.
Long.parseLong("1.0")

Pregunta14:

classMain{
publicstaticvoidmain(String[]s){
Strings1="A",s2="B",s3="C";

s2.trim();s3.append("D");
System.out.print(s1+s2+s3);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

a.
Prints:ABC
b.
Prints:ABC
c.
Prints:ABCD
d.
Prints:ABDC
e.
Prints:ABCD
f.
Prints:ABDC
g.
Compiletimeerror
Runtimeerror
h.
i.
Noneoftheabove

Pregunta15:
Whichofthefollowingmethodsofthejava.lang.Integerclassreturnsa
primitiveinttype?

a.
intValue
b.
parseInt
c.
valueOf

Pregunta16:
Whichmethodsofthejava.lang.Doubleclassdeclarea
NumberFormatExceptioninthethrowsclause?

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

Pregunta17:

classMain{
staticintm1(intx){return++x;}
publicstaticvoidmain(String[]args){
intx=1;

inty=m1(x);
System.out.println(x+","+y);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

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

Pregunta18:
classMain{
staticintx=1;
voidm1(inti){x++;i++;}
publicstaticvoidmain(String[]args){
inty=3;m1(y);
System.out.println(x+","+y);
}}
Whatistheresultofattemptingtocompileandruntheprogram?

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

Вам также может понравиться