二级c语言
二级C语言是全国计算机等级考试中的一项,是很多非计算机专业朋友需要获得的证书,这里收集大量的二级C语言相关的教程和题目
-
有以下程序:#include <stdio.h> main() { FILE *f; f=fopen("filea.txt","w"); fprintf(f,"abc"); fclose(f); }若文本文件filea.txt中原有内容为:hello,则运行以上程序后,文件filea.txt中的内容为( )。
-
有以下程序:#include <stdio.h> void fun(char*s) { while(*s) { if(*s%2==0)printf("%c",*s); s++; } } main() { char a[]=("good"); fun(a); printf("\n"); }注意:字母a的ASCII码值为97,程序运行后的输出结果是( )。
-
有以下程序:#include <stdio.h> int b=2; int fun(int*k) { b=*k+b; return(b); } main() { int a[10]={1,2,3,4,5,6,7,8},i; for(i=2;i<4;i++) { b=fun(&a[i])+b; printf("%d",b); } printf("\n");}程序运行后的输出结果是( )。
-
以下函数按每行8个输出数组中的数据:void fun(int *w,int n) { int i; for(i=0;i<n;i++) { ______ printf("%d",w[i]); } printf("\n");}下划线处应填入的语句是( )。
-
有以下程序:#include<stdio.h> struct ord { int x,y; }dt[2]={1,2,3,4}; main() { struct ord *p=dt; printf("%d",++p->x); printf("%d",++p->y); }程序运行后的输出结果是( )。
-
若有以下定义:int x[10],*pt=x;则对x数组元素的正确引用是( )。
-
有以下程序:#include <stdio.h> main() { int a=5,b=1,t; t=(a<<2)|b; printf("%d\n",t); }程序运行后的输出结果是( )。
-
有以下程序:#include <stdio.h> main() { int n=2,k=0; while(k++&&n++>2); printf("%d %d\n",k,n); }程序运行后的输出结果是( )。
-
在E-R图中,用来表示实体联系的图形是( )。
-
软件设计中划分模块的一个准则是( )。
-
有以下程序:#include <stdio.h> main() { int a=1,b=0; printf("%d,",b=a+b); printf("%d\n",a=2*b); }程序运行后的输出结果是( )。
-
下列数据结构中,能够按照“先进后出”原则存取数据的是( )。
-
有以下程序:#include <stdio.h> main() { char c1,c2; c1='A'+'8'-'4'; c2='A'+'8'-'5'; printf("%c,%d\n",c1,c2); }已知字母A的ASCII码为65,程序运行后的输出结果是( )。
-
有以下程序:#include <stdio.h> main() { char s[]={"012xy"}; int i,n=0; for(i=0;s[i]!=0;i++) if(s[i]>='a'&&s[i]<='z')n++; printf("%d\n",n); }程序运行后的输出结果是( )。
-
若有定义语句:int x=10;则表达式x-=x+x的值为( )。
-
有以下程序:#include <stdio.h> main() { int c=0,k; for(k=1;k<3;k++) switch(k) { default:c+=k; case 2:c++;break; case 4:c+=2;break; } printf("%d\n",c); }程序运行后的输出结果是( )。
-
有以下程序:#include <stdio.h> int f(int n); main() { int a=3,s; s=f(a); s=s+f(a); printf("%d\n",s); }int f(int n) { static int a=1; n+=a++; return n; }程序运行以后的输出结果是( )。
-
对于循环队列,下列叙述中正确的是( )。
-
有以下程序:#include <stdio.h> #include <string.h> main() { char str[][20]={"One*World","One*Dream!"},*p=str[1]; printf("%d,",strlen(p)); printf("%s\n",p); }程序运行后的输出结果是( )。
-
表达式:(int)((double)9/2)-9%2的值是( )。