




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、二级c语言之二维数组与指针2测试(Two level C language two-dimensional array and pointer 2 test)Http:/ Author: unknown source: comment into the community network in July 27, 2006The National Computer Rank Examination two C collection containing the answer questions over the years (CHM file) The ninth part: the two-d
2、imensional array and pointerA choice(1) the following procedures(main)Int a33, *p, i;P=&a00;For (i=0; i9; i+)Pi=i;For (i=0; i3; i+)Printf (%d, a1i);Output is the result of running the programA) 012B) 123C) 234D) 345(2) the following procedures(main)int (*ptr) a32=0, 2, I, j;For (i=0; i2; i+)ptr=a+i;
3、Scanf (%d, PTR);Ptr+;For (i=0; i3; i+)For (j=0; j2; j+)Printf (%2d, aij);Printf (n);If the Runtime: 12 3, output resultsA) error informationB) 102000C) 123000D) 102030(3) the following procedures(main)Int num44=1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16, I, j;For (i=0; i4; i+)For (j=1; j=i; j+ printf
4、 (%c), );For (j= j4; j+) printf (%4d, numij);Printf (n);If the following output in the form of right triangle array12346781112SixteenThe program should fill the underlineA) I-1B) IC) i+1D) 4-i(4) the following definition of a two-dimensional array is correctA int a3);B int a3= 2*3);C int a3=);D int
5、a23=1, 2, 3,4);(5) if the following instructions and statements, int c45 (*p) 5; p=c; C array element reference is correctA) p+1B) * (p+3)C) * (p+1) +3D) * (p0+2)(6) the following definitions and statementsInt a32=1,2,3,4,5,6, *p3;P0=a1;*p0+1) is represented by array elementsA) a01B) a10C) a11D) a12
6、(7) the following proceduresInt f (int b4)int i, J, s=0;For (j=0; j2) i=3-j;S+=bij;Return s;(main)int a44=1,2,3,4, 0,2,4,5, 3,6,9,12, 3,2,1,0;Printf (%dn, f (A);Output is the result of the execution ofA) 12B) 11C) 18D) 16(8) the following cannot define the correct option is two-dimensional arrayInt
7、a22=1, 2 A);B int a2=1,2,3,4);Int a22=1, 2,3 C);Int a2=1,2, 3,4 D);(9) if defined: int *p3; then, the statements below is correctA) defines a base type pointer variable p int, this variable has three pointersB) defines a pointer to an array of P, the array contains three elements,Each element is the
8、 base type pointer intC) defines a *p integer array, the array contains three int type elementsD) defines a point to a one-dimensional array pointer variable p, a one-dimensional array should have three types of int elements(10) the following procedures(main)int a33, *p, i;P=&a 00;For (i=0; i9; i+)
9、pi=i+1;Printf (%dn, a12);Output is the result of running the programA) 3B) 6C) 9D) 2(11) the following can correct definition of the array and the initial value of the statement is correctInt N=5, bNN A);Int a12=1, 3 B);Int c2=1,2, 3,4 C);Int d32=1,2, 34 D);(12) the following procedures(main)int m3=
10、1,4,7,2,5,8,3,6,9;Int i, J, k=2;For (i=0; i3; i+)printf (%d, mki);After the implementation of the output isA) 456B) 258C) 369D) 789(13) the following procedures(main)int a3=1,2,3, 4,5,0, 3, I (*pa);Pa=a;For (i=0; i3; i+)If (i2) pa1i=pa1i-1;Else pa1i=1;Printf (%dn, a01+a11+a12);After the implementati
11、on of the output isA) 7B) 6C) 8D) no definite value(14) the following procedures(main)int aa44=1,2,3,4, 5,6,7,8, 3,9,10,2, 4,2,9,6;Int i, s=0For (i=0; i4; i+) s+=aai1;Printf (%dn, s);Output is the result of running the programA) 11B) 19C) 13D) 20(15) if the following definitions and statements:Int s
12、45 (*ps) 5;Ps=s;The s array element reference form is correctA) ps+1B) * (ps+3)C) ps02D) * (ps+1) +3(16) output is the result of the following procedure(main)int b33=0,1,2,0,1,2,0,1,2, I, J, t=1;For (i=0; i3; i+)For (j=i; j=i; j+) t=t+bibjj;Printf (%dn, t);A) 3B) 4C) 1D) 9(17) is not correct in the
13、following definition of arrayA int a23);B int b3=0,1,2,3);C int c100100=0);D int d3=1,2, 1,2,3, 1,2,3,4);(18) output is the result of the following procedure(main)int a44=1,3,5, 2,4,6, 3,5,7;Printf (%d%d%d%dn, a03, a12, a21, a30);A) 0650B) 1470C) 5430D) the output value is not set(19) output is the
14、result of the following procedureA) 1,5,9B) 1,4,7C) 3,5,7D) 3,6,9(main)int i, x33=1,2,3,4,5,6,7,8,9;For (i=0; i3; i+) printf (%d, xi2-i);(20) output is the result of the following procedureA) 18B) 19C) 20D) 21(main)int a33=1,2, 3,4 5,6, I, J, s=0;For (i=1; i3; i+)For (j=0; j=i; j+) s+=aij;Printf (%d
15、n, s);(21) if the following definition: int t32; t can correctly represent the expression array element is.A) &t32B) t3C) t1D) t2(22) the following proceduresMain0int a33=1,2, 3,4, 5,6, I, J, s=0;For (i=1; i3; i+)For (j=0; ji; j+) s+=aijPrintf (%dn, s);The output results of the program isA) 18B) 19C
16、) 20D) 21(23) the output of the following program after the implementation of the resultsA) 3B) 6C) 9D random number)(main)int a33, *p, i;P=&a00;For (i=p; i9; i+) pi=i+1;Printf (%d n, a12);(24) output is the result of the following procedureA) 52B) 51C) 53D) 97(main)int i, x33=9, 8, 7, 6, 5, 4, 3, 2
17、, 1, *p=&x11;For (i=0; i4; i+=2) printf (%d, pi);(25) if the following description and statements, then after the for statement is executed, (* * (pt+l) +2) represents the array elementsA) t20 B) t22 C) tl2 D) t2lInt t33 (3, K, *pt;For (k=0; k3; k+) ptk=&tk0;(26) output is the result of the followin
18、g procedureA) 14B) 0C) 6D) value is uncertain(main)int n33, I, j;For (i=0; i3; i+)For (j=0; j3; j+) nij=i+j;For (i=0; i2; i+)For (j=0; j2; j+) ni+1j+1+= nij;Printf (%dn, nij);(27) perform the following procedures, the value of MInt a23=1,2,3, 4,5,6;Int m, *p;P=&a00;M= (*p) (* * (p+2) * (* (p+4);A) 1
19、5B) 14C) 13D) 12(28) if the following definitions and statements:Int w23 (*pw) 3;Pw=w;The w array element reference is illegalA) * (w0+2)B) * (pw+1) 2C) pw00D) * (pw1+2)(29) if the following instructions:Int w34o=0,1, 2,4, 5,8;Int (*p) 4=w;The numerical expression is 4A) *w1+1P+, B) * (p+1)C) w22D)
20、p11(30) if the following statement and statement:(main)int t32, *pt3, k;FPR (k=o; k3; k+) ptk=tk;The options can correctly represent the expression elements of t address isA) &t32B) *pt0C) * (pt+1)D) &pt2(31) change and arrays are defined as follows:Int i;Int x33=1,2,3,4,5,6,7,8,9;The output is the
21、result of the following statementFor (i=0; i3; i+) printf (%d, xi2-1);A) 159B) 147C) 357D) 369(32) with the following definition:Int a43=1,2,1 2 3 4 1 5 9 135 6 7 8 2 6 10 14当一9 10 11 12 3 7 11则 = 1513 14 15 16 4 8 12 16请填空#定义N 4无效的旋转(int ) int i,j,t;为(i = 0;i n;i+)为(j = 0;【7】;j+) T =一个我 J ;8】【;一个 J
22、 我 = T;(5)以下程序运行后的输出结果是【9】main() int i,j,一个 3 = 1,2,3,4,5,6,7,8,9 ;为(i = 0;i 3;i+)为(j = i + 1;J3;j+)一个 J 我 = 0;为(i = 0;i 3;i+)在(j = 0;J3;j+)printf(“D”,一个我 J );printf(“n”);(6)若有以下程序main() int 4 4 = 1,2,3,4 , 0,12 -,- 13,14,21,23,0,24 , - 31、32、- 63 ;int i,j,s = 0;为(i = 0;i 4;i+)在(j = 0;J4;j+)如果(一个我 J
23、 0)继续;如果(一个我 J = = 0)打破;+ =一个我 J ;printf(“%d”,S);执行后输出的结果是【10】。(7)函数杨辉的功能是把杨辉三角形的数据赋给二维数组的下半三角,形式如下一1 11 2 11 3 3 11 4 6 4 1其构成规律是:第0列元素和主对角线无素均为1其余元素为其左上方和正上方元素之和数据的个数每行递增1请将程序补充完整。# defint N 6虚空YangHui(int *的 ) int i,j;x 0 0 = 1为(i = 1;i n;i+) x 我 0 【】= 1 = 11;为(J = 1;J 我;j+)x 我 J = 12】【;(8)有趣的函数的
24、功能是:首先对一所指的N行N列的矩阵,找出各行中的最大的数,再求这个最大值中的最小的那个数作为函数值返回请填空N。#包括#定义N 100国际娱乐(int(*) )行,COL,max,min;为(行= 0;排n;行+ +)在(最大=一个行 0 ,col = 1;胶原n;胶原+ +)如果( 13 )max =一个行 西;如果(行= = 0)min =最大;如果( 14 )min =最大;返回min;(9)以下程序中,选择函数的功能是:在N行M列的二维数组中,选出一个最大值作为函数值返回,并通过形参传回此最大值所在的行下标。请填空。#定义N 3#定义M 3选择(int N M,int n) int i,j,行= 1,柱= 1;为(i = 0;i 一行 列)行=我;柱= j;* N = 15】【;返回【16】;main() int的 M = 9,11,23,6,1,15,9,17,20 ,MAX,N;马克斯=选择(A,N);printf(“最大= %d,线= %dn”,MAX,N);(10)以下程序中,主函数调用了linemax函数,实现在N行M列的二维数
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025版大型商场机电安装工程合同范本张奇
- 2025版民法典离婚协议书编制流程与范文剖析
- 二零二五年度堆场租赁与安全防护服务合同
- 2025年度酒类企业仓储物流优化与整合服务合同
- 二零二五年度绿色节能建筑水电预埋施工合作协议
- 2025年度电厂钢煤斗施工临时道路与交通管制合同
- 二零二五年二手房买卖与家具搬运服务合同
- 2025版出租车合资购买合同书:出租车行业智能交通管理系统合作协议
- 2025版别墅产权交易合同范本含税费结算明细
- 2025年车贷抵押经营性合同协议
- 浇筑楼板的质保合同范本
- 中铁自营项目管理办法
- 集团内部拆借管理办法
- 肛周脓肿病例分析
- 眩晕症的护理课件
- 企业信息化领导小组成员和职责
- 2025年丁烷气瓶市场前景分析
- 2025年北京市高考英语试卷(含答案)
- 计算机视觉与深度学习在交通工程中的应用
- 软件开发项目上线报告模板
- 医院重点病人管理制度
评论
0/150
提交评论