106年 捷運招考 工程員(二) 一般類組(資訊類) 應用系統程式設計 試卷

pdf
282.82 KB
5 頁
Administrator
侵權投訴
加載中. ..
PDF
臺北捷運公司 106 49日新進工程員()(資訊類)
甄試試題-應用系統程式設計
1 頁,共 5
注意: 請務必填寫姓名:
1.以下題目應全部作答。 應考編號:
2.科目總分為 100 分。
3.作答時目,但請標明題號並請用藍(黑)原子筆橫向書寫。
題目:
一、 (每階段 4分,共 20 )
軟體工程是以工程的手法開發軟體系統,其中需求工程是風險最高、
也是最困難的步驟,其中區分需求擷取、需求分析建模、建立需求
規格、需求驗證與確認、需求變更演化管理五個階段,請簡述這五
個階段的活動內容
二、 (每項 3分,共項,計 30 )
以下 C# 程式是簡化的門禁警示系統, UML 設計圖如下所示。
(1) 請完成 UML 計圖 關係線。
(2) 請分別寫出執行程式 的輸出。
(3)請說明程式中 IMonitorMonitor的關係以及Monitor的規範。
(4)請說明程式中static 屬性(attribute) static 方法 (method)的用
臺北捷運公司 106 49日新進工程員()(資訊類)
甄試試題-應用系統程式設計
2 頁,共 5
途。
public class Alert {
public Alert() { warning = 0; }
public String sendAle r t(int code) {
warning = code;
if (code == 2) {
Console.Write("Urgent! ");
return "Urgent !";
}
else if (code == 1) {
Console.Write(" HELP ! ");
return "HELP!";
}
else {
Console.Write("OK! " );
return "OK";
}
}
public bool wasAlertSend() {
if (warning == 0) return false;
return true;
}
privat e int warning;
}
public class Door {
public Door( ) {status ="CLOSE";}
public String Status {
get { return status; }
set { status = value; }
}
private String status;
}
public inter face I Monitor {
int execute();
}
public class Monitor:IMo nitor{
public Monitor(Door d) {door = d;}
public int execute() {
String s = door.Status;
if (s =="BROKEN") return 2;
else if (s =="OPEN") return 1;
else return 0;
}
private Door door;
}
public class Server {
public Server(Alert a) { alert = a; }
public void monitor() {
int code = doorMonitor.execute();
if (code > 0) alert.sendAlert(code);
}
public void setMonitor (IMonitor dm){
doorMonitor = dm;
}
private IMonitor doorMonitor;
private Alert alert;
}
public class ServerApp {
private static Door door;
private static Alert alert;
private static IMonitor monitor;
private static Server server;
private static void te stAlert(String msg) {
door = new Door();
alert = new Alert();
monitor = new Monitor(door);
Server server = new Server(alert);
server.setMonitor(monitor);
door.Status = msg;
server.monitor();
if (!alert.wasAlertSend())
Console.Write("OK! ");
}
public static void te st0 1() {
alert = new Alert();
Console.WriteLine(alert.sendAlert(2)); //
}
public static void te st0 2() {
door = new Door();
door.Status = "OPEN";
Console.WriteLine(door.Status); //
}
public static void te st0 3() {
Door door = new Door();
Monitor monitor = new Monitor(door);
door.Status = "OPEN";
Console.WriteLine(monitor.execute()); //
}
public static void te st0 4() {
testAlert("OPEN"); //
testAlert("CLOSE"); //
testAlert("BROKEN"); //
}
}
臺北捷運公司 106 49日新進工程員()(資訊類)
甄試試題-應用系統程式設計
3 頁,共 5
三、 有一家公司須要建置資料管理生產商品所需零件的供應狀況。
各零件的供應廠商只會有一家分別記錄廠商編號 (sno)以及
地區 (sregion)。供應的零件則分為不同的編號 (pno)尺寸
(psize)售價 (pprice),及數量 (qty)
其資料庫表格如:
Supplier (sno, sregion)
Part (pno, psize, pprice, sno, qty)
後來管理階層決每一種零件的供應商可以有多家每一家供
(Supply)的零件數量不一尺寸及售價需相同各自供應地
區不同於是資料庫表格必須進行修改 30 分)
() 請問這個資料庫表格要如何修改(可增加表格並調整欄
),才能符合第三正規化 (Third Normal Form, 3NF)
Door
- status
+ getStatus()
+ setStatus(string)
Alert
- warning
+ sendAlert(int)
+ wasAlertSend()
Monitor
+ execute()
Server
- status
+ monitor()
+ setMonitor(IMonitor)
<<interface>>
IMonitor
+ execute()
String
臺北捷運公司 106 49日新進工程員()(資訊類)
甄試試題-應用系統程式設計
4 頁,共 5
請注意需全列所有修改後的資料庫表格 (5 )
() 請以修改後的資料庫寫出 SQL 指令,列出所有零件供應
關係的完整資訊也就是依照零件編號排序顯示下列欄位:
零件編號尺寸售價供應廠商編號及數量 (5 )
() 請以修改後的資料庫寫出 SQL 指令,分別列出各零件不
分地區的總供應數量 [提示: 零件, 總供應數量] (10
)
() 承上題,如果要將零件 A的總數量限為 1000”,可能
需考慮什麼問題? (10 )
四、 關於資料結構與演算法,請回答以下問題 20 分)
() 請比較 Stack Queue 兩種資料結構的差異。 (4 )
() 請舉例說明 Stack Queue 兩種結構分別適合用於什麼
情形。 (4 )
() 為了記錄每個人與人之間的好友關係可以使用 graph
記錄一個節點 (node) 代表一個人而連接節點與節點
之間的邊 (edge) 則代表人與人之間的關係請以廣度
尋法 (Breadth-First Search, BFS) 搜尋以下的graph
尋訪結果順序為何? (6 )
臺北捷運公司 106 49日新進工程員()(資訊類)
甄試試題-應用系統程式設計
5 頁,共 5
() 承上題,請寫出深度搜尋法 (Depth-First Search, DFS)
演算法,找出某人能透過好友關係連結到的所有人。
(6 )
A
B
F
D
C
E
G
收藏 ⬇️ 下載