Hua,19,Tong,19
Hua,18,Tong,20
Tong,19,Qin,19
Hua,19,Tong,19
第1题:
有以下程序 include<stdio.h> typedef struct { int num;double s; }REC; void funl(REC *x) { x->num=23;x->s=88.5; } void main() { REC a={16,90.0}; fun1(&A); printf("%d\n",a.num); } 程序运行后的输出结果是( )。
第2题:
以下程序的输出结果是( ) #include<stdio.h> #include<string.h> main() {char str[12]={'s','t','r','i','n','g'}; printf("%d\n",strlen(str)); }
A.6
B.7
C.11
D.12
第3题:
有以下程序 #include <stdio.h> #include <string.h> typedef struct { char name[9]; char sex; float score[2]; } STU; STU f(STU a) { STU b={"Zhao", 'm', 85.0, 90.0}; int i; strcpy(a.name, b.name); a.sex = b.sex; for (i=0; i<2; i++) a.score[i] = b.score[i]; return a; } main() { STU c={"Qian", T, 95.0, 92.0}, d; d=f(c); printf("%s,%c,%2.0f,%2.0f\n", d.name, &sex, &score[O], d.score[1]); } 程序的运行结果是
A.Qian, f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,f,95,92
第4题:
有以下程序:#include <stdio.h>#include <string.h>main( ) { char a[ 7 ] = "a0 \0a0 \0"; int i,j; i = sizeof(a); j = strlen(a); printf(" % d %d \n" ,i,j); }程序运行后的输出结果是( )。
A.22
B.76
C.72
D.62
第5题:
以下程序的输出结果是【 】。
include<stdio.h>
main()
{ struct stru
{ int a;
float b;
char d[4];
};
printf("%d\n",sizeof(struct stru));
}
第6题:
有以下程序 #include <stdio.h> struct st { int x,y;} data[2]={1,10,2,20}; main() { struct st *p=data; printf("%d,",p->y); printf("%d\n",(++p)->x); } 程序的运行结果是______。
A.10,1
B.20,1
C.10,2
D.20,2
第7题:
有如下程序段#include "stdio.h"typedef union{ long x[2]; int y[4]; char z[8];}atx;typedef struct aa { long x[2]; int y[4]; char z[8];} stx;main(){ printf("union=%d,struct aa=%d\n",sizeof(atx),sizeof(stx));}则程序执行后输出的结果是A.union=8,struct aa=8 B.union=8,struct aa=24C.union=24,struct aa=8 D.union=24,struct aa=24
第8题:
下列程序的输出结果是( )。 #include<stdio.h> #include<string.h> main() { char a[]="\n123\\"; printf ("%d,%d\n",strlen(a),sizeof(a)); }
A.5,6
B.5,5
C.6,6
D.6,5
第9题:
下面程序的输出结果是 ( ) # include<stdio.h> # include<string.h> { char * p1="abc" , * p2=" ABC ",str[50]="xyz"; strcpy(str+2.strcat (pi,p2)); printf("%s\n",str);}
A.xyzabcAB
B.zabcABC
C.yzabcABC
D.xycbcABC
第10题:
以下程序 #include<stdio.h> #include<string.h> main() { char*p1="abc",*p2="ABC",str[50]="xyz"; strcpy(ar+2,strcat(p1,p2)); printf("%s\n",str); } 的输出是______。
A.xyzabcABC
B.zabeABC
C.yzabcABC
D.xyabcABC
第11题:
在下列# include命令中,正确的一条是 ( )
A.# include [string.h]
B.# include {math.h}
C.# include(stdio.h)
D.# include<stdio.h>
第12题:
有以下程序: #include <stdio.h> #include <string.h> typedef struct{char name[9];char sex;float score[2]}STU; STU f(STU A) {STU b={"Zhao",'m',85.0,90.0}; int i; strcpy(a.name,b.namC) ; a.sex=b.sex; for(i=0;i<2;i++) a.score[i]=b.score[i]; return a; } main() {STU c={"Qian",'f',95.0,92.0},d; d=f(C) ; pintf("%s,%c,%2.of.%2.of\n",d.name,d.sex,d.score[0],&score[1]); } 程序的运行结果是( )。
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,C95,92
第13题:
有以下程序: #include <stdio.h> #include <string.h> main() { char a[]={'a','b','c','d','e','f','g','h','\0'}; int i,j; i=sizeof(a); j=strlen(a); printf("%d,%d\n",i,j); } 程序运行后的输出结果是( )。
A.9,9
B.8,9
C.1,8
D.9,8
第14题:
有以下程序 #include <stdio.h> struct tt { int x; struct tt *y; } *p; struct tt a[4]= {20,a+ 1,15,a+2,30,a+3,17,a}; main() { int i; p=a; for(i=1; i<-2; i++) { printf("%d,", p->x ); p=p->y; }
A.20,30,
B.30,17
C.15,30,
D.20,15,
第15题:
下列程序的运行结果为【 】。
include<stdio.h>
include<string.h>
{ int a; char b[10]; double c; };
void f (struct A *t);
main()
{ struct A a={1001,"ZhangDa",1098.0};
f(&a) ; printf("%d,%s,%6.lf\n",a.a,a.b,a.C);
}
void f(struct A*t)
{ strcpy(t->b, "ChangRong");}
第16题:
有以下程序:
#include <stdio.h>
#include <stdlib.h>
struct NODE
{ int num;
struct NODE *next;
};
main()
{ struet NODE *p,*q,*r;
int sum=0;
p=(struct NODE *) malloc(sizeof(struct NODE));
q=(struct NODE *) malloc(sizeof(struet NODE));
r=(struct NODE *) malloc(sizeof(struct NODE));
P- >num=1;q- >num=2;r->num=3;
p- >next=q;q- >next=r;r- >next=NULL;
sum + =q- >next- >num;sum + =P- >num;
printf("%d\n",sum);
}
执行后的输出结果是( )
A.3
B.4
C.5
D.6
第17题:
有以下程序#include "stdio.h"main(){ struct date {int year,month,day;}today; printf("%d\n",sizeof(struct date));}程序的运行结果是A.6 B.8C.12 D.10
第18题:
以下程序: #include<stdio.h> #include<string.h> main() {char str[]="abcd\n\123\xab"; printf("%d",(str)); } 运行后的输出结果是( )。
A.10
B.9
C.7
D.14
第19题:
下面程序的运行结果是 ( ) # include<stdio.h> # include<string.h> main( ) { char * a="AbcdEf",* b="aBcD" a + +;b + +; printf("%d\n",strcmp(a,b)); }
A.0
B.负数
C.正数
D.无确定值
第20题:
有以下程序: #include <stdio.h>#include <string.h>void f(char * s,char*t){ char k; k=*s; *s=*t; *t=k; s++; t--; if( * s) f(s,t);}main( ){ char str[10] :"abedefg", * p; p = str + strlen(str)/2+1; f(p,p -2); printf( "% s \n" ,str);程序运行后的输出结果是( )。
A.abcdefg
B.gfedcba
C.gbcdefa
D.abedcfg
第21题:
有以下程序
#include <stdio.h>
#include <string.h>
typedef stmct{ char name[9];char sex;float score[2];}STU;
void f(STU a)
{ STU b={"Zhao",'m',85.0,90.0}; int i;
strcpy(a.name,b.name) ;
a.sex=b.sex;
for(i=0;i<2;i++) a.score[i]=b.score[i];
main( )
{ STU c={"Qian",'f',95.0,92.0};
f(c);printf("%s,%c,%2.0f,%2.0f\n",c.name,c.sex,c.score[0],c.score[1]) ;
}
程序的运行结果是
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,f,95,92
D.Zhao,m,85,90
第22题:
有以下程序: #include <stdio.h> #include <string.h> main() { char *p[10]={"abc","aabdfg","dcdbe","abbd","cd"}; printf("%d\n",strlen(p[4])); } 执行后的输出结果是( )。
A.2
B.3
C.4
D.5
第23题:
有以下程序: #include <stdio.h> #include <string.h> main() { char str[][20]={"Hello","Beijing"},*P=str[0]; printf("%d\n",strlen(p+20)); } 程序运行后的输出结果是( )。
A.0
B.5
C.7
D.20
第24题:
如果在用户的程序中要使用C库函数中的数学函数时,应在该源文件中使用的include命令是()