有以下程序:#include <stdio, h>#include <string, h>struet STU{ int nam; float TotalSeore;};void f( strnct STU p){ struct STU s[2] = { {20044,550} ,{20045,537} }; p.num = s [1]. num; p.TotalScore = s [1]. TotalScore;main( ){ struct STU s[2] = {{20041,703} ,{20042,580}}; f(s[0] ); printf( "%d %3.Of\n" ,s[0].num,s[0].TotalSeore); }程序运行后的输出结果是( )。
A.20045 537
B.20044 550
C.20042 580
D.20041 703
第1题:
有以下程序:#include <stdio.h>struet STU{ charname[10]; int num; float TotalSeore; };void f(struet STU * p){ struet STU s [2] = { { "SunDan" ,20044,550 } , { "Penghua" ,20045,537 } } , * q = s; ++p; ++q; *p= *q;}main( ){ struct STU s[3] = { { "YangSan" ,20041,703 }, { "LiSiGuo" ,20042,580} }; f(s) ;printf("% s % d % 3.Of\n" ,s [1]. name, s [1]. num ,s [1]. TotalScore);}程序运行后的输出结果是( )。
A.SunDan 20044 550
B.Penghua 20045 537
C.LiSiGuo 20042 580
D.SunDan 20041 703
第2题:
有以下程序 #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
第3题:
有以下程序:#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
第4题:
以下程序的输出结果为______。 #include<stdio.h> main() { int m=7,n=4; float a=20.0,b=10.0,x; x=m/2+n*a/b+1/4; printf("%f\n",x); }
A.11
B.11
C.11.25
D.11.75
第5题:
以下程序的输出结果是#include "stdio.h"main(){ int a=065; printf("%d\n",--a);}
第6题:
有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。
A.0
B.10
C.20
D.出错
第7题:
有以下程序 #include <stdio.h> #include <string.h> typedef strlIct{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); 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).printf("%s,%c,%2.0f,%2.0f",d.Name,d.sex,d.score[0],d.score[1]); } 程序的运行结果是( )。
A.Qian,f,95,92
B.Qian,m,85,90
C.Zhao,m,85,90
D.Zhao,f,95,92
第8题:
有以下程序
#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
第9题:
有以下程序: #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
第10题:
有以下程序 #include<iostream.h> struct STU { char num[10]; float score[3];}; void main( ) { struct STU s[3]={ { "20021",90,95,85 }, {"20022",95,80,75 }, {"20023",100,95,90 } },* p=s; int i; float sum=0; for(i=0;i<
A.260
B.270
C.280
D.285
第11题:
有以下程序: #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
第12题:
如果在用户的程序中要使用C库函数中的数学函数时,应在该源文件中使用的include命令是()
第13题:
有以下程序: #include <strino.h> struct STU {int num; float TotalScore; }; void f(struct STU p) {struct STU s[2]={{20044,550},{20045,537}}; p.num=s[1].num;p.TotalScore=s[1].TotalScore; } main() {struct STU s[2]={{20041,703},{20042,580}}; f(s[0]); printf("%d%3.0t\n",s[0].num,s[0].TotalScore); } 程序运行后的输出结果是 ______。
A.20045 537
B.20044 550
C.20042 580
D.20041 703
第14题:
下列程序的运行结果为【 】。
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");}
第15题:
有以下程序:
#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
第16题:
有以下程序#include "stdio.h"main(){ struct date { int number; float fenzhi; char name; }stu; printf("%d\n",sizeof(stu));} 程序的运行结果是A.3 B.5C.7 D.8
第17题:
以下程序的输出结果是【 】。
include<stdio.h>
main()
{ struct stru
{ int a;
float b;
char d[4];
};
printf("%d\n",sizeof(struct stru));
}
第18题:
以下程序的输出结果是【 14 】
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main( )
{ char *p,*q,*r,
p=q=r=(char*)malioc( sizeof(char)*20);
strcpy(p,"attaboy,welcome!");
printf(”%c%c%c\n”,p[ 11 ], q[ 3 ],r[ 4 ]);
free(p);
}
第19题:
有以下程序: #include <stdio.h> #include <string.h> main(int argc,char *argv[]) { int i,len=0; for(i=1;i<argc;i+=2)len+=strlen(argv[i]); prinff("%d\n",len); } 此程序经编译链接后生成的可执行文件是ex.exe,若运行时输入以下带参数的命令行: ex abed efg h3 k44则执行后的输出结果时( )。
A.14
B.12
C.8
D.6
第20题:
以下程序的输出结果是______。#include<stdio.h>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
第21题:
在下列# include命令中,正确的一条是 ( )
A.# include [string.h]
B.# include {math.h}
C.# include(stdio.h)
D.# include<stdio.h>
第22题:
下面的程序运行后输出为( )。 #include <stdio.h> # include <math.h> main() { int a,b; float c; b = 5;c = 6;c = b+7;b = c+1; a = sqrt((double)b+c); printf("%d,%f,%d",a+6,C,b); }
A.11.000000,12.0000000,13.000000
B.11.000000,12.000000,13
C.11.0000000,12,13
D.11,12.000000,13
第23题:
(14)以下程序运行后的输出结果是 【14】 。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{ char *p; int i;
p=(char *)malloc(sizeof(char)*20);
strcpy(p,"welcome");
for(i=6;i>=0;i--) putchar(*(p+i));
printf("\n "); free(p);
}