随机组卷按大纲配比:判断 8 · 单选 20 · 填空 10 · 综合 2(共 40 题 · 80 分)
- 单选已知职工记录描述如下,设变量w中的“生日”是“1993年10月25日”,下列对“生日”的正确赋值方式是( )。 struct worker { int no; char name[20]; char sex; struct { int day; int month; int year;}birth; }; struct worker w做这题 →
- 填空将一个磁盘文件中的信息复制到另一个磁盘文件中。 #include "stdio.h" main() { (1) *in,*out; char ch,infile[10],outfile[10]; printf("Enter the infile name:\n"); scanf("%s",infile); printf("Enter the outfile name:\n"); scanf("%s",outfile); if((in=fopen(infile,"r"))==NULL) { printf("Cannot open input file.\n"); exit(0); } if((out=fopen(outfile,"w"))==NULL) { printf("Cannot open output file.\n"); exit(0); } while(!feof(in)) fputc( (2) ,out);做这题 →
- 单选设a为整型变量,初值为12,执行完语句 a+=a-=a*a后,a的值是( )。做这题 →
- 单选下列标识符中,不能作为合法的C用户定义标识符的是( )。做这题 →
- 单选若给定条件表达式(M)?(a++):(a--),则其中表达式M和( )等价。做这题 →
- 单选在C语言中,if语句后的一对圆括号中,用以决定分支流程的表达式为( )。 A 只能是逻辑表达式 B只能是关系表达式 C 只能是逻辑表达式或关系表达式 D可以是任意表达式做这题 →
- 单选以下程序的输出结果为( )。 main( ) { char c; int i; for(i=65;i<68;i++) { c=i+32; switch(c) { case ‘a’:printf("%c,",c);break; case ‘b’:case ‘e’:printf("ok,"); default: printf("end"); } } }做这题 →
- 单选以下程序的输出结果为( )。 #define A 3 #define B(a) (A+1)*a main() { int x; x=3*A+B(7); printf("x=%d\n",x); }做这题 →
- 单选设有以下定义,则以下对变量w的赋值( )是错误的。 enum week{sun,mon=4,tue,wed,thu,fri,sat}w;做这题 →
- 单选以下定义结构体类型st1,其中正确的是( )。 A typedef struct student { int num; int age; }STD; STD st1; B struct st1{int num,age;}s; C struct { int num; float age;}st1; D struct st1 {int num; int age; }做这题 →
- 单选若有以下定义和语句,则值为12的表达式是( )。 struct wc{ int a;int *b;}*p; int x0[]={11,12},x1[]={31,32}; static struct wc x[2]={100,x0,300,x1}; p=x; A *++p->b B ++p->a C p->b D *(p++)->b做这题 →
- 单选要打开一个已存在的非空文件“file”用于修改,选择正确的语句( )。做这题 →
- 判断若有形参定义:int a[10];则a++是合法的表达式。( )做这题 →
- 判断若有宏定义:#define PI 3.14i5926,则系统预编译时会报错。( )做这题 →
- 判断若有定义:int a;则scanf(“%d",a);可以给变量a赋值。( )做这题 →
- 判断任何数组在使用前必须先定义。( )做这题 →
- 判断共用体变量的各个成员所占内存单元的地址相同。( )做这题 →
- 判断在使用缓冲文件系统时,与文件输入和输出相关的数据都先送到缓冲区中。( )做这题 →
- 综合main( ) { char s[20]=“I like it.”,t[20]=“Are you?”,c[20]; int i=0; while(s[++i]!=‘\0’) t[i]=s[i]; t[i]=0; printf(“string s:%s\n”,s); printf(“string t:%s\n”,t); }做这题 →
- 综合int i=5; main( ) { int i=3; { int i=10; i++; printf(“%d\n”,i); } f1( ); i+=1; printf(“%d\n”,i); } int f1( ) { i=i+1; return(i); }做这题 →
- 填空用冒泡法对任意10个整数排序。 main( ) { int a[11],i,j,t; for(i=1;i<11;i++) scanf("%d",&a[i]); printf("\n"); for(i=1; (1) ;i++) for(j=1; (2) ;j++) if(a[j+1]>a[j]) { t=a[j]; (3) ; (4) ;} printf("The sorted numbers:\n"); for(i=1;i<11;i++) printf("%4d",a[i]); printf(“\n”); }做这题 →
- 单选以下程序的输出结果为( )。 main( ) { int i=010,j=10; printf("%d,%d\n",i++,j--); }做这题 →
- 单选设i和k都是int类型,则for循环语句( )。 for(i=0,k=-1;k=1;i++,k++) printf("\n");做这题 →
- 单选以下程序的输出结果为( )。 main( ) { char c; int i; for(i=65;i<68;i++) { c=i+32; switch(c) { case 'a':case 'b':case 'c':printf("%c,",c);break; default:printf("end");} } }做这题 →
- 单选函数调用语句:fseek(fp,-10L,2);的含义是( )。 A 将文件位置指针从文件末尾处向文件头的方向移动10个字节 B 将文件位置指针从当前位置向文件头的方向移动10个字节 C 将文件位置指针从当前位置向文件末尾方向移动10个字节 D 将文件位置指针移到距离文件头10个字节处做这题 →
- 单选以下程序的输出结果为( )。 main( ) { char s1[40]="country",s2[20]="side"; int i=0,j=0; while(s1[i]!='\0') i++; while(s2[j]!='\0') s1[i++]=s2[j++]; s1[i]=0; printf("%s\n",s1); }做这题 →
- 单选下列说法不正确的是( )。 A 主函数main中定义的变量在整个文件或程序中有效 B 不同函数中,可以使用相同名字的变量 C 形式参数是局部变量 D 在一个函数内部,可以在复合语句中定义变量,这些变量只在本复合语句中有效做这题 →
- 单选在下列程序段中,枚举变量 c1的值是( )。 enum color { red,yellow,blue=4,green,white}c1; c1=yellow; c1=white;做这题 →
- 单选设有说明 int (*ptr)();其中标识符ptr是( )。做这题 →
- 单选定义由n个指向整形数据的指针组成的数组p,其正确的方式为( )。做这题 →
- 单选具有相同类型的指针类型变量p与数组a,不能进行的操作是( )。 A p=a; B *p=a[0]; C p=&a[0]; D p=&a;做这题 →
- 判断若有定义和语句:int a;char c;float f;scanf("%d,%c,%f",&a,&c,&f);若通过键盘输入:10,A,12.5,则a=10,c=‘A’,f=12.5。( )做这题 →
- 判断C语言把文件看作是一个字符(字节)的序列。( )做这题 →
- 判断若有宏定义:#define S(a,b) t=a;a=b;b=t由于变量t没定义,所以此宏定义是错误的。( )做这题 →
- 判断在Turbo C中,下面的定义和语句是合法的:file *fp;fp=fopen("a.txt","r");( )做这题 →
- 判断若有定义:char s[ ]="china";则Turbo C系统为数组s开辟6个字节的内存单元。( )做这题 →
- 判断若有定义和语句:int a[3][3]={{3,5},{8,9},{12,35}},i,sum=0;for(i=0;i<3;i++) sum+=a[i][2-i];则sum=21。( )做这题 →
- 判断若有定义和语句:struct student { int num; char name[10]; float score;} s[5]={{1,"lili",98.5},{9,"xiaohua",66}},*p=s;printf("%d",*p++);输出结果是1。( )做这题 →
- 判断在程序中定义了一个结构体类型后,可以多次用它来定义具有该类型的变量。( )做这题 →
- 判断在Turbo C中,此定义和语句是合法的:enum aa{ a=5,b,c}bb;bb=(enum aa)5;( )做这题 →
- 综合main( ) { int i=29,j=6,k=2,s; s=i+i/j%k-9; printf(“s=%d\n”,s); }做这题 →
- 综合main( ) { int x=31,y=2,s=0; do { s-=x*y; x+=2; y-=3;} while( x%3==0); printf(“x=%d\ty=%d\ts=%d\n”,x,y,s); }做这题 →
- 综合main( ) { int a[6]={10,20,30,40,50,60},i; invert(a,0,5); for(i=0;i<6;i++) printf(“%d,”,a[i]); printf(“\n”); } invert(int s[ ],int i,int j) { int t; if(i<j) { invert(s,i+1j-1); t=s[i];s[i]=s[j];s[j]=t; } }做这题 →
- 填空百马百担问题:有100匹马,驮100担货,大马驮3担,中马驮2担,两匹小马驮1担,问大、中、小马各多少匹? main( ) { int hb,hm,hl,n=0; for(hb=0;hb<=100;hb+= (1) ) for(hm=0;hm<=100-hb;hm+= (2) ) { hl=100-hb- (3) ; if(hb/3+hm/2+2* (3) ==100) { n++; printf("hb=%d,hm=%d,hl=%d\n",hb/3,hm/2,2*hl); } } printf("n=%d\n",n); }做这题 →
- 填空用“起泡法”对输入的10个字符排序后按从小到大的次序输出。 #define N 10 char str[N]; main() { int i,flag; for(flag=1;flag==1;) { scanf("%s",str); flag=0; printf("\n"); } sort(___(4)___); for(i=0;i<N;i++) printf("%c",str[i]); printf("\n"); } sort(char str[N]) { int i,j; char t; for(j=1;j<N;j++) for(i=0;(i<N-j)&&(str[i]!='\0');i++) if(str[i]>str[i+1]) { t=str[i]; ____(5)____; ____(6)____; } }做这题 →
- 填空用指针作函数参数,编程序求一维数组中的最大和最小的元素值。 #define N 10 main() { void maxmin(int arr[],int *pt1,int *pt2,int n); int array[N]={10,7,19,29,4,0,7,35,-16,21},*p1,*p2,a,b; p1=&a; p2=&b; maxmin(array,p1,p2,N); printf("max=%d,min=%d",a,b); } void maxmin(int arr[],int *pt1,int *pt2,int n) { int i; *pt1=*pt2=arr[0]; for(i=1;i<n;i++) { if(arr[i]>*pt1) (9) ; if(arr[i]<*pt2) (10) ; } }做这题 →
- 单选一个C程序的执行是从____。 A本程序的main函数开始,到main函数结束 B本程序文件的第一个函数开始,到本程序文件的最后一个函数结束 C本程序的main函数开始,到本程序文件的最后一个函数结束 D本程序文件的第一个函数开始,到本程序main函数结束做这题 →
- 单选在 C 语言中,每个语句必须以____结束。做这题 →
- 单选C 语言规定:在一个源程序中,main函数的位置____。做这题 →
- 单选一个C 语言程序是由____。做这题 →