阿摩線上測驗
登入
首頁
>
程式語言
> 103年 - 103 鐵路特種考試_高員三級_資訊處理:程式語言#24841
103年 - 103 鐵路特種考試_高員三級_資訊處理:程式語言#24841
科目:
程式語言 |
年份:
103年 |
選擇題數:
0 |
申論題數:
8
試卷資訊
所屬科目:
程式語言
選擇題 (0)
申論題 (8)
一、請比較類別(class)的使用者觀點(user view)及開發者觀點(developer view) 的差異。(10 分)
二、請寫出下列敘述的正規表達式(regular expression): “Each word must start with two digits, followed by a upper case letter, and then followed by at least one letter either upper case or lower case.” (10 分)
三、請問下列 Java 程式執行結果為何?(10 分) import java.io.IOException; public class throwException { public static void main(String[] args) throws E { try {E e1 = new E(“here comes e1”); throw e1; System.out.println(“gets here”); } catch(E e1) { System.out.println(“catches e1”);} }//main }//throwException class E extends IOException { E(String message) { super(message); } }// class E
四、請問下列 Java 程式輸出為何?(10 分) public class C6 { public static void main(String[] args) { int [] a = new int[2]; int [] b = new int[2]; a[0] = 6;b[0] = 6;a[1] = 7;b[1] = 7; System.out.println(a.equals(b)); }}
五、請問下列 Java 程式輸出為何?(20 分) import java.text.DecimalFormat; public class C3 { public static void main(String[] args) { DecimalFormat d = new DecimalFormat("0.00"); double grosspay = 800.416; System.out.println(d.format(grosspay)); grosspay = 1234.567; System.out.printf("%1.2f", grosspay); } }
六、下列為一物件導向程式: class A { private int a1; public void m1( ); { a1 = 1;} public void m2( ); { a1 = 3;} } class B extends A { private int b1; private int b2; public void m2( ); { b1 = 1; b2 = 2;} public void m3( ); { a1 = 2; } } 請說明其中的繼承(inheritance)及覆寫(overriding); 並請說明 class B 的物件內含那些資料欄位(data fields)?(20 分)
⑴請說明下列 main 程式執行情形。(10 分)
⑵請以此程式解釋動態繫結(dynamic binding)。(10 分)