106年 地方特考 三等 資訊處理 程式語言 試卷

pdf
55.56 KB
2 頁
win7 2007
侵權投訴
加載中. ..
PDF
106年特種考試地方政府公務人員考試試題 代號:33660 全一張
(正面)
等別 三等考試
類科 資訊處理
科目 程式語言
考試時間 2 小時
※注意:
禁止使用電子計算器。
不必抄題,作答時請將試題題號及答案依照順序寫在試卷上,於本試題上作答者,不予計分。
本科目除專門名詞或數理公式外,應使用本國文字作答。
(請接背面)
一、試問下列 C++程式碼執行後,其值為多少?(25 分)
#include
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="<
cout<<"b="<
cout<<"c="<
return 0;
}
106年特種考試地方政府公務人員考試試題 代號:33660 全一張
(背面)
等別 三等考試
類科 資訊處理
科目 程式語言
二、下表是一個名為 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
三、試問下列程式碼執行後,其值為多少?(25 分)
#include
#include
int main(void) {
int x = 5, y = 7;
if(x=6){
printf("%dn", x*y);
}
else {
printf("%dn", x+y);
}
if (x == 8) {
printf("%dn", x*(x+y));
}
else {
printf("%dn", x - y);
}
printf("%dn", x);
printf("%dn", y);
system("pause");
return 0;
}
四、寫出一 BNF 文法,產生符合以下條件的數字 N
N為一個二進位數字。25 分)
收藏 ⬇️ 下載