阅读下列程序并写出程序运行结果。
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上的输出结果。
阅读下列程序,请写出程序的运行结果。
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");
}
}
写出下列程序的运行结果。
#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;}
阅读下列程序,请写出该程序的输出结果。
public class C
{
int x=10;
static int y=20;
public static void main(String[] args)
{
C obj1=newC();
C obj2=newC();
obj1.x*=2;
obj1.y*=3;
obj2.x+=4;
obj2.y+=5;
System.out.println(obj1.x);
System.out.println(obj1.y);
System.out.println(obj2.x);
System.out.println(obj2.y);
}
}
(1)根据上述要求,写出8253计数器0计数初值的计算步骤。
(2)根据上述要求编写8253的计数器0的初始化程序段(计数初值只取整数,采用二进制计数)。
阅读下列程序,请写出该程的功能。
import java.io.*;
public class Class34
{
public static void main(String[] args)
{
File inputFile=new File("file1.txt");
File utputFile=new File("file2.txt");
int ch;
try
{
FileReader in=new FileReader(inputFile);
FileWriter ut=new FileWriter(outputFile);
while((ch=in.read())!=-1)out.write(ch);
in.close();out.close();
}
catch(FileNotFoundExceptione1)}
{System.out.println("文件没有找到!"+e1);}
catch(IOException e2)
{System.out.println("FilereadError!"+e2);}
}
}
(2008年) 已知顺序数据文件FILE3.DAT有如下数据: 50,54,64,55 65,70,85,90 46,73,60,72 阅读FORTRAN程序: DIMENSION M(12) OPEN(10,FILE=‘FILE3.DAT’) READ(10,*)(M(I),I=1,12) DO 10 J=1,12 IF(M(J).GE.60) N=N+1 10 CONTONUE WRITE(*,20)N 20 FORMAT(2X,‘N=’,N) END 程序运行后的输出结果是()。
A.N=7
B.N=8
C.N=4
D.N=9
运行下面的程序,单击窗体后在窗体上显示的内容是()。
Private Sub Form_Click()
For i = 1 To 10 Step 2
Print I;
Next I
End Sub