阅读下列程序,则运行结果为().fun(){ static int x=5;x++;return x;}main(){ int i,x;for(i=0;i<3;i++)x=fun();printf("%d/n",x);}
A.8
B.7
C.5
D.6
A.8
B.7
C.5
D.6
第1题
A.50,30
B.30,50
C.80,-20
D.80,20
第2题
写出下列程序的运行结果。
#include void Fun(){int num=20;cout<< "The Fun's num is"<< num<< endl;
}void main(){int num=10;cout<< "The main's num is "<< num<< endl;Fun();{int num=30;
cout<< "The Field's num is "<< num<< endl;}cout<< "The main's num is "<< num<< endl;}
第3题
阅读以下 FORTRAN 程序:
READ(* , *)X
IF(X , LE , 0)RHEN
Y=0.0
ELSEIF(X , LT , 5 , 0) , AND , (X , NE , 2 , 0)THEN
Y=1 / X
ELSEIF(X , LE , 10 , 0)THEN
Y=1 / (X+2)
ELSE
Y=10.0
ENDIF
WRITE
WRITE(* , *)Y
END
运行上述程序时,若由键盘输入: 2 ,则程序输出结果为 () 。
(A)0.0
(B)0.5
(C)0.25
(D)10.0
第4题
阅读下列FORTRAN程序: REAL A(5) COMMON /CC/X DATA A/1,2,3,4,5/ X=0 Y=FUN(A,5) +FUN(A,5) WRITE(*,*) Y END FUNCTION FUN(A,N) REAL A(N) COMMON /CC/X X=X+1 F=1 DO 10 I=N,1 F=F+A(I) 10 CONTINUE FUN=F+X END 上述程序执行后,输出结果是()。
A.4.0
B.5.0
C.16.0
D.33.0
第5题
A.输出:构造
B.输出:static构造
C.输出:static
D.没有输出结果
第6题
阅读下列程序,请写出程序的运行结果。
public class C
{
public static void main(String[] args)
{
String text="public static void main(String[] args)";
int theCount=0;
int index=-1;
String theStr="i";
index=text.indexOf(theStr);
while(index>=0)
{
++theCount;
index+=theStr.length();
index=text.indexOf(theStr,index);
}
System.out.println("The Text contains"+theCount+"i");
}
}
第7题
第8题
A.9
B.5
C.6
D.6.1
第9题
阅读下列程序并写出程序运行结果。
Public Sub change1(ByVal x As Integer, ByVal y As Integer)
Dim t As Integer
t = x
x = y
y = t
End Sub
Public Sub change2(x As Integer, y As Integer)
Dim t As Integer
t = x
x = y
y = t
End Sub
Private Sub Form_Click()
Dim a As Integer, b As Integer
a = 22: b = 33
change1 a, b
Form1.Print "A1="; a, "B1="; b
a = 22: b = 33
change2 a, b
Form1.Print "A2="; a, "B2="; b
End Sub
写出程序运行时,单击窗体Form1上的输出结果。
第10题