首页 > 计算机等级考试
题目内容 (请给出正确答案)
[单选题]

有如下程序 int a[10]={1,2,3,4,5,6,7,8,9,10}; int *p=&a[3],b;b=p[5]; 则b的值是

A.5

B.6

C.9

D.8

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“有如下程序int a[10]={1,2,3,4,5,6,7,…”相关的问题
第1题
有如下程序:main(){int a[3][3]={{1,2},{3,4},{5,6}},i,j,s=0;for(i=1;i<3;i++)for(j=0;j<=i;j++

有如下程序: main() { int a[3][3]={{1,2},{3,4},{5,6}},i,j,s=0; for(i=1;i<3;i++) for(j=0;j<=i;j++) s+=a[i][j]; printf("%d\n",s); } 该程序的输出结果是______。

A.18

B.19

C.20

D.21

点击查看答案
第2题
有如下程序: #include<iostream> using namespace std; class TestClass { private: int x,y; pu
blic: TestClass (int i,int j) { x=i; y=j; } void print() { cout<<"print1"<<end1; } void print()const { cout<<"print2"<<end1; } }; int main() { const TestClass a(1,2); a.print(); return 0; } 该程序运行后的输出结果是()。

A.print1

B.print2

C.print1 print2

D.程序编译时出错

点击查看答案
第3题
有如下程序:#include<iostream>using namespace std;class sample{private:int x,y;public:sampl

有如下程序: #include<iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp() { cout<<"disp1"<<end1; } void disp()const { cout<<"disp2"<<end1; } }; int main() { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是

A.disp1

B.disp2

C.disp1 disp2

D.程序编译时出错

点击查看答案
第4题
有如下程序:#include <iostream>using namespace std;class sample{private:int x,y;public: sam

有如下程序: #include <iostream> using namespace std; class sample { private: int x,y; public: sample(int i,int j) { x=i; y=j; } void disp () { cout<<"disp1"<<end1; } void disp() const { cout<<"disp2"<<end1; };int main () { const sample a(1,2); a.disp(); return 0; } 该程序运行后的输出结果是

A.disp1

B.disp2

C.disp1 disp2

D.程序编译时出错

点击查看答案
第5题
有下列程序段:struct St{int x;int *y;)*pt;int a[]={1,2),b[]={3,4);struct st c[2]={10,a,20,b

有下列程序段: struct St {int x;int *y;)*pt; int a[]={1,2),b[]={3,4); struct st c[2]={10,a,20,b); pt=c; 下列选项中表达式的值为11的是()。

A.*pt- >y

B.pt- >x

C.+ +pt- >x

D.(pt+ +)->x

点击查看答案
第6题
有以下程序段:struct st{ int x; int * y; } * pt;int a[] = {1,2} ,b[] = {3,4};struct st c[2]

有以下程序段: struct st { int x; int * y; } * pt; int a[] = {1,2} ,b[] = {3,4}; struct st c[2] = {10,a,20,b}; pt=c; 以下选项中表达式的值为11的是()。

A.*pt->y

B.pt->x

C.++pt->x

D.(pt++)->x

点击查看答案
第7题
有下列程序段: struct st {int x;int *y;}*pt; int a[]={1,2},b[]={3,4}; struct st c[2]={10,a,20,b}; pt=c; 下列选项中表达式的值为11的是()。

A.*pt->y

B.pt->x

C.++pt->x

D.(pt++)->X

点击查看答案
第8题
有下列程序段: struct st {intx;int*y;}*pt; int a[]={1,2},b[]={3,4}; struct st c[2]={10,a,20,b}; pt=c; 下列选项中表达式的值为11的是()。

A.*pt->y

B.pt->x

C.++pt->x

D.(pt++)->x

点击查看答案
第9题
有如下程序: #include<iostream> using namespace std; class Complex { double
re,im; public: Complex(double r,double i):re(r),im(i){} double real()const{return re;} double image()const{return im;} Complex& operator+=(Complex a) { re+=a.re; im+=a.im; return *this; } }; ostream& operator<<(ostream& s,const Complex& z) { return s<<'('<<z.real()<<','<<z.image()<<')'; } int main() { Complex x(1,2),y(2,3); tout<<(x+=y)<<endl; return 0; } 执行这个程序的输出结果是()。

A.(1,-2)

B.(2,3)

C.(3,5)

D.(3,1)

点击查看答案
第10题
有如下程序段:int a[10]={1,2,3,4,5,6,7,8,9,10};int *p=&a[3],b;b=P[5];则b的值是()。A.5B.6

有如下程序段: int a[10]={1,2,3,4,5,6,7,8,9,10}; int *p=&a[3],b;b=P[5];则b的值是()。

A.5

B.6

C.9

D.8

点击查看答案
退出 登录/注册
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改