熱門推薦罰單破解實戰交通警察名師 25 年經驗,親授警察臨檢、檢舉魔人、科技執法、車禍糾紛的執法邏輯看課程介紹
購物車我的課程我的書籤免費註冊
資訊處理·106·程式語言1/5

資訊處理 106程式語言考古題

5 題申論題資料來源:考選部下載 .txt
跨年同科91-115

題目為考試當年公告版本,實務標準請以現行規範為準。

試題5
106
1

試問下列C++程式碼執行後,其值為多少?(25 分) #include <iostream> using std::cout; using std::endl; int a(int i) { static int v=1; int t=v; v+=i; return t; } int b(int i) { int v=1; int t=v; v+=i; return t; } static int v; int c(int i) { int t=v; v+=i; return t; } int main() { int i; for (i=1; i<=10; i<<=1) { a(i); b(i); c(i); } cout<<"a="<<a(i)<<endl; cout<<"b="<<b(i)<<endl; cout<<"c="<<c(i)<<endl; return 0; } 106年特種考試地方政府公務人員考試試題 等 別: 三等考試 類 科: 資訊處理 科 目: 程式語言

106
2

下表是一個名為company 的資料庫裡面user 的表格 username email password creat_time 請使用SQL 語法加入三筆資料,如下表。(25 分) username email password creat_time John [email protected] john 2017-01-01 03:26:30 Marry [email protected] marry 2017-10-10 20:15:56 Stephen [email protected] stephen 2017-12-25 23:59:59

106
3

試問下列程式碼執行後,其值為多少?(25 分) #include <stdio.h> #include <stdlib.h> int main(void) { int x = 5, y = 7; if(x=6){ printf("%d\n", x*y); } else { printf("%d\n", x+y); } if (x == 8) { printf("%d\n", x*(x+y)); } else { printf("%d\n", x - y); } printf("%d\n", x); printf("%d\n", y); system("pause"); return 0; }

106
4

寫出一BNF 文法,產生符合以下條件的數字N: N 為一個二進位數字。(25 分)

106
5

下列的C 程式將先請使用者輸入一整數,之後再從1 加到此數的總和。請修改下列 程式的錯誤之處。(20 分) #include <stdio.h> int main() { int i, num, total; printf("請輸入一整數: "); scanf("%d", num); for(i=1, i<=num, i++) total += i; printf("1 加到%d = %d\n", num); return 0; }

同年其他科目106 · 29