资源描述:
《二级c语言之二维数组与指针测试(two level c language two-dimensional array and pointer test)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、二级c语言之二维数组与指针2测试(TwolevelClanguagetwo-dimensionalarrayandpointer2test)Http://www.educity.cnAuthor:unknownsource:commentintothecommunitynetworkinJuly27,2006TheNationalComputerRankExaminationtwoCcollectioncontainingtheanswerquestionsovertheyears(CHMfile
2、)"Theninthpart:thetwo-dimensionalarrayandpointerAchoice(1)thefollowingprocedures(main){Inta[3][3],*p,i;P=&a[0][0];For(i=0;i<9;i++)P[i]=i;For(i=0;i<3;i++)Printf(%d,a[1][i]);}OutputistheresultofrunningtheprogramA)012B)123C)234D)345(2)thefollowingprocedu
3、res(main){int(*ptr)a[3][2]={0},[2],I,j;For(i=0;i<2;i++){ptr=a+i;Scanf(%d,PTR);Ptr++;}For(i=0;i<3;i++){For(j=0;j<2;j++)Printf(%2d,a[i][j]);Printf("");}}IftheRuntime:123,outputresultsA)errorinformationB)102000C)123000D)102030(3)thefollowingproc
4、edures(main){Intnum[4][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},I,j;For(i=0;i<4;i++){For(j=1;j<=i;j++printf("%c"),'');For(j=j<4;j++)printf(%4d,num[i][j]);Printf("");}}Ifthefollowingoutputintheformofrighttrianglearray12346781112SixteenThep
5、rogramshouldfilltheunderlineA)I-1B)IC)i+1D)4-i(4)thefollowingdefinitionofatwo-dimensionalarrayiscorrectAinta[][3]);Binta[][3]={2*3});Cinta[][3]={});Dinta[2][3]={{1},{2},{3,4}});(5)ifthefollowinginstructionsandstatements,intc[4][5](*p)[5];p=c;Carrayele
6、mentreferenceiscorrectA)p+1B)*(p+3)C)*(p+1)+3D)*(p[0]+2))(6)thefollowingdefinitionsandstatementsInta[3][2]={1,2,3,4,5,6,*p[3]};P[0]=a[1];*p[0]+1)isrepresentedbyarrayelementsA)a[0][1]B)a[1][0]C)a[1][1]D)a[1][2](7)thefollowingproceduresIntf(intb[][4]){i
7、nti,J,s=0;For(j=0;j<4;j++){i=j;If(i>2)i=3-j;S+=b[i][j];}Returns;}(main){inta[4][4]={{1,2,3,4},{0,2,4,5},{3,6,9,12},{3,2,1,0}};Printf("%d",f(A));}OutputistheresultoftheexecutionofA)12B)11C)18D)16(8)thefollowingcannotdefinethecorrectoptionistwo-dimens
8、ionalarrayInta[2][2]={{1},{2}}A);Binta[][2]={1,2,3,4});Inta[2][2]={{1},2,3}C);Inta[2][]={{1,2},{3,4}}D);(9)ifdefined:int*p[3];then,thestatementsbelowiscorrectA)definesabasetypepointervariablepint,thisvariablehasthreepointersB)definesapointerto