Qian,f,95,92
Zhao,f,95,90
Zhao,m,95,90
Zhao,f,95,92
第1题:
有下列程序: #include <stdio.h> #include "string.h" typedef struct{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
第2题:
有以下程序 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); } 程序运行后的输出结果是( )。
第3题:
以下四个程序中,完全正确的是( )。
A.#include<stdio.h>
B.#include<stdio.h> main(); main() {/*programming*/ {/*/programming/*/ printf("programming!\n");} printf("programming!\n");}
C.#include<stdio.h>
D.include<stdio.h> main() main() {/*/*programming*/*/ {/*programming*/ printf("programming!\n");} printf("programming!\n");}
第4题:
有以下程序 #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
第5题:
以下程序的输出结果是( ) #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
第6题:
以下程序的运行结果是
#include "stdio.h"
main()
{struct date
{int year,month,day;}today;
printf("%d\n",sizeof(struct date));
}
A.6
B.8
C.10
D.12
第7题:
有以下程序: #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
第8题:
有以下程序 #include <stdio.h> #include <string.h> typedef strtlct{ char name[9]; char sex;floatscore[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
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,f,95,92
D.Zhao,m,85,90
第9题:
有以下程序 #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,
第10题:
下列程序的运行结果为【 】。
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");}