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

若有定义:int x=0, *p=&x;, 则语句 printf("%d\n",*p);的输出结果是()。A.随机值B.0C.x 的地

若有定义:int x=0, *p=&x;, 则语句 printf("%d\n",*p);的输出结果是()。

A.随机值

B.0

C.x 的地址

D.p的地址

查看答案
答案
收藏
如果结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能还需要:
您的账号:
发送账号密码至手机
发送
安装优题宝APP,拍照搜题省时又省心!
更多“若有定义:int x=0, *p=&x;, 则语句 …”相关的问题
第1题
若有定义int x=0,*p=&x;,则语句printf("%d\n",*p);的输出结果是 ______。

A.随机值

B.0

C.x的地址

D.p的地址

点击查看答案
第2题
若有定义语句:int x=10;则表达式x-=x+x的值为()。

A.-10

B.-20

C.0

D.10

点击查看答案
第3题
若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {
若有以下程序:#include using namespace std ; class Point { int x, y; public :Point () {

若有以下程序:

#include using namespace std ; class Point { int x, y; public :

Point () { x = 0; y = 0; } void SetPoint (int x1, int y1) { x = x1; y = y1; } void DisPoint () { cout << "x=" << x << "," << "y=" << y << endl ; } }; int main() { Point * p = new Point ; p-> SetPoint (5, 12); p-> DisPoint (); delete p; return 0; } 上面程序的输出结果为:

点击查看答案
第4题
若有以下程序:#include<iostream>using namespace std;class A{private:int x;public:int z;void

若有以下程序:#include<iostream>using namespace std;class A {private: int x;public: int z; void setx(int i) { x=i; } int getx () { return x; }}:class B : public A{private: int m;public: int p; void setvalue(int a, int b, int c) { setx(a) ; z=b; m=c; } void display{) { cout<<getx ()<<", "<<z<<", "<<m<<end1; }};int main(){ B obj; obj. setvalue(2,3,4); obj.display(); return 0;} 程序运行以后的输出结果是

A.产生语法错误

B.2,3,4

C.2,2,2

D.4,3,2

点击查看答案
第5题
若有以下程序:#include 〈iostream〉using namespace std;class A{private: int x;public: int z;

若有以下程序: #include 〈iostream〉 using namespace std; class A { private: int x; public: int z; void setx(int i) { x=i; } int getx () { return x; } }; class B : public A { private: int m; public: int p; void setvalue(int a,int b, int C) { setx (A) ; z=b; m=c; } void display() { cout〈〈getx()〈〈","〈〈z〈〈","〈〈m〈〈end1; } }; int main () { B obj; obj.setvalue(2,3,4); obj.display(); return 0; } 程序运行以后的输出结果是()。

A.产生语法错误

B.2,3,4

C.2,2,2

D.4,3,2

点击查看答案
第6题
若有以下程序:#include <iostream>using namespace std;class A{private:int x;public:int z;voi

若有以下程序:#include <iostream>using namespace std;class A{private: int x;public: int z; void setx(int i) { x=i; } int getx() { return x; }};class B: public A{private: int m;public: int p; void setvalue(int a, int b, int c) { setx(a); z=b; m=c; } void display() { cout<<getx()<<","<<z<<","<<m<<end1; }};int main(){ B obj; obj.setvalue(2,3,4); obj.display(); return 0;程序运行以后的输出结果是()

A.产生语法错误

B.2,3,4

C.2,2,2

D.4,3,2

点击查看答案
第7题
若有以下程序:#include <iostream>using namespace std;class Base{ int x;protected: int y;pub

若有以下程序: #include <iostream> using namespace std; class Base { int x; protected: int y; public: int z; void setx(int i) { x=i; } int getx () { return x; } }; class Inherit : private Base { private: int m; public: int p; void setvalue(int a,int b,int c, int d) { setx(a) ; y=b; z=c; m=d; } void display() { cout<<getx ()<<", "<<y<<", "<<z<<", "<<m<<end1; } }; int main() { Inherit A; A.setvalue(1,2,3,4); A.display(); return 0; } 程序运行后的输出结果是()。

A.1,2,3,4

B.产生语法错误

C.4,3,2,1

D.2,3,4,5

点击查看答案
第8题
以下程序的定义语句中,x[1]的初值是 [9] ,程序运行后输出的内容是 [10] 。include <stdio.h>main(

以下程序的定义语句中,x[1]的初值是 [9] ,程序运行后输出的内容是 [10] 。

include <stdio.h>

main()

{ int x[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},*p[4],i;

for(i=0;i<4;i++)

{ p[i]=&x[2*i+1];

printf("%d",p[i][0]);

}

printf("\n");

}

点击查看答案
第9题
以下程序段的定义语句中, x[1] 的初值是 【 9 】 ,程序运行后输出的内容是 【 10 】 。#include &

以下程序段的定义语句中, x[1] 的初值是 【 9 】 ,程序运行后输出的内容是 【 10 】 。

#include <stdio.h>

main()

{ int x[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16},*p[4],i;

for(i=0;i<4;i++)

{ p[i]=&x[2*i+1];

printf("%d",p[i][0]);

}

printf("\n");

}

点击查看答案
第10题
设有定义语句 int x[6]={2,4,6,8,5,7},*p=x,i; 要求依次输出x数组6个元素中的值,不能完成此操作
的语句是______。

A.for(i=0;i<6;i++) printf("%2d",*(p++));

B.for(i=0;i<6;i++) printf("%2d",*(p+i));

C.for(i=0;i<6;i++) printf("%2d",*p++);

D.for(i=0;i<6;i++) printf("%2d",(*p)++);

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