第一节 单项填空
阅读下面的句子和对话,从[A]、[B]、[C]三个选项中选出一个能填入空白处的最佳选项。
Mr. Han and his brother are from China; they______speak Chinese.
A.all
B.both
C.either
第1题
下述程序的运行结果是()。 #included stdio.h> #included strin9.h> main { char*s1="abDuj"; char*s2="ABdUG"; int t; t=strcmp(s1,s2); printf("%d",t); }
A. 正数
B.负数
C.零
D.不确定的值
第2题
下列程序的输出结果是()。
#included stdi0.h>
#included string.h>
void fun(int b[])
{ static int i=0;
do { b[i]+=b[i+1]; }
while(i<2);
}
main
{ int k,a[5]={1,3,5,4,9};
fun(a);
for(k=0;k<5;k++)
printf("%d",a[k]); }
A.13579
B.48579
C.48549
D.48999
第3题
下列程序的输出结果是()。 #included stdi0.h> #included string.h> void fun(int b[]) { static int i=0; do { b[i]+=b[i+1]; }while(i<2); } main { int k,a[5]={1,3,5,4,9}; fun(a); for(k=0;k<5;k++)printf("%d",a[k]); }
A.13579
B.48579
C.48549
D.48999
第4题
A.2.500000
B.2.750000
C.3.375000
D.3.000000
第5题
有如下程序:
#included<iostream>
usingnamespacestd;
classTestClass
{private:
intX,y;
public:
TestClass(inti,intj)
{x=i;
y=j;}
voidprint()
{cout<<"printl"<<endl;}
voidprint()const
{cout<<"print2"<<endl;}};
intmain()
{constTestClassa(1,2);
print();
return0;}
该程序运行后的输出结果是()。
A.printl
B.print2
C.printlprint2
D.程序编译时出错
第6题
下列程序的输出结果是()。
#included<iostream>
usingnamespacestd;
intmain()
{
chara[]="Hell0,Test";
char*p=a;
while(*p)
{
if(*p>='a'&&*p<='z')
cout<<char(*p+'A'-'a');
elsecout<<*P;
p++;
}
return0;
}
A.hello,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
第7题
有如下程序:
#included<iostream>
usingnamespacestd;
classTestClass
{inta;
pubIic:
TestClass(intx){a=x;}
voidshow(){cout<<a;)};
classTestClassl:publicTestClass
{intb;
public:
TestClassl(inti):TestClass(i+1),b(i){}
voidshow(){cout<<b;)};
intmain()
{TestClassb(5),*P;
TestClassld(1):
p=&d;
p->show();
return0;}
该程序运行后的打印结果是()。
A.5
B.1
C.0
D.2
第8题
有如下程序:
#included<iostream>
using namespace std;
class CD{
public:
~CD(){cout<<’C’;)
private:
char name[80];
};
int main()(CD a,*b,d[2];return 0;}
运行时的输出结果是
A.CCCC
B.CCC
C.CC
D.C
第9题
有如下程序:
#included<iostream>
using namespace std;
class CD{
public:
~CD(){cout<<’C’;)
private:
char name[80];
};
int main()(CD a,*b,d[2];return 0;}
运行时的输出结果是
A.CCCC
B.CCC
C.CC
D.C
第10题
有以下程序:
included<iostream>
using namespace std;
class Base
{
public:
Base()
{
x=0;
}
int x;
};
class Derived1:virtual public Base
{
public:
Derived1()
{
x=10;
}
};
class Derived2:virtual public Base
{
public:
Derived2()
{
x=20;
}
};
class Derived: public Derived1,protected Derived2
{ };
int main()
{
Derived obj;
cout<<obj. x<<endl;
return 0;
}
该程序运行后的输出结果是______。
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!