第1题:
下列程序的运行结果是【 】。
public class Test {
public static void main (String args[]) {
String s1="hello!";
System.out.println (s1.toUpperCase());
}}
第2题:
( 28 )有如下程序
#include <iostream>
using namespace std;
class Test{
public:
Test(){ }
Test(const Test &t) {cout<<1;}
};
Test fun(Test &u) {Test t=u; return t;}
int main(){Test x,y; x=fun(y); return 0;}
运行这个程序的输出结果是
A )无输出
B ) 1
C ) 11
D ) 111
第3题:
有下列程序 program test(input,output); var s:integer; ch:char; count:array[‘a‘..‘z‘]of integer; begin for ch:=‘a‘to‘z‘do count[ch]:=0; read(ch); while not eoln do begin if(ch>=‘a‘)and(chx[5])and(x[c]/c0) or not(x[a+b]>(a+b))的值是( )。
Atrue
Bfalse
C0
D1
第4题:
下列程序的运行结果是【 】。
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;
}
第5题:
下列程序的执行结果是 ( ) 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.运行成功,但不输出
第6题:
请分析下列程序。 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
第7题:
有如下程序: #include using namespace std; Class Test{ public: Test(){} Test(const Test&t){cout<<1;} ); Test fun(Test &u){Test t=u;retum t;} int main(){Test X,y;x=fun(y);retum 0;} 运行这个程序的输出结果是( )。
A.无输出
B.1
C.11
D.111
第8题:
下面程序的运行结果是【 】。
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;
}
第9题:
执行下列程序的结果是( )。 #include<iostream.h> void main() { char *str; str="test!"; cout<<str[5]; }
A.test!
B.test
C.空字符
D.异常
第10题:
下列程序段的运行结果是______。
Dimnum As Integer,a As Integer,b As Integer
a=88:b=24
Do
While b<>0
num=a Modb
a=b
b=num
Wend
Printa
Loop