更多"[单选题]下列程序执行后的输出结果是()。
main()
{ char"的相关试题:
[单选题]下列程序执行后的输出结果是( )。 #include "stdio.h"
void main()
{
int i;
for(i=1;i+1;i++)
{
if(i>4)
{ printf("%d\n",i);
break;
}
printf("%d\n",i++);
}
}
A.1 3 5
B.1
3
5
C.1
2
3
D.1
2
4
[单选题]下面程序的输出结果是()。
#include
#include
main()
{ char *p1="abc",*p2="ABC",str[50]= "xyz";
strcpy(str+2,strcat(p1,p2));
printf("%s\n",str);}
A.xyzabcABC
B.zabcABC
C.xyabcABC
D.yzabcABC
[单选题]下列程序执行后的输出结果是()。
#define MA(x) x*(x-1)
main()
{
int a=1,b=2; printf("%d \n",MA(1+a+b));
}
A.6
B.8
C.10
D.12
[单选题]下列程序的输出结果是()。
main()
{ char a[10]={9,8,7,6,5,4,3,2,1,0},*p=a+5;
printf("%d",*--p);
}
A.非法
B.a[4]的地址
C.5
D.3
[单选题]若有以下程序段,输出结果是( )。
char s[ ]="\\141\141abc\t";
printf ("%d\n",strlen(s));
A.9
B.12
C.13
D.14
[单选题]有以下程序
main()
{ char s[ ]= "abcde"; s+=2; printf("%d\n",s[0]); }
执行后的结果是()。
A.输出字符a的ASCII码
B.输出字符c的ASCII码
C.输出字符c
D.程序出错
[单选题]下面代码的输出结果是()
A="Python"
B="A、Superlanguage"
Print("{:->10}:{:-<19}".format(a,b))
A.----Python:A、Superlanguage----
B.----Python:----A、Superlanguage
C.ThepythonlanguageisA、multimodellanguage.
D.Python----:----A、Superlanguage
[单选题]下面的程序执行后,文件test中的内容是 ()。
void fun(char *fname,char *st)
{ FILE *myf; int i;
myf=fopen(fname,"w" );
for(i=0;st[i];i++)
fputc(st[i],myf);
fputc('\0',myf);
fclose(myf);
}
main()
{ fun("test","new world"); fun("test","hello,");}
A.hello,
B.new worldhello,
C.new world
D.hello, rld
[单选题]以下程序输出结果是 。
#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
[单选题]下列程序段执行后,s的值是( )
static char ch[]="600";
int a,s=0;
for(a=0;ch[a]>='0'&&ch[a]<='9';a++)
s=10*s+ch[a]-'0';
A.600
B.6
C.0
D.出错
[单选题]阅读下面的程序,运行结果是()。
main()
{
char *str="ABCabcd";
bubble(str,5);
printf("\n%s",str);
}
bubble(str,count)
char *str;
int count;
{
int i,j=count;
char tmp;
while(j-->1)
for(i=0;iA.bacdCBA
B.baCBAcd
C.cdbaCBA
D.bCBAacd
[单选题]以下程序输出结果是()。
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’
[单选题]请读程序.则下面程序的输出结果是( ) m=1234.123; pitf(%8.3f3n",m); pit("%10.3n"r,m);
A.1234.12300- 1234.123... 选项1
B.1234.123 1234.123 选项34
C.1234.123 1234.12300- 选项33
D.1234.12300 1234.123 选项2
[单选题]有以下程序,若运行时从键盘输入: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
[单选题]下列程序的输出结果是 ( )。
#include "stdio.h"
main()
{ int i,a=0,b=0;
for(i=1;i<10;i++)
{ if(i%2==0)
{a++;
continue;}
b++;}
printf("a=%d,b=%d",a,b); }
A.a=4,b=4
B. a=4,b=5
C. a=5,b=4
D. a=5,b=5
[单选题]以下程序的输出结果是()。
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 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