更多"请阅读下列程序代码,然后将程序的执行结果补充完整。横线处应填写的内容是"的相关试题:
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion{
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException {
System.out.println("in Situation"+se1);
if(se1==0){
System.out.println("no Exception caught");
return;
}else if(se1==1){
int iArray[]=new int[4];
iArray [1]=3;
}
}
public static void main(String args[])[
try{
Proc(0);
Proc(1);
} catch(ArraylndexOutOfBoundsException e) {
System.out.println("Catch"+e);
}finally{
System.out.println("in Proc finally");
}
}
}
执行结果:
In Situation( )
no ExcepbOn cauSht
【14】
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
Public class throwsException
static voidProc(intsel)
throws ArtthmeticExcepdon,AITaylndexOut of BoundsException
System.out println("In SimatiOn"+Sel);
if(sel==0)
System.out.println("noExceptioncallght");
return;
elseif(sel==1)
intiArray[]=newint[4];
i Array[1]=3;
public static void main(Stringargs[])
tfy
Proc(0);
Proc(1);
catch(ArraylndexOutOfBoundsExceptione)
System.out.println("Catch"+e);
flnally
Systern.out.println("inProcfinally");
执行结果:
In Situattion 0
no Exceptioncaught
inProcfinally
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsExcepfion
static void Proc(int se1)
throws ArithmeticException,ArraylndexOutOfBoundsException
System.out.println("in Situation"+se1);
if(se1==0)
System.out.println("no Exception caught");
return;
else if(se1==1)
int iArray[]=new int[4];
iArray [1]=3;
public static void main(String args[])[
try
Proc(0);
Proc(1);
catch(ArraylndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果:
In Situation( )
no ExcepbOn cauSht
【14】
in Proc findly
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
public class throwsException
static void Proc(int sel)
throws ArithmeticException,ArrayIndexOutOfBoundsException
System.out.println("In Situation"+sel);
if(sel==0)
System.out.println(’no Exception caught");
return;
else if(sel==1)
int iArray[]=new int[4];
iArray[1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch(ArrayIndexOutOfBoundsException e)
System.out.println("Catch"+e);
finally
System.out.println("in Proc finally");
执行结果:
In Situation 0
no Exception caught
【14】
in Proc finally
[单项选择]要使下列程序能够正确运行,则横线处应填写的内容是______。
import java. awt. * ;
import java. applet. * ;
public class SayHi extends Applet
public void______(Graphics g)
g. drawString("Hi!", 20,20);
A. int
B. start
C. paint
D. stop
[单项选择]下面的子程序是将AL寄存器低4位中的十六进制数转换为ASCII码,试问:该子程序中的横线处应填写什么指令
HTOASC PROC
AND AL, OFH
ADD AL, 30H
CMP AL, 39H
JBE DONE
____________
DONE: RET
HTOASC ENDP
A. SUB AL,’A’-0AH
B. ADD AL,’A’-0AH
C. SUB AL,’A’-07H
D. ADD AL,’A’-07H
[简答题]在下面程序横线处填上适当内容,使程序执行结果为:40:15程序如下:
#include<iostream.h>
template<class T>
T func(T x,T y)
if(sizeof(T)= =8)
return______;
else
return______;
void main( )
cout<<func(8,5)<<":"<<func(5.0,10.0)<<endl;
int d;cin>>d;
[简答题]在下面程序横线处填上适当内容,使程序执行结果为:
n=9
程序如下:
#include<iostream.h>
template<class T>
class Test
T n;
public:
Test( )
Test(T i)n=i;
Test<T>______(const Test <T> &s)
static Test<T>temp:
______;
return temp;
void disp( )cout<<"n="<<n<<endl;
;
void main( )
Test<int>t1(4),t2(5),t3;
t3=t1+t2:
t3.disp( );
[单项选择]下列横线处应填写的语句是______。
import java. awt. * ;
public class FirstFrame extends Frame
public static void main(String args[])
FirstFrame fr=new FirstFrame("First container!");
fr. setSize(240,240);
fr. setBackground(Color. yellow);
public FirstFrame(String str)
super(str);
A. fr. setVisible(true)
B. fr. setVisible(false)
C. fr. setFrame(true)
D. fr. setmyFrame(true)
[简答题]在下面程序的横线处填上适当内容,使程序执行结果为:"hello,andylin"。
#include<iostream>
#include<string.h>
using namespace std;
class mystring
public:
char*pdata;
mystring(int len)
pdata=new char[len+1];
~mystring( )
delete pdata;
void show( )cout<<pdata<<endl;
;
void fun(mystring**array,int len)
mystring*old=*array;
______
memcpy(*array,old,len);
void main( )
mystring str(20);
mystring*pstr=&str;
mystring**ppstr=&pstr;
strcpy(str.pdata,"hello,andylin");
fun(ppstr,20);
______