第1题:
请分析下列程序。 int main() { printf("This is in main program"); if(fork()==0) printf("I am in child process"); else printf("I am in parent process");} 程序正确运行后结果是
A.This is in main program I am in child process I am in parent process
B.This is in main program I am in child process
C.This is in main program I am in parent process
D.This is in main program I am in child process This is in main program I am in parent process
第2题:
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }
A.编译错误
B.0
C.1
D.运行成功,但不输出
第3题:
下面程序的运行结果是【 】。
inChlde<iOStream>
using namespace std;
class count
{
static int n;
public:
count()
{
n++;
}
static int test()
{
for(int i=0:i<4;i++)
n++;
return n;
}
};
int count::n=0;
int main()
{
cout<<COUnt::test()<<" ";
count c1, c2;
cout<<count::test()<<end1;
return 0;
}
第4题:
下列程序段的运行结果是( )。 Subsele() Dim n As Integer i=21:n=3 Do While i>n i=i-n Loop Print i End Sub
A.2
B.4
C.5
D.3
第5题:
下列程序段的运行结果是:Private Sub Command1_Click() Dim n AS Integer I =21: n = 3 do while I>n I=I- n Loop Print IEnd Sub在窗体上打印的结果是______。
A.3
B.5
C.6
D.8
第6题:
(12)下列程序段的运行结果是 Sub sele() Dim n As Integer I=21:n=3 Do While i>n I=i-n Loop Print i End SubA.2 B.4 C.5 D.3
第7题:
下列程序的运行结果是【 】。
include <iostream. h>
class test
{
private:
int num;
public:
test()
int TEST() {return num+100;}
~test()
};
test::test(){num=0;}
test::~test(){cout<<"Destructor is active"<<endl;}
void main()
{
test x[3]
cout<<x[1]. TEST()<<endl;
}
第8题:
下列程序的运行结果是
public class test{
private String[] data={“10”,“10.5”};
public void fun(){
double s=0;
for(int i=0;i<3;i++){
try{
s=s+Integer .parseInt(data[i]);
}catch(Exception e){
System.out.print(“errorl:”+data[i]);
}
}
}
public static void main(String[]args){
try{
testd=new test();
d .fun();
}catch(Exception e){
System.out.printIn(“error2”);
}
}
}
A.errorl:10.5
B.error2
C.errorl:10.5 error2
D.以上都不对
第9题:
阅读下列程序: Private Sub Command1_Click( ) Dim i As Integer,k As Integer k=2 For i=1 To 3 Print H(k); Next i End Sub Function H(j As Integer) a=0 Static b a=a+1 b=b+1 H=a*b+j End Function 程序运行后,单击命令按钮输出结果是
A.234
B.345
C.567
D.356
第10题:
阅读下列程序。 Private Sub Command1_Click() Dim i As Integer,k As Integer k=2 For i=1 To 3 Print Fun(k); Next End Sub Function Fun(j As Integer) Static b a=0 a=a + 1 b=b + 1 Fun=a*b+j End Function 程序运行后,单击命令按钮输出结果是
A.234
B.345
C.567
D.356