113年 - 113 灌溉管理組織新進農田水利事業人員甄試試題_綜合行政人員資訊組:程式設計概要#144221

科目:水利會◆程式設計概要 | 年份:113年 | 選擇題數:40 | 申論題數:2

試卷資訊

所屬科目:水利會◆程式設計概要

選擇題 (40)

17.【表 17】Python 程式執行後之輸出為何? (A) 1234 (B) 4321 (C) 432 (D)不會輸出數字串,但產生類似下列訊息:generator object iset at 0x0000… int test=8; test +=2.5; System.out.println(test); int i, sum=0; for (i=1; i<=5; i+=2) sum +=1; System.out.println(sum); int i=0; do { if (i==4) break; i++;} while (i>0); System.out.println(i); int i,sum=0; for (i=1; i<=10; i++){ if(i%2==0) continue; sum++;}; System.out.println(sum); int x=2,y=3; int [] z={6, x, x+y}; System.out.println(z[2]); int i,j=0, count=0; for (i=0; i<10 ;i++) do { j++; count++;} while (j cout << count; int i,j, count=0; for (i=0; i<10 ;i++) for (j=i; j<10; j++) count++; cout << count; int outer = 0; while (outer++ <= 4){ if (outer !=3) continue; int inner = 0; while (inner++ < outer) cout << setw(3) << inner;} int array[] = {30, 47, 26, 17, 22, 23}; cout << array[1]+array[2]<< endl; int [][] A=new int [3][]; A[0]=new int[2]; A[1]=new int[4]; A[2]=new int[5]; System.out.println(A.length); short array[] = {30, 47, 26, 17, 22, 23}; short *x; const int test = (sizeof array)/(sizeof array[0]); x = &array[test-2]; cout << *x << endl; double array[] = {3.0, 4.7, 2.6, 1.7, 2.2, 2.3}; const int test = (sizeof array)/(sizeof array[0]); cout.precision(1); cout.setf(ios::fixed); cout << *(array+test-3) << endl; void Test(int *num){ for (int i=0; i<5; i++) cout << *num++;} t4 = (1,2,3,4) t5 = (t4,5,6) print(len(t5)) num1={'1':'壹','2':'二'} num2={'2':'貳'} num1.update(num2) print(num1) def run(func, x, y): return func(x, y) k = run(lambda a,b: a*b, -5, 4) print('k=', k) def iset(start, stop, step=1): if start < stop: i = start while i < stop: yield i i = i + step else: i = start while i > stop: yield i i = i + step x = iset(4,1,-1) print(x, end="") 【請接續下頁】

申論題 (2)