二級(jí)c語言之二維數(shù)組與指針測(cè)試(Two level C language two-dimensional array and pointer test)_第1頁
二級(jí)c語言之二維數(shù)組與指針測(cè)試(Two level C language two-dimensional array and pointer test)_第2頁
二級(jí)c語言之二維數(shù)組與指針測(cè)試(Two level C language two-dimensional array and pointer test)_第3頁
二級(jí)c語言之二維數(shù)組與指針測(cè)試(Two level C language two-dimensional array and pointer test)_第4頁
二級(jí)c語言之二維數(shù)組與指針測(cè)試(Two level C language two-dimensional array and pointer test)_第5頁
已閱讀5頁,還剩28頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、二級(jí)c語言之二維數(shù)組與指針2測(cè)試(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當(dāng)一9 10 11 12 3 7 11則 = 1513 14 15 16 4 8 12 16請(qǐng)?zhí)羁?定義N 4無效的旋轉(zhuǎn)(int ) int i,j,t;為(i = 0;i n;i+)為(j = 0;【7】;j+) T =一個(gè)我 J ;8】【;一個(gè) J

22、 我 = T;(5)以下程序運(yùn)行后的輸出結(jié)果是【9】main() int i,j,一個(gè) 3 = 1,2,3,4,5,6,7,8,9 ;為(i = 0;i 3;i+)為(j = i + 1;J3;j+)一個(gè) J 我 = 0;為(i = 0;i 3;i+)在(j = 0;J3;j+)printf(“D”,一個(gè)我 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+)如果(一個(gè)我 J

23、 0)繼續(xù);如果(一個(gè)我 J = = 0)打破;+ =一個(gè)我 J ;printf(“%d”,S);執(zhí)行后輸出的結(jié)果是【10】。(7)函數(shù)楊輝的功能是把楊輝三角形的數(shù)據(jù)賦給二維數(shù)組的下半三角,形式如下一1 11 2 11 3 3 11 4 6 4 1其構(gòu)成規(guī)律是:第0列元素和主對(duì)角線無素均為1其余元素為其左上方和正上方元素之和數(shù)據(jù)的個(gè)數(shù)每行遞增1請(qǐng)將程序補(bǔ)充完整。# 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)有趣的函數(shù)的

24、功能是:首先對(duì)一所指的N行N列的矩陣,找出各行中的最大的數(shù),再求這個(gè)最大值中的最小的那個(gè)數(shù)作為函數(shù)值返回請(qǐng)?zhí)羁誑。#包括#定義N 100國際娛樂(int(*) )行,COL,max,min;為(行= 0;排n;行+ +)在(最大=一個(gè)行 0 ,col = 1;膠原n;膠原+ +)如果( 13 )max =一個(gè)行 西;如果(行= = 0)min =最大;如果( 14 )min =最大;返回min;(9)以下程序中,選擇函數(shù)的功能是:在N行M列的二維數(shù)組中,選出一個(gè)最大值作為函數(shù)值返回,并通過形參傳回此最大值所在的行下標(biāo)。請(qǐng)?zhí)羁铡?定義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)以下程序中,主函數(shù)調(diào)用了linemax函數(shù),實(shí)現(xiàn)在N行M列的二維數(shù)

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論