教学用TTP版C模拟题1(含答案).ppt_第1页
教学用TTP版C模拟题1(含答案).ppt_第2页
教学用TTP版C模拟题1(含答案).ppt_第3页
教学用TTP版C模拟题1(含答案).ppt_第4页
教学用TTP版C模拟题1(含答案).ppt_第5页
已阅读5页,还剩33页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1在C语言中,main()函数的特征是_。 A.可独立运行的函数 B.必不可少的函数 C.最先执行的函数 D.具有前述三特征的函数,2下面标识符中,不合法的用户标识符是_。 A._char B.char C.ab D.a_b,3下面4组常量,合法的一组C语言常量是_。 A. 0 B. 10 C. 0.01 D. 0.1 0x10 10L “” 3E+0 2E+9 E1 “” “” a “a” t tt “ 0 t 012,4设int类型的数据长度为2个字节,则unsigned int类型数据的取值范围是_。 A. -3276832767 B. 0255 C. 065535 D. -256256,5若w、x、y、z均为int型变量,则执行下列语句后, z的值是_。 w=5;x=4;y=w+*w+*w+;z=-x*-x*-x+y-; A.131 B.126 C.125 D.130,6若有以下类型说明语句,则表达式c*x+z+y的结果类型是_。 char c;int x;float y;double z; A. char B. int C. double D. float,7若y为int型变量,则执行以下语句后, y的值是_。 y=8;y+=y-=y*y; A.64 B.-56 C.-112 D.-48,8若m、x、y、z均为int型变量,则执行下列语句后 的m值是_。 m=1;x=2;y=3;z=4; m=(my)?m:y; m=(mx)?m:x; m=(mz)?m:z; A. 1 B. 4 C. 2 D. 3,9若a、b为int型变量,则执行下列语句后的b值是_。 a=15;b=15; do b-=a; a+; while(b-0); A. 0 B. -15 C. -16 D. -1,10若有以下语句,则下面_是正确的描述。 static char x=“123456”; static char y=1,2,3,4,5,6; A. x数组与y数组长度相同。 B. x数组长度大于y数组长度。 C. x数组长度小于y数组长度。 D. x数组和y数组的赋值是非法的。,11若已定义a为int型变量,则_是对指针变量p的正确说明和初始化。 Aint p=,12若用数组名作为函数调用的实参,则实际上传送给形参的是_。 A数组的全部元素值 B数组的首地址 C数组的第一个元素值 D数组所含元素数目,13已知下列说明语句,则表达式*(q+2)的值是_。 static int a=2,4,6,8; static int *p=a,a+1,a+2,a+3; int *q; q=p; A. 6 B. 2 C. 4 D. 8,14若有如下宏定义,则执行下列语句:z=4*(N+y(5)后的结果是_。 #define N 2 #define y(n) (N+1)*n) A语句有错误 Bz值为68 Cz值为60 Dz值为180,15C语言中函数返回值的类型是由_决定的。 Areturn语句中的表达式类型 B调用该函数的主函数类型 C总是int类型 D定义函数时指定的类型,16设a和b均为int型变量,则执行以下语句后的输出为_。 int a=20; int b=3; printf(“%dn”,a+=(b%=2); A20 B21 C0 D 23,17有以下说明和p= Ap-age Bstudent.age C*p.age Dstud1.student.age,18语句float(*p)();说明了_。 Ap是指向一维数组的指针变量 Bp是一函数名,该函数的返回值是指向float类型数据的指针 Cp是指向函数的指针,该函数返回值的类型是float Dp是指向float类型数据的指针变量,19说明语句如下,则正确的叙述是_。 union data int x; char y; float z; a; A data和a均是联合类型变量 B a所占内存长度等于其成员x、y、z各在内存所占长度之和 C 任何情况下,均不能对a作整体赋值 D. a的地址和它的各成员地址都是同一地址,20C语言文件操作函数fread(buffer,size,n,fp)的功能是_。 A从文件fp中读n个字节存入buffer B从文件fp中读n个大小为size字节的数据项存入buffer中 C从文件fp中读入n个字节放入大小为size字节的缓冲 区buffer中 D从文件fp中读入n个字符数据放入buffer中,21下列程序运行后的输出结果是_。 main() int i=1; while(i=19) if(+i%3!=2) continue; else printf(“%d”,i); printf(“n”); A158111417 B258111417 C1258111417 D25811141720,22下列程序运行后的输出结果是_。 main() static char s=“abcdefgca”; p(s); printf(“s=%sn”,s); p(s) char s; int i,j; for(i=j=0;si!=0;i+) if(si!=a+2) sj+=si; sj=0; As=abcdefgca Bs=abdefga C. s=bcdefgc D. 程序有错,23下列程序运行后的输出结果是_。 main() int a44,i,j,k; for(i=0;i4;i+) for(j=0;j4;j+) aij=i-j; for(i=1;i4;i+) for(j=i+1;j4;j+) k=aij; aij=aji; aji=k; for(i=0;i4;i+) printf(“n”); for(j=0;j4;j+) printf(“%4d”,aij); ,A0 -1 -2 -3 B0 1 2 3 1 0 -1 -2 -1 0 1 2 2 1 0 -1 -2 -1 0 1 3 2 1 0 -3 -2 -1 0 C0 -1 -2 -3 D0 1 2 3 1 0 1 2 -1 0 -1 -2 2 -1 0 1 -2 1 0 -2 3 -2 -1 0 -3 2 1 0,for(i=1;i4;i+) for(j=i+1;j4;j+) k=aij; aij=aji; aji=k; ,24下列程序运行后的输出结果是_ 。 main() char *letter5=“ab”,“cde”,“ijkl”,“mnop”,“rst”; char *ptr; int i; ptr=letter; for(i=0;i5;i+) if(strcmp(ptri,“rst”)) printf(“%s”,ptri); printf(“n”); ,A abcdeijklmnop B. ab cde ijkl mnop C. Rst D. abcdeijklmnooprst,25下列程序运行后的输出结果是_ 。 #include main() static int a=3,8,10,6,9; static int *ptr= A. 3 B. 4 C. 5 D. 12 6 12 15 9,26. 下列程序运行后的输出结果是_ 。 void main() int m=4,n=2,k; k=fun(m,n); printf(“%dn”,k); k=fun(m,n); printf(“%dn”,k); fun(x,y) int x,y; static int n=3,i=2; i+=n+1; n=i+x+y; return (n); A. 12 B. 12 C. 12 D. 12 12 23 25 16,27. 下列程序运行后的输出结果是_ 。 void main() char str=“The Microsoft”; int n=4; sub(str,0,n-1); sub(str,0,strlen(str)-1); printf(“%sn”,str); ,sub(str,n1,n2) char *str; int n1,n2; char c,*p; p=str+n2; str=str+n1; while(strp) c=*str; *str=*p; *p=c; str+; p-; ,A. tfosorciMThe B. ehT Microsoft C. tfosorciM ehT D. Microsoft The,TheMicrosoft,ehTMicrosoft,TheMicrosoft,while(strp) c=*str; *str=*p; *p=c; str+; p-; ,tfosorciMThe,while(strp) c=*str; *str=*p; *p=c; str+; p-; ,28. 下列程序运行后的输出结果是_ 。 struct s int n; char *c; *p; char d=a,b,c,d,e; struct s a= 10,#include main() p=a; printf(“%dn”,+p-n); printf(“%dn”,(+p)-n); printf(“%cn”,+(*p-c); ,A. 11 B. 11 C. 10 D. 10 20 20 20 20 c b c b,29. 下列程序运行后的输出结果是_ 。 #include int x=1; main() int i=5; fun(i); printf(“%d,%dn”,i,x); ,fun(m) int m; m+=x; x+=m; char x=A; printf(“%dn”,x); printf(“%d,%dn”,m,x); ,A 65 B. A C. A D. 65 6,1 6,1 6,7 6,7 6,1 6,1 6,7 5,7,30. 下列程序运行后的输出结果是_ 。 #include main() int i,j,k=0; for(j=10;j=j-1) printf(“%dt”,j); k+; ,A. 11 13 17 19 23 B. 11 13 17 19 23 29 31 37 29 31 37 C. 11 13 17 19 23 D. 11 13 17 19 21 23 29 31 34 37 29 31 37 39,31. 下列程序运行后,若从键盘输入ABC!四个字符后,程序输出是_ 。 #include main() void receiv(); receiv(); void receiv() char c; c=getchar(); putchar(c); if(c!=!) receiv(); putchar(c); A. ABC! B. ABC!ABC! C. ABC!CBA D. ABCABC,#include main() void receiv(); receiv(); void receiv() char c; c=getchar(); putchar(c); if(c!=!) receiv(); putchar(c); ,void receiv() char c; c=getchar(); putchar(c); if(c!=!) receiv(); putchar(c); ,void receiv() char c; c=getchar(); putchar(c); if(c!=!) receiv(); putchar(c); ,void receiv() char c; c=getchar(); putchar(c); if(c!=!) receiv(); putchar(c); ,A,B,C,!,!,32. 将下述程序运行三次,分别从键盘输入字符串为: -B986C,A7#65和$-743!,则程序输出为_ 。 #include void main() char s20; int x; x=aint(s); printf(“%dn”,x); ,A. B986C B. -986C C. -986 D. -986 A7#65 65 765 765 $7431 743 -743 743,aint(char s) int i,sign,num; gets(s); i=0; sign=1; if(si=-) sign=-1; +i; num=0; while(si!=0) if(si=0 ,第二卷 1. #include #include #define N 20 void f_input(int s,int n); void bubble_sort(int s,int n); void scr_output(int s,int n); main() int aN,n; scanf(“%d“, ,void f_input(int s,int n) FILE *fp; int i; if(fp=fopen(“test.dat“,“r“)=NULL) printf(“Cannot open file.n“); exit(0); for(i=0;in;i+) fscanf(fp,“%d“, s+i); fclose(fp); void bubble_sort(int s,int n) int i,j,t; for(i=1;in;i+) for(j=n-1; j ;-j) if(sjsj-1) t=sj-1; sj-1=sj; sj=t; void scr_output(int s,int n) int i; for(i=0;in;+i) printf(“%4d“,si); printf(“n“); ,5 3 7 4 6,#include #define MAXLINE 100 char pattern=“the“; int getline(char s,int lim) int c,i=0; while(-lim0 ,This is the mann,main() char lineMAXLINE; int found=0,p; while(getline(line,MAXLINE)0) if(strindex(line,pattern)=0) printf( ); found+; return found; ,“%sn“,line,si+=c,return i,int s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论