更多"[单选题]有以下程序
#include <stdio.h>
ma"的相关试题:
[单选题]有以下程序
#include
struct ord
{ int x,y;}dt[2]={1,2,3,4};
main()
{
struct ord *p=dt;
printf("%d,",++(p->x)); printf("%d\n",++(p->y));
}
程序运行后的输出结果是()。
A.1,2
B.4,1
C. 3,4
D.2,3
[单选题]有以下程序
#include
struct S
{ int a,b;}data[2]={10,100,20,200};
main()
{ struct S p=data[1];
printf("%d\n",++(p.a));
}
程序运行后的输出结果是()。
A.10
B.11
C.20
D.21
[单选题]有以下程序
#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,
[单选题]有以下程序
#include
main()
{ char p[]={′a′, ′b′, ′c′},q[10]={ ′a′, ′b′, ′c′};
printf("%d%d\n",strlen(p),strlen(q));}
以下叙述中正确的是 ( )。
A.在给p和q数组置初值时,系统会自动添加字符串结束符,故输出的长度都为3
B. 由于p数组中没有字符串结束符,长度不能确定,但q数组中字符串长度为3
C.由于q数组中没有字符串结束符,长度不能确定,但p数组中字符串长度为3
D.由于p和q数组中都没有字符串结束符,故长度都不能确定
[单选题]有以下程序
#include
main()
{ int x;
scanf("%d",&x);
if(x>15) printf("%d",x-5);
if(x>10) printf("%d",x);
if(x>5) printf("%d\n",x+5);
}
若程序运行时从键盘输入12<回车>,则输出结果为( )。
A.7
B.1217
C.12
D.17
[单选题]有以下程序
#include
main()
{ char a[30],b[30];
scanf("%s",a);
gets(b);
printf("%s\n %s\n",a,b);
}
程序运行时若输入:
how are you? I am fine<回车>
则输出结果是()。
A.how are you?
B.how
are you? I am fine
C.how are you? I am fine
D.how
are
you?
[单选题]有以下程序
#include
main()
{ unsigned char a=8,c;
c=a>>3;
printf("%d\n",c);
}
程序运行后的输出结果是()。
A.32
B.16
C.1
D.0
[单选题]有以下程序
#include
void main()
{
int s,i,sum();
for (i=1;i<=10;i++)
s=sum(i);
printf("s=%d\n",s);
}
sum(int k)
{
int x=0;
return (x+=k);
}
程序运行后的输出结果是 ( )。
A.55
B.45
C.15
D.10
[单选题]有以下程序
#include
void main()
{
int j,a[]={1,3,5,7,9,11,13,15},*p=a+5;
for(j=3;j;j--)
{
switch(j)
{
case 1:
case 2:printf("%d",*p++);
case 3:printf("%d",*(--p));
}
}
}
执行后的输出结果是( )。
A.9911
B.79911
C.99999
D.991113
[单选题]有以下程序
#include
void main( )
{ int a=1,*p,**pp;
pp=&p;
p=&a;
a++;
printf ("%d,%d,%d\n", a,*p, **pp);
}
执行后的输出结果是( )。
A.2,1,1
B.2,1,2
C.2,2,2
D.1,1,1
[单选题]有以下程序
#include
void main ( )
{ int a[]={1, 2, 3, 4, 5} ;
int x, y, *p;
p=&a[0];
x=*(p+2);
y=*(p+4);
printf("%d,%d,%d\n", *p, x, y);
}
执行后的输出结果是( )。
A.1,3,5
B.1,2,3
C.1,2,4
D.1,4,5