更多"阅读下列FORTRAN77程序: DIMENSIONP(3,3) D0"的相关试题:
[单项选择]阅读下面程序:INTEGERQ(3,4)DATAQ/4*-1,4*-2,4*-3/S=0D010K=1,310S=S+Q(K,K+1)D020K=4,2,-120S=S-Q(K-1,K)WRITE(*,*)SEND上述程序运行后,输出的S值为()。
A. 0.0
B. -1.0
C. -2.0
D. -6.0
[单项选择]函数子程序FJ求一组数的和。FUNCTIONFJ(X,N)DIMENSIONX(N)S=0D010K=1,NS=S+X(K)10CONTINUEFJ=()END为了完整程序,在()处应填入()。
A. 0.0
B. S
C. X(N)
D. N
[单项选择]请阅读下面程序
publicclassExampleStringBuffer
publicstaticvoidmain(String[]args)
StringBuffersb=newStringBuffer("test");
System.out.println("buffer-,"+sb);
System.out.println("longth="+sb.1ength( ));
程序运行结果中在“length”后输出的值是( )。
A. 10
B. 4
C. 20
D. 30
[单项选择]请阅读下面程序
publicclassThreadTest
publicstaticvoidmain(Stringargs[])throwsException
inti=0;
Hellot=newHello( );
______,
while(true)
System.out.println("GoodMoming"+i++);
if(i==2&&t.isAlive( ))
System.out.println("MainwaitingforHello!");
t.join( );//等待t运行结束
if(i==5)break;
classHelloextendsThread
inti;
publicvoidrun( )
while(true)
System.out.println("Hello"+i++);
if(i==5)break;
为使该程序正确执行, 下划线处的语句应是( )。
A. sleep()
B. yield()
C. interrupt()
D. start()
[单项选择]阅读下面程序
public class OperatorsAndExpressions
void equalsMethodl( )
String s1=new String("how are you");
String s2=new String("how are you");
System.out.println(s1==s2);
public static void main(String args[])
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
OperAndExp. equalsMethod1( );
程序运行结果是( )。
A. ==
B. true
C. false
D. equal
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
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(intsel)
throws Arithmetic Exception,Array Index Out Of Bounds Exception
System.out.println("InSituation"+sel);
if(sel==0)
System.out.println("noException caught");
return;
else if(sel==1)
int iArray[]=newint[4];
iArray[-1]=3;
public static void main(String args[])
try
Proc(0);
Proc(1);
catch(Array Index Out Of Bounds Exception e)
System.out.println("Catch"+e);
finally
System.out.println("inProcfinally");
执行结果:
In Situation 0
no Exception caught
in Proc finally
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
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
[单项选择]阅读下面程序
publicclass Operators AndExpressions
voidequalsMethodl( )
Strings1=newString("howareyou");
Strings2=newString("howareyou");
System.out.println(s1==s2);
publicstaticvoidmain(Stringargs[])
OperatorsAndExpressionsOperAndExp=newOperatorsAndExpressions
( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethodl( );
程序运行结果是( )。
A. ==
B. true
C. false
D. equal
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
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
[单项选择]阅读下面程序
public class Increment {
public static void main( String args[] ){
int c;
c=5;
System.out.println(C) ;
System.out.println(c++);
System.out.println(C) ;
}
}
输出结果是【 】
A. 5 6 6
B. 5 5 6
C. 6 7 7
D. 6 6 6
[填空题]请阅读下列程序代码,然后将程序的执行结果补充完整。
程序代码:
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
______
in Proc findly
[单项选择]阅读下面程序
public class OperatorsAndExpressions
void equalsMethodl( )
String s1=new String("how are you");
String s2=new String("how are you");
System.out.println(s1==s2);
public static void main(String args[])
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
//用于复合类型数据的“==”运算符
OperAndExp.equalsMethodl( );
程序运行的结果是
A. ==
B. true
C. false
D. equal
[填空题]阅读下面程序
public class OperatorsAndExpressions
String conditionalExpression(int score)
String result;
//如果score超过60分,则结果是passed,否则是doesn’t pass
result=(score>=60)"passed":"doesn’t pass":
System.out.println(result);
return result;
public static void main(String args[])
OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions( );
//条件表达式
OperAndExp.conditionalExpression(65);
程序的执行结果是______。
[单项选择]阅读下面程序
public class ExampleStringBuffer
public static void main(String[] args)
StringBuffer sb=new StringBuffer("test");
System.out.println("buffer="+sb);
System.out.println("length="+sb.length( ));
程序运行结果中,在“length=”后输出的值是
A. 10
B. 4
C. 20
D. 30