"基本程式語言 05" 修訂間的差異
出自 陳富國維基館
行 4: | 行 4: | ||
<br><pre> | <br><pre> | ||
下 列 片 斷 程 式 執 行。 | 下 列 片 斷 程 式 執 行。 | ||
− | QUESTION | + | QUESTION 8 Given the exhibit: |
+ | public class Certkiller3 { | ||
+ | public static viod main (String[] args){ | ||
+ | //insert code here | ||
+ | System.out.println(s); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | Which two code fragments, inserted independently at line 3, generate the output 4247? (choose two) | ||
+ | A. String s = "123456789" | ||
+ | S. = (s-"123").replace (1,3, "24") - "89"; | ||
+ | B. StringBuffer s = new StringBuffer ("123456789"); S.delete (0,3) replace(1,3,"24"). Delete (4,6) | ||
+ | C. StringBuffer s = new StringBuffer ("123456789"); S.substring (3,6).delete(1,3). insert (1, "24"). | ||
+ | D. StringBuilder s \= new StringBuilder ("123456789"); S.substring (3,6) delete (1,2). insert (1, "24") | ||
+ | E. StringBuilder s = new StringBuilder ("123456789"); S.delete (0,3) replace(1,3,). Delete (2,5) insert (1, "24") | ||
+ | |||
</pre> | </pre> | ||
行 12: | 行 27: | ||
---- | ---- | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
− | <span style="font-size: medium;">Ans: | + | <span style="font-size: medium;">Ans: B.E </span> |
<span style="font-size:medium;"> 解說: | <span style="font-size:medium;"> 解說: |
於 2013年3月26日 (二) 08:06 的修訂
下 列 片 斷 程 式 執 行。 QUESTION 8 Given the exhibit: public class Certkiller3 { public static viod main (String[] args){ //insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247? (choose two) A. String s = "123456789" S. = (s-"123").replace (1,3, "24") - "89"; B. StringBuffer s = new StringBuffer ("123456789"); S.delete (0,3) replace(1,3,"24"). Delete (4,6) C. StringBuffer s = new StringBuffer ("123456789"); S.substring (3,6).delete(1,3). insert (1, "24"). D. StringBuilder s \= new StringBuilder ("123456789"); S.substring (3,6) delete (1,2). insert (1, "24") E. StringBuilder s = new StringBuilder ("123456789"); S.delete (0,3) replace(1,3,). Delete (2,5) insert (1, "24")
解答
Ans: B.E
解說:
類似題型
題目
解說:
程式觀念考題 | |||||
---|---|---|---|---|---|
基本程式語言 | 決策程式語法 | 迴圈/重複敘述 | 副程式呼叫與遞迴 | 物件導向-類別與物件 | 其他 |
|
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |