更多"[单选题]以下程序的输出是()。
struct st
{ int x;"的相关试题:
[单选题]有以下程序段
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 n; struct st *next;};
static struct st a[3]={5,&a[1],7,&a[2],9,0 },*p;
p=&a[0];
A.p++->n
B. ++p->n
C. p->n++
D.(*p).n++
[单选题]以下程序的输出结果是()。
struct HAR
{ int x, y; struct HAR *p;
} h[2];
main()
{h[0].x=1;
h[0].y=2;
h[1].x=3;
h[1].y=4;
h[1].p=&h[1];
h[1].p=h;
printf("%d %d \n",(h[0].p)->x,(h[1].p)->y);
}
A.1 2
B.2 3
C.1 4
D.3 2
[单选题]以下程序的输出结果是()。
union myun
{ struct
{ int x, y, z; } u;
int k;
} a;
main()
{ a.u.x=4; a.u.y=5; a.u.z=6;
a.k=0;
printf("%d\n",a.u.x);}
A.4
B.5
C.6
D.0
[单选题]下面程序的输出结果为()。
struct st
{ int x;
int *y;
} *p;
int dt[4]={10,20,30,40};
struct st aa[4]={ 50,&dt[0],60,&dt[1],70,&dt[2],80,&dt[3] };
main()
{ p=aa;
printf("%d\n", ++p->x );
printf("%d\n", (++p)->x);
printf("%d\n", ++( *p->y));
}
A.10
20
20
B.50
20
20
C.51
60
21
D.60
70
31
[单选题]有以下程序
struct stu
{ int num;
char name[10];
int age;
};
void fun(struct stu *p)
{ printf("%s\n",(*p).name); }
main()
{
struct stu students[3]={{9801,"Zhang",20},
{9802,"Wang",19},
{9803,"Zhao",18} };
fun(students+2);
}
输出结果是()。
A.Zhang
B.Zhao
C.Wang
D.18
[单选题]有以下程序
#include
struct tt
{int x;struct tt *y;} *p;
struct tt a[4]={20,a+1,15,a+2,30,a+3,17,a};
void main()
{
int i;
p=a;
for(i=1;i<=2;i++)
{printf("%d,",p->x); p=p->y;}
}
执行后的输出结果是( )。
A.20,15,
B.20,14,
C.28,13,
D.15,20,
[单选题]定义struct st
{int x;
float y;
double z;
} b;
则b是字节数 。
A.4
B.8
C.10
D.16
[单选题]下列程序的输出结果是()。
struct abc
{ int a, b, c; };
main()
{ struct abc s[2]={{1,2,3},{4,5,6}}; int t;
t=s[0].a+s[1].b;
printf("%d \n",t);
}
A.5
B.6
C.7
D.8
[单选题]8、 有以下程序
struct STU{
char name[10];
int num;
};
void f1(struct STU c)
{ struct STU b={"LiSiGuo",2042};
c=b;}
void f2(struct STU *c)
{ struct STU b={"SunDan",2044};
*c=b;
}
main( )
{ struct STU a={"YangSan",2041},b={"WangYin",2043};
f1(a);f2(&b);
printf("%d %d\n",a.num,b.num);}
执行后的输出结果是 ()。
A.2041 2044
B.2041 2043
C.2042 2044
D.2042 2043
[单选题]设有以下说明语句
typedef struct
{ int n;
char ch[8];
} PER;
则下面叙述中正确的是( )。
A.PER 是结构体变量名
B.PER是结构体类型名
C.typedef struct 是结构体类型
D.struct 是结构体类型名
[单选题]以下程序输出结果是 。
#include "stdio.h"
void f ();
main()
{int a;
for(a=1;a<=3;a++)
fun();
}
void fun()
{static int i=1;
i+=3;
printf("%2d",i);
}
A.4 7 10
B.4 4 4
C.4 5 6
D.4 6 8
[单选题]以下程序输出结果是()。
main()
{ int m=5;
if(m++>5) printf("%d\n",m);
esle printf("%d\n",m- -);
}
A.7
B.6
C.5
D.4
[单选题]以下程序输出到文件text.csv里的结果是:()
Fo=open("text.csv",'w')
X=[90,87,93]
Z=[]
Foryinx:
Z.append(str(y))
Fo.write(",".join(z))
Fo.close()
A.[90,87,93]
B.90,87,93
C.'[90,87,93]'
D.‘90,87,93’
[单选题]以下不是程序输出结果的选项是:()
Importrandomasr
Ls1=[12,34,56,78]
R.shuffle(ls1)
Print(ls1)
A.[12,78,56,34]
B.[56,12,78,34]
C.[12,34,56,78]
D.[12,78,34,56]
[单选题]设有如下定义:
struct sk
{int a;float b;}data,*p;
若有p=&data;,则对data中的a域的正确引用是()。
A.(*p).data.a
B.(*p).a
C.p->data.a
D.p.data.a
[单选题]以下程序的输出结果是()。
long fun( int n)
{ long s;
if(n==1||n==2)s=2;
else s=n-fun(n-1);
return s;}
main()
{ printf("%ld\n", fun(3)); }
A.1
B.2
C.3
D.4
[单选题]以下程序的输出结果是:()
Ss=set("htslbht")
Sorted(ss)
Foriinss:
Print(i,end='')
A.htslbht
B.hlbst
C.tsblh
D.hhlstt
[单选题]有以下程序,若运行时从键盘输入:18,11<回车>,则程序的输出结果是( ) 。
main()
{ int a,b;
printf("Enter a,b:"); scanf("%d,%d",&a,&b);
while(a!=b)
{ while(a>b) a -= b;
while(b>a) b -= a;
}
printf("%3d%3d\n",a,b);
}
A.1 1
B.2 1
C.2 2
D.3 3